Sha256: cb43bbb696a014a8810e7111fa47a9f998bcdbb77c30a70b454a4215bca40175

Contents?: true

Size: 1.35 KB

Versions: 10

Compression:

Stored size: 1.35 KB

Contents

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

  test 'Nav with tab' do
    actual = UiBibz::Ui::Core::Nav.new().tap do |n|
      n.link 'Home', status: :active, url: "#Home", selector: 'home'
      n.link 'Profile', url: "#profile", selector: 'profile'
      n.link 'Messages', url: "#messages", selector: 'messages'
    end.render
    expected = "<ul class=\"nav nav-tabs\"><li class=\"active\" role=\"presentation\"><a href=\"#Home\">Home</a></li><li role=\"presentation\"><a href=\"#profile\">Profile</a></li><li role=\"presentation\"><a href=\"#messages\">Messages</a></li></ul>"
    assert_equal expected, actual
  end

  test 'Nav with pills' do
    actual = UiBibz::Ui::Core::Nav.new(type: :pills, position: :justified).tap do |n|
      n.link 'Home', status: :active, url: "#Home", selector: 'home'
      n.link 'Profile', url: "#profile", selector: 'profile', badge: 16
      n.link 'Messages', url: "#messages", selector: 'messages', status: :disabled
    end.render
    expected = "<ul class=\"nav nav-pills nav-justified\"><li class=\"active\" role=\"presentation\"><a href=\"#Home\">Home</a></li><li role=\"presentation\"><a href=\"#profile\">Profile<span class=\"badge\">16</span></a></li><li class=\"disabled\" role=\"presentation\"><a href=\"#messages\">Messages</a></li></ul>"

    assert_equal expected, actual
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ui_bibz-1.2.1 test/ui/nav_test.rb
ui_bibz-1.2.0 test/ui/nav_test.rb
ui_bibz-1.1.7 test/ui/nav_test.rb
ui_bibz-1.1.6 test/ui/nav_test.rb
ui_bibz-1.1.5 test/ui/nav_test.rb
ui_bibz-1.1.4 test/ui/nav_test.rb
ui_bibz-1.1.3 test/ui/nav_test.rb
ui_bibz-1.1.2 test/ui/nav_test.rb
ui_bibz-1.1.1 test/ui/nav_test.rb
ui_bibz-1.1.0 test/ui/nav_test.rb