Sha256: 538cf68137af6e3a5e283ce85d972dea8c81b60183b071493e56161fc7539ad6

Contents?: true

Size: 1.8 KB

Versions: 35

Compression:

Stored size: 1.8 KB

Contents

# frozen_string_literal: true

require 'test_helper'
require 'ui_bibz/ui/ux/tables/components/store'
require 'ui_bibz/ui/ux/tables/extensions/paginable'
require 'ui_bibz/ui/ux/tables/extensions/searchable'
require 'ui_bibz/ui/ux/tables/extensions/sortable'
require 'ui_bibz/ui/ux/tables/extensions/actionable'

class TableCardTest < ActionView::TestCase
  setup do
    create_list(:user, 25)
    params = ActionController::Parameters.new({
                                                controller: 'users',
                                                action: 'index',
                                                sort: 'users.name_fr',
                                                direction: 'asc',
                                                search: 'Name fr',
                                                per_page: 2,
                                                page: 1,
                                                only_path: true
                                              })
    @users = User.table_search_pagination(params, session)
    @store = UiBibz::Ui::Ux::Tables::Store.new @users
  end

  test 'table card visual options' do
    table_card = UiBibz::Ui::Ux::Tables::TableCard.new(store: @users, table_options: { striped: true, status: :inverse, responsive: true, bordered: true, size: :sm, hoverable: true, breakpoint: :sm }).render
    actual_table_classes = Nokogiri::HTML(table_card).xpath('//table')[0].attributes['class'].value
    div_classes = Nokogiri::HTML(table_card).xpath('//div').css('.table-responsive-sm')[0].attributes['class'].value
    table_classes = 'table-inverse table table-striped table-bordered table-hoverable table-sm'
    actual_div_classes = 'table-responsive-sm'

    assert_equal table_classes, actual_table_classes
    assert_equal div_classes, actual_div_classes
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
ui_bibz-4.0.0.beta16 test/ui/ux/tables/table_card_test.rb
ui_bibz-4.0.0.beta15 test/ui/ux/tables/table_card_test.rb
ui_bibz-4.0.0.beta14 test/ui/ux/tables/table_card_test.rb
ui_bibz-4.0.0.beta13 test/ui/ux/tables/table_card_test.rb
ui_bibz-4.0.0.beta10 test/ui/ux/tables/table_card_test.rb
ui_bibz-4.0.0.beta9 test/ui/ux/tables/table_card_test.rb
ui_bibz-4.0.0.beta8 test/ui/ux/tables/table_card_test.rb
ui_bibz-4.0.0.beta7 test/ui/ux/tables/table_card_test.rb
ui_bibz-4.0.0.beta6 test/ui/ux/tables/table_card_test.rb
ui_bibz-4.0.0.beta4 test/ui/ux/tables/table_card_test.rb
ui_bibz-4.0.0.beta3 test/ui/ux/tables/table_card_test.rb
ui_bibz-3.0.13 test/ui/ux/tables/table_card_test.rb
ui_bibz-3.0.12 test/ui/ux/tables/table_card_test.rb
ui_bibz-3.0.11 test/ui/ux/tables/table_card_test.rb
ui_bibz-3.0.10 test/ui/ux/tables/table_card_test.rb
ui_bibz-3.0.9 test/ui/ux/tables/table_card_test.rb
ui_bibz-3.0.8 test/ui/ux/tables/table_card_test.rb
ui_bibz-3.0.7 test/ui/ux/tables/table_card_test.rb
ui_bibz-3.0.6 test/ui/ux/tables/table_card_test.rb
ui_bibz-3.0.5 test/ui/ux/tables/table_card_test.rb