Sha256: ea164d686cd924cc28d9afb42ef3cda4bb7bfe9d609d0a0a23ea7644ed909da1

Contents?: true

Size: 1.93 KB

Versions: 57

Compression:

Stored size: 1.93 KB

Contents

# frozen_string_literal: true

require 'test_helper'
class PaginationTest < ActionView::TestCase
  include UiBibz::Helpers::Ui::CoreHelper

  test 'Pagination' do
    actual = ui_pagination do |p|
      p.link 'Home', state: :active, url: '#Home', selector: 'home'
      p.link 'Profile', url: '#profile', selector: 'profile'
      p.link 'Messages', url: '#messages', selector: 'messages'
    end
    expected = '<nav><ul class="pagination"><li class="active page-item"><a class="page-link" href="#Home">Home</a></li><li class="page-item"><a class="page-link" href="#profile">Profile</a></li><li class="page-item"><a class="page-link" href="#messages">Messages</a></li></ul></nav>'

    assert_equal expected, actual
  end

  test 'Pagination size' do
    actual = ui_pagination size: :lg do |p|
      p.link 'Home', state: :active, url: '#Home', selector: 'home'
      p.link 'Profile', url: '#profile', selector: 'profile'
      p.link 'Messages', url: '#messages', selector: 'messages'
    end
    expected = '<nav><ul class="pagination pagination-lg"><li class="active page-item"><a class="page-link" href="#Home">Home</a></li><li class="page-item"><a class="page-link" href="#profile">Profile</a></li><li class="page-item"><a class="page-link" href="#messages">Messages</a></li></ul></nav>'

    assert_equal expected, actual
  end

  test 'Pagination position' do
    actual = ui_pagination position: :right do |p|
      p.link 'Home', state: :active, url: '#Home', selector: 'home'
      p.link 'Profile', url: '#profile', selector: 'profile'
      p.link 'Messages', url: '#messages', selector: 'messages'
    end
    expected = '<nav><ul class="pagination justify-content-end"><li class="active page-item"><a class="page-link" href="#Home">Home</a></li><li class="page-item"><a class="page-link" href="#profile">Profile</a></li><li class="page-item"><a class="page-link" href="#messages">Messages</a></li></ul></nav>'

    assert_equal expected, actual
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
ui_bibz-4.0.0.beta14 test/ui/core/navigations/pagination_test.rb
ui_bibz-4.0.0.beta13 test/ui/core/navigations/pagination_test.rb
ui_bibz-4.0.0.beta10 test/ui/core/navigations/pagination_test.rb
ui_bibz-4.0.0.beta9 test/ui/core/navigations/pagination_test.rb
ui_bibz-4.0.0.beta8 test/ui/core/navigations/pagination_test.rb
ui_bibz-4.0.0.beta7 test/ui/core/navigations/pagination_test.rb
ui_bibz-4.0.0.beta6 test/ui/core/navigations/pagination_test.rb
ui_bibz-4.0.0.beta4 test/ui/core/navigations/pagination_test.rb
ui_bibz-4.0.0.beta3 test/ui/core/navigations/pagination_test.rb
ui_bibz-3.0.13 test/ui/core/navigations/pagination_test.rb
ui_bibz-3.0.12 test/ui/core/navigations/pagination_test.rb
ui_bibz-3.0.11 test/ui/core/navigations/pagination_test.rb
ui_bibz-3.0.10 test/ui/core/navigations/pagination_test.rb
ui_bibz-3.0.9 test/ui/core/navigations/pagination_test.rb
ui_bibz-3.0.8 test/ui/core/navigations/pagination_test.rb
ui_bibz-3.0.7 test/ui/core/navigations/pagination_test.rb
ui_bibz-3.0.6 test/ui/core/navigations/pagination_test.rb
ui_bibz-3.0.5 test/ui/core/navigations/pagination_test.rb
ui_bibz-3.0.4 test/ui/core/navigations/pagination_test.rb
ui_bibz-3.0.3 test/ui/core/navigations/pagination_test.rb