Sha256: 65179258d6add839e9e0852172a3ea0728c61cbb3922eedc00c92e759b75301b

Contents?: true

Size: 1.33 KB

Versions: 37

Compression:

Stored size: 1.33 KB

Contents

# frozen_string_literal: true

require 'test_helper'

class BreadcrumbTest < ActionView::TestCase
  include UiBibz::Helpers::Ui::CoreHelper

  test 'breadcrumb' do
    actual = ui_breadcrumb do |b|
      b.link 'Home', url: '#home', glyph: 'home'
      b.link 'state', { url: '#state', state: :active }
    end
    expected = "<nav arial-label=\"breadcrumb\"><ol class=\"breadcrumb\"><li class=\"breadcrumb-item\"><a href=\"#home\"><i class=\"glyph fas fa-home\"></i> Home</a></li><li class=\"active breadcrumb-item\"><a href=\"#state\">state</a></li></ol></nav>"

    assert_equal expected, actual
  end

  # test 'breadcrumb with nav' do
  # actual = UiBibz::Ui::Core::Paths::Breadcrumb.new(type: :nav).tap do |b|
  # b.link 'Home', url: '#home', glyph: 'home'
  # b.link 'state', { url: '#state', state: :active }
  # end.render
  # expected = ""

  # assert_equal expected, actual
  # end

  test 'breadcrumb with store' do
    users    = create_list(:user, 3)
    actual   = ui_breadcrumb(users, link_label: :name_fr, link_url: user_path(:id))
    expected = '<nav arial-label="breadcrumb"><ol class="breadcrumb"><li class="breadcrumb-item"><a href="/users/1/">Name fr</a></li><li class="breadcrumb-item"><a href="/users/2/">Name fr</a></li><li class="breadcrumb-item" aria-current="page">Name fr</li></ol></nav>'

    assert_equal expected, actual
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
ui_bibz-3.0.13 test/ui/core/navigations/breadcrumb_test.rb
ui_bibz-3.0.12 test/ui/core/navigations/breadcrumb_test.rb
ui_bibz-3.0.11 test/ui/core/navigations/breadcrumb_test.rb
ui_bibz-3.0.10 test/ui/core/navigations/breadcrumb_test.rb
ui_bibz-3.0.9 test/ui/core/navigations/breadcrumb_test.rb
ui_bibz-3.0.8 test/ui/core/navigations/breadcrumb_test.rb
ui_bibz-3.0.7 test/ui/core/navigations/breadcrumb_test.rb
ui_bibz-3.0.6 test/ui/core/navigations/breadcrumb_test.rb
ui_bibz-3.0.5 test/ui/core/navigations/breadcrumb_test.rb
ui_bibz-3.0.4 test/ui/core/navigations/breadcrumb_test.rb
ui_bibz-3.0.3 test/ui/core/navigations/breadcrumb_test.rb
ui_bibz-3.0.2 test/ui/core/navigations/breadcrumb_test.rb
ui_bibz-3.0.1 test/ui/core/navigations/breadcrumb_test.rb
ui_bibz-3.0.0 test/ui/core/navigations/breadcrumb_test.rb
ui_bibz-3.0.0.beta19 test/ui/core/navigations/breadcrumb_test.rb
ui_bibz-3.0.0.beta18 test/ui/core/navigations/breadcrumb_test.rb
ui_bibz-3.0.0.beta17 test/ui/core/navigations/breadcrumb_test.rb
ui_bibz-3.0.0.beta16 test/ui/core/navigations/breadcrumb_test.rb
ui_bibz-3.0.0.beta15 test/ui/core/navigations/breadcrumb_test.rb
ui_bibz-3.0.0.beta14 test/ui/core/navigations/breadcrumb_test.rb