require 'test_helper' class CardTest < ActionView::TestCase include UiBibz::Helpers::Ui::CoreHelper test 'create card' do actual = ui_card do 'test' end expected = "
test
" assert_equal expected, actual end test 'card status' do actual = ui_card 'test', status: :primary expected = "
test
" assert_equal expected, actual end test 'card outline' do actual = ui_card 'test', status: :success, outline: true, tap: true do |c| c.header 'header' c.body 'header' c.footer 'header' end expected = "
header
test
header
" assert_equal expected, actual end test 'create card with image, list and body' do actual = ui_card(tap: true) do |c| c.image 'image.svg' c.body do "test" end c.list_group do |lg| lg.list "Cras justo odio" lg.list "Dapibas ac facilisis in" lg.list "vestibulum at eros" end c.body do link_to "Card link", '#', class: "card-link" link_to "Card link", '#', class: "card-link" end end expected = "
test
Card link
" assert_equal expected, actual end test 'create card with header, body and footer' do actual = ui_card tap: true, class: 'state' do |p| p.header 'state', glyph: 'eye' p.body 'state' p.footer 'state' end expected = "
state
state
state
" assert_equal expected, actual end test 'position' do actual = ui_card tap: true, text: { position: :right, size: :md } do |p| p.body tap: true do |b| b.title "Special title treatment" b.text "With supporting text below as a natural lead-in to additional content." b.link "Go somewhere", url: '#go-somewhere', class: 'btn btn-primary' end end expected = "

Special title treatment

With supporting text below as a natural lead-in to additional content.

Go somewhere
" assert_equal expected, actual end test 'create card group' do actual = ui_card_group do |cg| cg.card 'test 1', body: true cg.card 'test 2', body: true cg.card 'test 3', body: true end expected = "
test 1
test 2
test 3
" assert_equal expected, actual end test 'create card deck' do actual = ui_card_deck do |cg| cg.card 'test 1', body: true cg.card 'test 2', body: true cg.card 'test 3', body: true end expected = "
test 1
test 2
test 3
" assert_equal expected, actual end test 'create card column' do actual = ui_card_column do |cg| cg.card 'test 1', body: true cg.card 'test 2', body: true cg.card 'test 3', body: true end expected = "
test 1
test 2
test 3
" assert_equal expected, actual end test 'card list group' do actual = ui_card tap: true do |c| c.list_group do |lg| lg.list "list 1" lg.list "list 2" lg.list "list 3" end end expected = "
" assert_equal expected, actual end test 'card body parameters' do actual = ui_card tap: true do |c| c.body tap: true do |b| b.title "title" b.text "text" b.link 'link', url: '#' end end expected = "

title

text

link
" assert_equal expected, actual end test 'card header tab group' do actual = ui_card tap: true do |c| c.header tap: true do |h| h.tab_group tap: true do |cg| cg.tab 'link1', url: '#link1' cg.tab 'link2', url: '#link2' end end end expected = "
" assert_equal expected, actual end end