Sha256: 203edb1c6b61e934c776c8369f925d1ba693fc600ba0f069167b84e17025a1b6

Contents?: true

Size: 1.25 KB

Versions: 3

Compression:

Stored size: 1.25 KB

Contents

require 'test_helper'

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

  test 'breadcrumb' do
    actual = ui_breadcrumb tap: true do |b|
      b.link 'Home', url: '#home', glyph: 'home'
      b.link 'state', { url: '#state', state: :active }
    end
    expected = "<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>"

    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(store: users, link_label: :name_fr, link_url: user_path(:id))
    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

3 entries across 3 versions & 1 rubygems

Version Path
ui_bibz-2.0.2 test/ui/core/navigations/breadcrumb_test.rb
ui_bibz-2.0.1 test/ui/core/navigations/breadcrumb_test.rb
ui_bibz-2.0.0 test/ui/core/navigations/breadcrumb_test.rb