Sha256: d6b1c5ccd3338b057780a8a0f51e5d30c8a3b9e922e4a7e0a94598947d1f5dec

Contents?: true

Size: 1002 Bytes

Versions: 7

Compression:

Stored size: 1002 Bytes

Contents

require 'test_helper'
include UiBibz::Helpers
class NavTest < ActionView::TestCase

  test 'breadcrumb' do
    actual = UiBibz::Ui::Core::Breadcrumb.new.tap do |b|
      b.link 'Home', url: '#home', glyph: 'home'
      b.link 'state', { url: '#state', state: :active }
    end.render
    expected = "<ol class=\"breadcrumb\"><li class=\"breadcrumb-item\"><a href=\"#home\"><i class=\"glyph fa fa-home\"></i> Home</a></li><li class=\"active breadcrumb-item\"><a href=\"#state\">state</a></li></ol>"

    assert_equal expected, actual
  end

  test 'breadcrumb with store' do
    users    = create_list(:user, 3)
    actual   = UiBibz::Ui::Core::Breadcrumb.new(store: users, link_label: :name_fr, link_url: user_path(:id)).render
    expected = "<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\">Name fr</li></ol>"

    assert_equal expected, actual
  end


end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ui_bibz-2.0.0.alpha24 test/ui/breadcrumb_test.rb
ui_bibz-2.0.0.alpha23 test/ui/breadcrumb_test.rb
ui_bibz-2.0.0.alpha22 test/ui/breadcrumb_test.rb
ui_bibz-2.0.0.alpha21 test/ui/breadcrumb_test.rb
ui_bibz-2.0.0.alpha20 test/ui/breadcrumb_test.rb
ui_bibz-2.0.0.alpha19 test/ui/breadcrumb_test.rb
ui_bibz-2.0.0.alpha18 test/ui/breadcrumb_test.rb