ui_bibz 3.0.0.alpha3 → 3.0.0.alpha10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +11 -11
  3. data/README.md +5 -1
  4. data/lib/ui_bibz.rb +0 -1
  5. data/lib/ui_bibz/helpers/ui/core/forms_helper.rb +2 -1
  6. data/lib/ui_bibz/infos.rb +4 -4
  7. data/lib/ui_bibz/inputs/ui_bibz_inputs/ui_checkbox_field_input.rb +5 -1
  8. data/lib/ui_bibz/inputs/ui_bibz_inputs/ui_multi_select_field_input.rb +3 -3
  9. data/lib/ui_bibz/inputs/ui_bibz_inputs/ui_slider_field_input.rb +1 -1
  10. data/lib/ui_bibz/rails/engine.rb +0 -4
  11. data/lib/ui_bibz/ui/concerns/card_itemable_concern.rb +2 -0
  12. data/lib/ui_bibz/ui/concerns/html_concern.rb +3 -3
  13. data/lib/ui_bibz/ui/core/boxes/components/card_body.rb +8 -0
  14. data/lib/ui_bibz/ui/core/boxes/components/card_image.rb +6 -2
  15. data/lib/ui_bibz/ui/core/forms/buttons/button.rb +3 -12
  16. data/lib/ui_bibz/ui/core/forms/buttons/button_link.rb +1 -2
  17. data/lib/ui_bibz/ui/core/forms/buttons/button_refresh.rb +0 -1
  18. data/lib/ui_bibz/ui/core/forms/choices/checkbox_field.rb +13 -4
  19. data/lib/ui_bibz/ui/core/forms/choices/radio_field.rb +7 -1
  20. data/lib/ui_bibz/ui/core/forms/choices/switch_field.rb +4 -0
  21. data/lib/ui_bibz/ui/core/forms/dropdowns/dropdown.rb +13 -9
  22. data/lib/ui_bibz/ui/core/forms/dropdowns/split_dropdown.rb +7 -2
  23. data/lib/ui_bibz/ui/core/forms/numbers/formula_field.rb +2 -0
  24. data/lib/ui_bibz/ui/core/forms/numbers/range_field.rb +19 -1
  25. data/lib/ui_bibz/ui/core/forms/numbers/slider_field.rb +13 -1
  26. data/lib/ui_bibz/ui/core/forms/numbers/slider_header.rb +4 -4
  27. data/lib/ui_bibz/ui/core/forms/selects/dropdown_select_field.rb +41 -59
  28. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button.rb +1 -9
  29. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button_link.rb +1 -9
  30. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_dropdown.rb +5 -4
  31. data/lib/ui_bibz/ui/core/forms/surrounds/surround_field.rb +3 -8
  32. data/lib/ui_bibz/ui/core/icons/glyph.rb +9 -1
  33. data/lib/ui_bibz/ui/core/navigations/components/nav_dropdown.rb +2 -2
  34. data/lib/ui_bibz/ui/core/navigations/components/nav_link_link.rb +2 -2
  35. data/lib/ui_bibz/ui/core/navigations/nav.rb +3 -3
  36. data/lib/ui_bibz/ui/core/navigations/navbar.rb +6 -4
  37. data/lib/ui_bibz/ui/core/navigations/tab_group.rb +5 -1
  38. data/lib/ui_bibz/ui/core/notifications/components/toast_header.rb +15 -1
  39. data/lib/ui_bibz/ui/core/windows/modal.rb +6 -2
  40. data/lib/ui_bibz/ui/extensions/core/component/glyph_extension.rb +11 -24
  41. data/lib/ui_bibz/ui/extensions/core/component/popover_extension.rb +1 -1
  42. data/lib/ui_bibz/ui/extensions/core/forms/surround_extension.rb +1 -1
  43. data/lib/ui_bibz/ui/ux/containers/components/panel_header.rb +3 -2
  44. data/lib/ui_bibz/ui/ux/containers/components/panel_header_title.rb +47 -0
  45. data/lib/ui_bibz/ui/ux/tables/table_pagination_per_page.rb +3 -3
  46. data/lib/ui_bibz/ui/ux/tables/table_search_field.rb +4 -4
  47. data/lib/ui_bibz/utils/breakdown_class_name_generator.rb +20 -7
  48. data/lib/ui_bibz/utils/internationalization.rb +1 -1
  49. data/test/simple_form_test.rb +6 -28
  50. data/test/ui/core/boxes/card_test.rb +2 -2
  51. data/test/ui/core/component_test.rb +2 -2
  52. data/test/ui/core/forms/buttons/button_group_test.rb +2 -2
  53. data/test/ui/core/forms/buttons/button_link_test.rb +1 -8
  54. data/test/ui/core/forms/buttons/button_refresh_test.rb +1 -1
  55. data/test/ui/core/forms/buttons/button_test.rb +2 -9
  56. data/test/ui/core/forms/choices/checkbox_field_test.rb +8 -1
  57. data/test/ui/core/forms/choices/choice_group_test.rb +3 -3
  58. data/test/ui/core/forms/choices/radio_field_test.rb +1 -1
  59. data/test/ui/core/forms/dropdowns/dropdown_test.rb +2 -2
  60. data/test/ui/core/forms/numbers/range_field_test.rb +14 -0
  61. data/test/ui/core/forms/numbers/slider_field_test.rb +2 -2
  62. data/test/ui/core/forms/selects/multi_select_field_test.rb +6 -6
  63. data/test/ui/core/forms/selects/select_field_test.rb +1 -1
  64. data/test/ui/core/forms/surrounds/surround_field_test.rb +27 -3
  65. data/test/ui/core/forms/texts/auto_complete_field_test.rb +2 -2
  66. data/test/ui/core/navigations/breadcrumb_test.rb +1 -1
  67. data/test/ui/core/navigations/link_test.rb +1 -1
  68. data/test/ui/core/navigations/nav_test.rb +7 -6
  69. data/test/ui/core/navigations/navbar_test.rb +5 -6
  70. data/test/ui/core/navigations/tab_group_test.rb +5 -5
  71. data/test/ui/core/notifications/alert_test.rb +1 -1
  72. data/test/ui/core/notifications/badge_test.rb +2 -2
  73. data/test/ui/utils/breakdown_class_name_generator_test.rb +14 -0
  74. data/test/ui/ux/containers/panel_test.rb +1 -1
  75. data/test/ui/ux/tables/table_test.rb +2 -2
  76. data/ui_bibz.gemspec +1 -1
  77. metadata +7 -10
  78. data/lib/ui_bibz/ui/core/forms/selects/multi_select_field.rb +0 -122
  79. data/package.json +0 -5
  80. data/test/ui/core/forms/selects/dropdown_select_field_test.rb +0 -84
@@ -5,7 +5,7 @@ require 'test_helper'
5
5
  class ComponentTest < ActionView::TestCase
6
6
  test 'create complex component' do
7
7
  actual = UiBibz::Ui::Core::Component.new('New component', { state: :active, glyph: 'add' }, { class: 'new-class' }).render
8
- expected = '<i class="glyph fas fa-add"></i> New component'
8
+ expected = "<i class=\"glyph fas fa-add\"></i> New component"
9
9
 
10
10
  assert_equal expected, actual
11
11
  end
@@ -21,7 +21,7 @@ class ComponentTest < ActionView::TestCase
21
21
 
22
22
  test 'create component without text and glyph' do
23
23
  actual = UiBibz::Ui::Core::Component.new('My text', { glyph: 'diamond', text: false }).render
24
- expected = '<i class="glyph fas fa-diamond"></i><span class="empty-space"> </span>'
24
+ expected = "<i class=\"glyph fas fa-diamond\"></i> <span class=\"visually-hidden\">My text</span>"
25
25
 
26
26
  assert_equal expected, actual
27
27
  end
@@ -43,11 +43,11 @@ class ButtonGroupTest < ActionView::TestCase
43
43
 
44
44
  test 'button group with dropdown' do
45
45
  actual = ui_button_group do |bg|
46
- bg.dropdown('Dropdown', { type: :dropup, status: :success }, { id: 'dropdown-test' }) do |d|
46
+ bg.dropdown('Dropdown', { position: :up, status: :success }, { id: 'dropdown-test' }) do |d|
47
47
  d.link 'Link 1', url: '#link1', glyph: 'eye'
48
48
  end
49
49
  end
50
- expected = '<div class="btn-group" role="group"><div id="dropdown-test" class="dropup btn-group"><button class="btn btn-success dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" id="dropdown-test">Dropdown</button><div class="dropdown-menu" arial-labelledby="dropdown-test"><a class="dropdown-item" href="#link1"><i class="glyph fas fa-eye"></i> Link 1</a></div></div></div>'
50
+ expected = "<div class=\"btn-group\" role=\"group\"><div id=\"dropdown-test\" class=\"dropup btn-group\"><button class=\"btn btn-success dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\" id=\"dropdown-test\">Dropdown</button><div class=\"dropdown-menu\" arial-labelledby=\"dropdown-test\"><a class=\"dropdown-item\" href=\"#link1\"><i class=\"glyph fas fa-eye\"></i> Link 1</a></div></div></div>"
51
51
 
52
52
  assert_equal expected, actual
53
53
  end
@@ -54,13 +54,6 @@ class ButtonLinkTest < ActionView::TestCase
54
54
  assert_equal expected, actual
55
55
  end
56
56
 
57
- test 'button_link block' do
58
- actual = ui_button_link('state', type: :block)
59
- expected = '<a class="btn-secondary btn btn-block" role="button" href="#">state</a>'
60
-
61
- assert_equal expected, actual
62
- end
63
-
64
57
  test 'button_link size' do
65
58
  actual = ui_button_link('state', size: :sm)
66
59
  expected = '<a class="btn-secondary btn btn-sm" role="button" href="#">state</a>'
@@ -77,7 +70,7 @@ class ButtonLinkTest < ActionView::TestCase
77
70
 
78
71
  test 'button_link glyph' do
79
72
  actual = ui_button_link('state', glyph: 'diamond')
80
- expected = '<a class="btn-secondary btn" role="button" href="#"><i class="glyph fas fa-diamond"></i> state</a>'
73
+ expected = '<a class="btn-secondary btn" role="button" href="#"><i class="glyph fas fa-diamond"></i> state</a>'
81
74
 
82
75
  assert_equal expected, actual
83
76
  end
@@ -5,7 +5,7 @@ require 'test_helper'
5
5
  class ButtonRefreshTest < ActionView::TestCase
6
6
  test 'button' do
7
7
  actual = UiBibz::Ui::Core::Forms::Buttons::ButtonRefresh.new('state', status: :success, connect: { target: { url: '/' } }).render
8
- expected = '<span data-connect="{&quot;events&quot;:&quot;click&quot;,&quot;mode&quot;:&quot;remote&quot;,&quot;target&quot;:{&quot;selector&quot;:&quot;&quot;,&quot;url&quot;:&quot;/&quot;,&quot;data&quot;:[]}}" class="btn-success ui-bibz-connect btn input-refresh-button"><i class="glyph fas fa-sync-alt"></i> state</span>'
8
+ expected = "<span data-connect=\"{&quot;events&quot;:&quot;click&quot;,&quot;mode&quot;:&quot;remote&quot;,&quot;target&quot;:{&quot;selector&quot;:&quot;&quot;,&quot;url&quot;:&quot;/&quot;,&quot;data&quot;:[]}}\" class=\"btn-success ui-bibz-connect btn input-refresh-button\"><i class=\"glyph fas fa-sync-alt\"></i> state</span>"
9
9
 
10
10
  assert_equal expected, actual
11
11
  end
@@ -47,13 +47,6 @@ class ButtonTest < ActionView::TestCase
47
47
  assert_equal expected, actual
48
48
  end
49
49
 
50
- test 'button block' do
51
- actual = ui_button('state', type: :block)
52
- expected = '<button class="btn-secondary btn btn-block">state</button>'
53
-
54
- assert_equal expected, actual
55
- end
56
-
57
50
  test 'button size' do
58
51
  actual = ui_button('state', size: :sm)
59
52
  expected = '<button class="btn-secondary btn btn-sm">state</button>'
@@ -70,14 +63,14 @@ class ButtonTest < ActionView::TestCase
70
63
 
71
64
  test 'button glyph' do
72
65
  actual = ui_button('state', glyph: 'diamond')
73
- expected = '<button class="btn-secondary btn"><i class="glyph fas fa-diamond"></i> state</button>'
66
+ expected = "<button class=\"btn-secondary btn\"><i class=\"glyph fas fa-diamond\"></i> state</button>"
74
67
 
75
68
  assert_equal expected, actual
76
69
  end
77
70
 
78
71
  test 'button glyph without text' do
79
72
  actual = ui_button('state', glyph: 'diamond', text: false)
80
- expected = '<button class="btn-secondary btn without-text"><i class="glyph fas fa-diamond"></i><span class="empty-space"> </span></button>'
73
+ expected = "<button class=\"btn-secondary btn\"><i class=\"glyph fas fa-diamond\"></i> <span class=\"visually-hidden\">state</span></button>"
81
74
 
82
75
  assert_equal expected, actual
83
76
  end
@@ -4,7 +4,14 @@ require 'test_helper'
4
4
 
5
5
  class CheckboxFieldTest < ActionView::TestCase
6
6
  test 'checkbox_field' do
7
- actual = UiBibz::Ui::Core::Forms::Choices::CheckboxField.new('John', { value: 1 }).render
7
+ actual = UiBibz::Ui::Core::Forms::Choices::CheckboxField.new('John', { value: 1, status: :primary }).render
8
+ expected = "<div class=\"form-check\"><input type=\"checkbox\" name=\"John\" id=\"John\" value=\"1\" class=\"form-check-input form-check-input-primary\" /><label class=\"form-check-label\" for=\"John\">John</label></div>"
9
+
10
+ assert_equal expected, actual
11
+ end
12
+
13
+ test 'checkbox_field which is a boolean' do
14
+ actual = UiBibz::Ui::Core::Forms::Choices::CheckboxField.new('John', { boolean: true, value: 1 }).render
8
15
  expected = "<div class=\"form-check\"><input type=\"hidden\" name=\"John\" id=\"John-hidden\" value=\"0\" /><input type=\"checkbox\" name=\"John\" id=\"John\" value=\"1\" class=\"form-check-input\" /><label class=\"form-check-label\" for=\"John\">John</label></div>"
9
16
 
10
17
  assert_equal expected, actual
@@ -11,7 +11,7 @@ class ChoiceGroupTest < ActionView::TestCase
11
11
  bc.choice 'Checkbox 2', state: :active
12
12
  end
13
13
 
14
- expected = "<div data-toggle=\"buttons\" class=\"btn-group button-choice btn-group-toggle\"><input type=\"checkbox\" autocomplete=\"off\" class=\"btn-check\" id=\"#{actual.items.first.input_options[:id]}\" /><label class=\"btn-secondary btn checkbox\" for=\"#{actual.items.first.input_options[:id]}\">Checkbox 1</label><input type=\"checkbox\" autocomplete=\"off\" class=\"btn-check\" checked=\"checked\" id=\"#{actual.items.last.input_options[:id]}\" /><label class=\"active btn-secondary btn checkbox\" aria-pressed=\"true\" for=\"#{actual.items.last.input_options[:id]}\">Checkbox 2</label></div>"
14
+ expected = "<div data-toggle=\"buttons\" class=\"btn-group button-choice btn-group-toggle\"><input type=\"checkbox\" autocomplete=\"off\" class=\"btn-check\" id=\"#{actual.items.first.input_options[:id]}\" /><label class=\"btn-secondary btn\" for=\"#{actual.items.first.input_options[:id]}\">Checkbox 1</label><input type=\"checkbox\" autocomplete=\"off\" class=\"btn-check\" checked=\"checked\" id=\"#{actual.items.last.input_options[:id]}\" /><label class=\"active btn-secondary btn\" aria-pressed=\"true\" for=\"#{actual.items.last.input_options[:id]}\">Checkbox 2</label></div>"
15
15
 
16
16
  assert_equal expected, actual.render
17
17
  end
@@ -22,7 +22,7 @@ class ChoiceGroupTest < ActionView::TestCase
22
22
  bc.choice 'Radio 2', state: :active
23
23
  end
24
24
 
25
- expected = "<div data-toggle=\"buttons\" class=\"btn-group button-choice btn-group-toggle\"><input type=\"radio\" autocomplete=\"off\" class=\"btn-check\" name=\"#{actual.items.first.input_options[:name]}\" id=\"#{actual.items.first.input_options[:id]}\" /><label class=\"btn-secondary btn radio\" for=\"#{actual.items.first.input_options[:id]}\">Radio 1</label><input type=\"radio\" autocomplete=\"off\" class=\"btn-check\" checked=\"checked\" name=\"#{actual.items.last.input_options[:name]}\" id=\"#{actual.items.last.input_options[:id]}\" /><label class=\"active btn-secondary btn radio\" aria-pressed=\"true\" for=\"#{actual.items.last.input_options[:id]}\">Radio 2</label></div>"
25
+ expected = "<div data-toggle=\"buttons\" class=\"btn-group button-choice btn-group-toggle\"><input type=\"radio\" autocomplete=\"off\" class=\"btn-check\" name=\"#{actual.items.first.input_options[:name]}\" id=\"#{actual.items.first.input_options[:id]}\" /><label class=\"btn-secondary btn\" for=\"#{actual.items.first.input_options[:id]}\">Radio 1</label><input type=\"radio\" autocomplete=\"off\" class=\"btn-check\" checked=\"checked\" name=\"#{actual.items.last.input_options[:name]}\" id=\"#{actual.items.last.input_options[:id]}\" /><label class=\"active btn-secondary btn\" aria-pressed=\"true\" for=\"#{actual.items.last.input_options[:id]}\">Radio 2</label></div>"
26
26
 
27
27
  assert_equal expected, actual.render
28
28
  end
@@ -32,7 +32,7 @@ class ChoiceGroupTest < ActionView::TestCase
32
32
  bc.choice 'Radio 1', glyph: 'diamond', status: :primary
33
33
  bc.choice 'Radio 2', state: :active
34
34
  end
35
- expected = "<div data-toggle=\"buttons\" class=\"btn-group btn-group-lg button-choice btn-group-toggle\"><input type=\"radio\" autocomplete=\"off\" class=\"btn-check\" name=\"#{actual.items.first.input_options[:name]}\" id=\"#{actual.items.first.input_options[:id]}\" /><label class=\"btn-outline-primary btn btn-lg radio\" for=\"#{actual.items.first.input_options[:id]}\"><i class=\"glyph fas fa-diamond\"></i> Radio 1</label><input type=\"radio\" autocomplete=\"off\" class=\"btn-check\" checked=\"checked\" name=\"#{actual.items.last.input_options[:name]}\" id=\"#{actual.items.last.input_options[:id]}\" /><label class=\"active btn-outline-secondary btn btn-lg radio\" aria-pressed=\"true\" for=\"#{actual.items.last.input_options[:id]}\">Radio 2</label></div>"
35
+ expected = "<div data-toggle=\"buttons\" class=\"btn-group btn-group-lg button-choice btn-group-toggle\"><input type=\"radio\" autocomplete=\"off\" class=\"btn-check\" name=\"#{actual.items.first.input_options[:name]}\" id=\"#{actual.items.first.input_options[:id]}\" /><label class=\"btn-outline-primary btn btn-lg\" for=\"#{actual.items.first.input_options[:id]}\"><i class=\"glyph fas fa-diamond\"></i> Radio 1</label><input type=\"radio\" autocomplete=\"off\" class=\"btn-check\" checked=\"checked\" name=\"#{actual.items.last.input_options[:name]}\" id=\"#{actual.items.last.input_options[:id]}\" /><label class=\"active btn-outline-secondary btn btn-lg\" aria-pressed=\"true\" for=\"#{actual.items.last.input_options[:id]}\">Radio 2</label></div>"
36
36
 
37
37
  assert_equal expected, actual.render
38
38
  end
@@ -5,7 +5,7 @@ require 'test_helper'
5
5
  class RadioFieldTest < ActionView::TestCase
6
6
  test 'radio_field' do
7
7
  actual = UiBibz::Ui::Core::Forms::Choices::RadioField.new('John', { value: 1, status: :primary, type: :square }).render
8
- expected = "<div class=\"form-check\"><input type=\"radio\" name=\"John\" id=\"John_1\" value=\"1\" class=\"form-check-input\" /><label class=\"form-check-label\" for=\"John_1\">John</label></div>"
8
+ expected = "<div class=\"form-check\"><input type=\"radio\" name=\"John\" id=\"John_1\" value=\"1\" class=\"form-check-input form-check-input-primary\" /><label class=\"form-check-label\" for=\"John_1\">John</label></div>"
9
9
 
10
10
  assert_equal expected, actual
11
11
  end
@@ -32,14 +32,14 @@ class DropdownTest < ActionView::TestCase
32
32
  end
33
33
 
34
34
  test 'Dropdown options' do
35
- actual = UiBibz::Ui::Core::Forms::Dropdowns::Dropdown.new('Dropdown', type: :dropup, status: :success, glyph: 'diamond').tap do |d|
35
+ actual = UiBibz::Ui::Core::Forms::Dropdowns::Dropdown.new('Dropdown', position: :up, alignment: :right, status: :success, glyph: 'diamond').tap do |d|
36
36
  d.link 'Link 1', url: '#link1', glyph: 'eye'
37
37
  d.header 'header'
38
38
  d.link 'Link 2', url: '#link2'
39
39
  d.divider
40
40
  d.link 'Link3', url: '#link3'
41
41
  end
42
- expected = "<div class=\"dropup\"><button class=\"btn btn-success dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\" id=\"#{actual.id}\"><i class=\"glyph fas fa-diamond\"></i> Dropdown</button><div class=\"dropdown-menu\" arial-labelledby=\"#{actual.id}\"><a class=\"dropdown-item\" href=\"#link1\"><i class=\"glyph fas fa-eye\"></i> Link 1</a><h6 class=\"dropdown-header\" role=\"presentation\">header</h6><a class=\"dropdown-item\" href=\"#link2\">Link 2</a><div class=\"dropdown-divider\"></div><a class=\"dropdown-item\" href=\"#link3\">Link3</a></div></div>"
42
+ expected = "<div class=\"dropup btn-group\"><button class=\"btn btn-success dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\" id=\"#{actual.id}\"><i class=\"glyph fas fa-diamond\"></i> Dropdown</button><div class=\"dropdown-menu dropdown-menu-right\" arial-labelledby=\"#{actual.id}\"><a class=\"dropdown-item\" href=\"#link1\"><i class=\"glyph fas fa-eye\"></i> Link 1</a><h6 class=\"dropdown-header\" role=\"presentation\">header</h6><a class=\"dropdown-item\" href=\"#link2\">Link 2</a><div class=\"dropdown-divider\"></div><a class=\"dropdown-item\" href=\"#link3\">Link3</a></div></div>"
43
43
 
44
44
  assert_equal expected, actual.render
45
45
  end
@@ -37,4 +37,18 @@ class RangeFieldTest < ActionView::TestCase
37
37
 
38
38
  assert_equal expected, actual.render
39
39
  end
40
+
41
+ test "range status" do
42
+ actual = UiBibz::Ui::Core::Forms::Numbers::RangeField.new('myrange', value: 2, max: 3, status: :sucesss).render
43
+ expected = "<input type=\"range\" name=\"myrange\" id=\"myrange\" value=\"2\" class=\"form-range-sucesss form-range\" max=\"3\" />"
44
+
45
+ assert_equal expected, actual
46
+ end
47
+
48
+ test "range thumb and track status" do
49
+ actual = UiBibz::Ui::Core::Forms::Numbers::RangeField.new('myrange', value: 2, max: 3, thumb_status: :sucesss, track_status: :dark).render
50
+ expected = "<input type=\"range\" name=\"myrange\" id=\"myrange\" value=\"2\" class=\"form-range form-range-thumb-sucesss form-range-track-dark\" max=\"3\" />"
51
+
52
+ assert_equal expected, actual
53
+ end
40
54
  end
@@ -11,8 +11,8 @@ class SliderFieldTest < ActionView::TestCase
11
11
  end
12
12
 
13
13
  test 'slider field with options' do
14
- actual = UiBibz::Ui::Core::Forms::Numbers::SliderField.new('myrange', thumb_max: 2, thumb_min: -7, min: -9, max: 6, step: 2, input_name_max: "price_max", input_name_min: "price_min").render
15
- expected = "<div class=\"slider\" min=\"-9\" max=\"6\" step=\"2\"><div><div class=\"slider-inverse-left\" style=\"width: 100%\"></div><div class=\"slider-inverse-right\" style=\"width: 100%\"></div><div class=\"slider-range\" style=\"left: 13%; right: 26%\"></div><div class=\"slider-thumb slider-thumb-left\" style=\"left: 13%\"></div><div class=\"slider-thumb slider-thumb-right\" style=\"left: 74%\"></div></div><input type=\"range\" name=\"price_min\" id=\"price_min\" value=\"-7\" max=\"6\" min=\"-9\" step=\"2\" /><input type=\"range\" name=\"price_max\" id=\"price_max\" value=\"2\" max=\"6\" min=\"-9\" step=\"2\" /></div>"
14
+ actual = UiBibz::Ui::Core::Forms::Numbers::SliderField.new('myrange', status: :secondary, track_status: :dark, thumb_max: 2, thumb_min: -7, min: -9, max: 6, step: 2, input_name_max: "price_max", input_name_min: "price_min").render
15
+ expected = "<div class=\"slider-secondary slider slider-track-dark\" min=\"-9\" max=\"6\" step=\"2\"><div><div class=\"slider-inverse-left\" style=\"width: 100%\"></div><div class=\"slider-inverse-right\" style=\"width: 100%\"></div><div class=\"slider-range\" style=\"left: 13%; right: 26%\"></div><div class=\"slider-thumb slider-thumb-left\" style=\"left: 13%\"></div><div class=\"slider-thumb slider-thumb-right\" style=\"left: 74%\"></div></div><input type=\"range\" name=\"price_min\" id=\"price_min\" value=\"-7\" max=\"6\" min=\"-9\" step=\"2\" /><input type=\"range\" name=\"price_max\" id=\"price_max\" value=\"2\" max=\"6\" min=\"-9\" step=\"2\" /></div>"
16
16
 
17
17
  assert_equal expected, actual
18
18
  end
@@ -2,10 +2,10 @@
2
2
 
3
3
  require 'test_helper'
4
4
 
5
- class MultiSelectFieldTest < ActionView::TestCase
5
+ class DropdownSelectFieldTest < ActionView::TestCase
6
6
  test 'Multi Select Field' do
7
7
  options = options_for_select(Array.new(2) { |i| "option #{i}" })
8
- actual = UiBibz::Ui::Core::Forms::Selects::MultiSelectField.new('example', option_tags: options).render
8
+ actual = UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new('example', multiple: true, option_tags: options).render
9
9
  expected = "<select name=\"example[]\" id=\"example\" class=\"btn-secondary multi-select-field\" multiple=\"multiple\"><option value=\"option 0\">option 0</option>
10
10
  <option value=\"option 1\">option 1</option></select>"
11
11
 
@@ -14,8 +14,8 @@ class MultiSelectFieldTest < ActionView::TestCase
14
14
 
15
15
  test 'Multi Select Field data html options' do
16
16
  grouped_options = { 'North America' => [['United statuss', 'US'], 'Canada'], 'Europe' => %w[Denmark Germany France] }
17
- actual = UiBibz::Ui::Core::Forms::Selects::MultiSelectField.new('example', { option_tags: grouped_options_for_select(grouped_options), clickable_opt_group: true, collapsible_opt_group: true, searchable: true, select_all_options: true, number_displayed: 2, status: :danger }).render
18
- expected = "<select name=\"example[]\" id=\"example\" data-enable-clickable-opt-groups=\"true\" data-enable-collapsible-opt-groups=\"true\" data-enable-filtering=\"true\" data-include-select-all-option=\"true\" data-number-displayed=\"true\" class=\"btn-danger btn-secondary multi-select-field\" multiple=\"multiple\"><optgroup label=\"North America\"><option value=\"US\">United statuss</option>
17
+ actual = UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new('example', { multiple: true, option_tags: grouped_options_for_select(grouped_options), clickable_opt_group: true, collapsible_opt_group: true, searchable: true, select_all_options: true, number_displayed: 2, status: :danger }).render
18
+ expected = "<select name=\"example[]\" id=\"example\" data-enable-clickable-opt-groups=\"true\" data-enable-collapsible-opt-groups=\"true\" data-enable-filtering=\"true\" data-include-select-all-option=\"true\" data-number-displayed=\"true\" class=\"btn-danger multi-select-field\" multiple=\"multiple\"><optgroup label=\"North America\"><option value=\"US\">United statuss</option>
19
19
  <option value=\"Canada\">Canada</option></optgroup><optgroup label=\"Europe\"><option value=\"Denmark\">Denmark</option>
20
20
  <option value=\"Germany\">Germany</option>
21
21
  <option value=\"France\">France</option></optgroup></select>"
@@ -24,8 +24,8 @@ class MultiSelectFieldTest < ActionView::TestCase
24
24
  end
25
25
 
26
26
  test 'Multi select Field refresh option' do
27
- actual = UiBibz::Ui::Core::Forms::Selects::MultiSelectField.new('test', { refresh: { target: { url: '/' } } }).render
28
- expected = '<div class="field-refresh input-group ui_surround_field"><select name="test[]" id="test" class="btn-secondary multi-select-field" multiple="multiple"></select><span data-connect="{&quot;events&quot;:&quot;click&quot;,&quot;mode&quot;:&quot;remote&quot;,&quot;target&quot;:{&quot;selector&quot;:&quot;#test&quot;,&quot;url&quot;:&quot;/&quot;,&quot;data&quot;:[]}}" class="btn-secondary ui-bibz-connect btn input-refresh-button"><i class="glyph fas fa-sync-alt"></i> </span></div>'
27
+ actual = UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new('test', { multiple: true, refresh: { target: { url: '/' } } }).render
28
+ expected = '<div class="field-refresh input-group ui_surround_field"><select name="test[]" id="test" class="btn-secondary multi-select-field" multiple="multiple"></select><span data-connect="{&quot;events&quot;:&quot;click&quot;,&quot;mode&quot;:&quot;remote&quot;,&quot;target&quot;:{&quot;selector&quot;:&quot;#test&quot;,&quot;url&quot;:&quot;/&quot;,&quot;data&quot;:[]}}" class="btn-secondary ui-bibz-connect btn input-refresh-button"><i class="glyph fas fa-sync-alt"></i></span></div>'
29
29
 
30
30
  assert_equal expected, actual
31
31
  end
@@ -14,7 +14,7 @@ class SelectFieldTest < ActionView::TestCase
14
14
 
15
15
  test 'Select Field refresh' do
16
16
  actual = UiBibz::Ui::Core::Forms::Selects::SelectField.new('example', refresh: { target: { url: '/' } }).render
17
- expected = '<div class="field-refresh input-group ui_surround_field"><select name="example" id="example" class="select-field form-control form-select"></select><span data-connect="{&quot;events&quot;:&quot;click&quot;,&quot;mode&quot;:&quot;remote&quot;,&quot;target&quot;:{&quot;selector&quot;:&quot;#example&quot;,&quot;url&quot;:&quot;/&quot;,&quot;data&quot;:[]}}" class="btn-secondary ui-bibz-connect btn input-refresh-button"><i class="glyph fas fa-sync-alt"></i> </span></div>'
17
+ expected = "<div class=\"field-refresh input-group ui_surround_field\"><select name=\"example\" id=\"example\" class=\"select-field form-control form-select\"></select><span data-connect=\"{&quot;events&quot;:&quot;click&quot;,&quot;mode&quot;:&quot;remote&quot;,&quot;target&quot;:{&quot;selector&quot;:&quot;#example&quot;,&quot;url&quot;:&quot;/&quot;,&quot;data&quot;:[]}}\" class=\"btn-secondary ui-bibz-connect btn input-refresh-button\"><i class=\"glyph fas fa-sync-alt\"></i></span></div>"
18
18
 
19
19
  assert_equal expected, actual
20
20
  end
@@ -31,7 +31,7 @@ class SurroundFieldTest < ActionView::TestCase
31
31
  d.link 'Link3', url: '#link3'
32
32
  end
33
33
  end.render
34
- expected = '<div class="input-group ui_surround_field"><div id="dropdown-test" class="dropdown input-group-btn"><button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" id="dropdown-test">Dropdown</button><div class="dropdown-menu" arial-labelledby="dropdown-test"><a class="dropdown-item" href="#link1"><i class="glyph fas fa-eye"></i> Link 1</a><h6 class="dropdown-header" role="presentation">header</h6><a class="dropdown-item" href="#link2">Link 2</a><div class="dropdown-divider"></div><a class="dropdown-item" href="#link3">Link3</a></div></div></div>'
34
+ expected = "<div class=\"input-group ui_surround_field\"><button class=\"btn btn-secondary dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\" id=\"dropdown-test\">Dropdown</button><div class=\"dropdown-menu\" arial-labelledby=\"dropdown-test\"><a class=\"dropdown-item\" href=\"#link1\"><i class=\"glyph fas fa-eye\"></i> Link 1</a><h6 class=\"dropdown-header\" role=\"presentation\">header</h6><a class=\"dropdown-item\" href=\"#link2\">Link 2</a><div class=\"dropdown-divider\"></div><a class=\"dropdown-item\" href=\"#link3\">Link3</a></div></div>"
35
35
 
36
36
  assert_equal expected, actual
37
37
  end
@@ -40,7 +40,7 @@ class SurroundFieldTest < ActionView::TestCase
40
40
  actual = UiBibz::Ui::Core::Forms::Surrounds::SurroundField.new.tap do |sf|
41
41
  sf.button 'Submit'
42
42
  end.render
43
- expected = '<div class="input-group ui_surround_field"><div class="input-group-btn"><button class="btn-secondary btn">Submit</button></div></div>'
43
+ expected = "<div class=\"input-group ui_surround_field\"><button class=\"btn-secondary btn\">Submit</button></div>"
44
44
 
45
45
  assert_equal expected, actual
46
46
  end
@@ -51,7 +51,7 @@ class SurroundFieldTest < ActionView::TestCase
51
51
  sf.addon '€'
52
52
  sf.glyph 'pencil'
53
53
  end.render
54
- expected = '<div class="input-group ui_surround_field"><div class="input-group-btn"><button class="btn-secondary btn">Submit</button></div><span class="input-group-text">€</span><span class="input-group-text"><i class="glyph fas fa-pencil"></i></span></div>'
54
+ expected = "<div class=\"input-group ui_surround_field\"><button class=\"btn-secondary btn\">Submit</button><span class=\"input-group-text\">€</span><span class=\"input-group-text\"><i class=\"glyph fas fa-pencil\"></i></span></div>"
55
55
 
56
56
  assert_equal expected, actual
57
57
  end
@@ -67,4 +67,28 @@ class SurroundFieldTest < ActionView::TestCase
67
67
 
68
68
  assert_equal expected, actual
69
69
  end
70
+
71
+ test "surround with all fields" do
72
+ actual = UiBibz::Ui::Core::Forms::Surrounds::SurroundField.new.tap do |sf|
73
+ sf.glyph 'gem'
74
+ sf.addon "test"
75
+ sf.button "button"
76
+ sf.button_group do |bg|
77
+ bg.button "test"
78
+ end
79
+ sf.button_link "link", url: "#"
80
+ sf.checkbox_field :check
81
+ sf.radio_field :radio
82
+ sf.text_field :text
83
+ sf.date_picker_field :date
84
+ sf.dropdown_select_field :dropdown_select
85
+ sf.select_field :select
86
+ sf.auto_complete_field :auto
87
+ sf.button_refresh
88
+ end.render
89
+
90
+ expected = "<div class=\"input-group ui_surround_field\"><span class=\"input-group-text\"><i class=\"glyph fas fa-gem\"></i></span><span class=\"input-group-text\">test</span><button class=\"btn-secondary btn\">button</button><div class=\"input-group-btn\" role=\"group\"><button class=\"btn-secondary btn\">test</button></div><a class=\"btn-secondary btn\" role=\"button\" href=\"#\">link</a><div class=\"input-group-text\" label=\"false\"><input type=\"checkbox\" name=\"check\" id=\"check\" value=\"1\" class=\"form-check-input\" /><label class=\"form-check-label\" for=\"check\">check</label></div><div class=\"input-group-text\" label=\"false\"><input type=\"radio\" name=\"radio\" id=\"radio_\" class=\"form-check-input\" /><label class=\"form-check-label\" for=\"radio_\">radio</label></div><input type=\"text\" name=\"text\" id=\"text\" class=\"form-control\" /><input type=\"text\" name=\"date\" id=\"date\" data-date-locale=\"en\" data-provide=\"datepicker\" data-date-format=\"yyyy-mm-dd\" data-date-today-btn=\"linked\" data-date-toggle-active=\"true\" class=\"date_picker form-control\" /><select name=\"dropdown_select\" id=\"dropdown_select\" data-wrapper-classes=\"input-group-btn\" class=\"btn-secondary multi-select-field\"></select><select name=\"select\" id=\"select\" class=\"select-field form-control form-select\"></select><input type=\"text\" name=\"auto\" id=\"auto\" class=\"form-control auto-complete-field\" autocomplete=\"true\" list=\"auto-datalist\" /><datalist id=\"auto-datalist\"></datalist><span data-connect=\"{&quot;events&quot;:&quot;click&quot;,&quot;mode&quot;:&quot;remote&quot;,&quot;target&quot;:{&quot;selector&quot;:&quot;&quot;,&quot;url&quot;:&quot;&quot;,&quot;data&quot;:[]}}\" class=\"btn-secondary ui-bibz-connect btn input-refresh-button\"><i class=\"glyph fas fa-sync-alt\"></i></span></div>"
91
+
92
+ assert_equal expected, actual
93
+ end
70
94
  end
@@ -16,7 +16,7 @@ class AutoCompleteFieldTest < ActionView::TestCase
16
16
  options = options_for_select(Array.new(2) { |i| "option #{i}" })
17
17
  actual = UiBibz::Ui::Core::Forms::Texts::AutoCompleteField.new('test', { option_tags: options, refresh: { target: { url: '/' } } }, { id: 'test' }).render
18
18
  expected = "<div class=\"field-refresh input-group ui_surround_field\"><input type=\"text\" name=\"test\" id=\"test\" class=\"form-control auto-complete-field\" autocomplete=\"true\" list=\"test-datalist\" /><datalist id=\"test-datalist\"><option value=\"option 0\">option 0</option>
19
- <option value=\"option 1\">option 1</option></datalist><span data-connect=\"{&quot;events&quot;:&quot;click&quot;,&quot;mode&quot;:&quot;remote&quot;,&quot;target&quot;:{&quot;selector&quot;:&quot;#test-datalist&quot;,&quot;url&quot;:&quot;/&quot;,&quot;data&quot;:[]}}\" class=\"btn-secondary ui-bibz-connect btn input-refresh-button\"><i class=\"glyph fas fa-sync-alt\"></i> </span></div>"
19
+ <option value=\"option 1\">option 1</option></datalist><span data-connect=\"{&quot;events&quot;:&quot;click&quot;,&quot;mode&quot;:&quot;remote&quot;,&quot;target&quot;:{&quot;selector&quot;:&quot;#test-datalist&quot;,&quot;url&quot;:&quot;/&quot;,&quot;data&quot;:[]}}\" class=\"btn-secondary ui-bibz-connect btn input-refresh-button\"><i class=\"glyph fas fa-sync-alt\"></i></span></div>"
20
20
 
21
21
  assert_equal expected, actual
22
22
  end
@@ -25,7 +25,7 @@ class AutoCompleteFieldTest < ActionView::TestCase
25
25
  options = options_for_select(Array.new(2) { |i| "option #{i}" })
26
26
  actual = UiBibz::Ui::Core::Forms::Texts::AutoCompleteField.new('test', { option_tags: options, append: 'Append content', refresh: { target: { url: '/' } } }, { id: 'test' }).render
27
27
  expected = "<div class=\"field-refresh input-group ui_surround_field\"><span class=\"input-group-text\">Append content</span><input type=\"text\" name=\"test\" id=\"test\" class=\"form-control auto-complete-field\" autocomplete=\"true\" list=\"test-datalist\" /><datalist id=\"test-datalist\"><option value=\"option 0\">option 0</option>
28
- <option value=\"option 1\">option 1</option></datalist><span data-connect=\"{&quot;events&quot;:&quot;click&quot;,&quot;mode&quot;:&quot;remote&quot;,&quot;target&quot;:{&quot;selector&quot;:&quot;#test-datalist&quot;,&quot;url&quot;:&quot;/&quot;,&quot;data&quot;:[]}}\" class=\"btn-secondary ui-bibz-connect btn input-refresh-button\"><i class=\"glyph fas fa-sync-alt\"></i> </span></div>"
28
+ <option value=\"option 1\">option 1</option></datalist><span data-connect=\"{&quot;events&quot;:&quot;click&quot;,&quot;mode&quot;:&quot;remote&quot;,&quot;target&quot;:{&quot;selector&quot;:&quot;#test-datalist&quot;,&quot;url&quot;:&quot;/&quot;,&quot;data&quot;:[]}}\" class=\"btn-secondary ui-bibz-connect btn input-refresh-button\"><i class=\"glyph fas fa-sync-alt\"></i></span></div>"
29
29
 
30
30
  assert_equal expected, actual
31
31
  end
@@ -10,7 +10,7 @@ class BreadcrumbTest < ActionView::TestCase
10
10
  b.link 'Home', url: '#home', glyph: 'home'
11
11
  b.link 'state', { url: '#state', state: :active }
12
12
  end
13
- expected = '<nav arial-label="breadcrumb"><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></nav>'
13
+ expected = "<nav arial-label=\"breadcrumb\"><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></nav>"
14
14
 
15
15
  assert_equal expected, actual
16
16
  end
@@ -13,7 +13,7 @@ class LinkTest < ActionView::TestCase
13
13
 
14
14
  test 'Link without text' do
15
15
  actual = ui_link 'My link', glyph: 'gem', text: false, url: '#link'
16
- expected = '<a href="#link"><i class="glyph fas fa-gem"></i><span class="empty-space"> </span></a>'
16
+ expected = "<a href=\"#link\"><i class=\"glyph fas fa-gem\"></i> <span class=\"visually-hidden\">My link</span></a>"
17
17
 
18
18
  assert_equal expected, actual
19
19
  end
@@ -10,7 +10,8 @@ class NavTest < ActionView::TestCase
10
10
  n.link 'Profile', url: '#profile', selector: 'profile'
11
11
  n.link 'Messages', url: '#messages', selector: 'messages'
12
12
  end
13
- expected = '<ul class="nav nav-tabs"><li class="nav-item"><a class="active nav-link" data-toggle="tab" role="tab" href="#Home">Home</a></li><li class="nav-item"><a class="nav-link" data-toggle="tab" role="tab" href="#profile">Profile</a></li><li class="nav-item"><a class="nav-link" data-toggle="tab" role="tab" href="#messages">Messages</a></li></ul>'
13
+ expected = "<ul class=\"nav nav-tabs\" role=\"tablist\"><li class=\"nav-item\"><a href=\"#Home\" class=\"active nav-link\" data-toggle=\"tab\" role=\"tab\">Home</a></li><li class=\"nav-item\"><a href=\"#profile\" class=\"nav-link\" data-toggle=\"tab\" role=\"tab\">Profile</a></li><li class=\"nav-item\"><a href=\"#messages\" class=\"nav-link\" data-toggle=\"tab\" role=\"tab\">Messages</a></li></ul>"
14
+
14
15
  assert_equal expected, actual
15
16
  end
16
17
 
@@ -20,7 +21,7 @@ class NavTest < ActionView::TestCase
20
21
  n.link 'Profile', url: '#profile', selector: 'profile', label: 16
21
22
  n.link 'Messages', url: '#messages', selector: 'messages', state: :disabled
22
23
  end
23
- expected = '<ul class="nav nav-pills"><li class="nav-item"><a class="active nav-link" href="#Home">Home</a></li><li class="nav-item"><a class="nav-link" href="#profile">Profile</a></li><li class="nav-item"><a class="disabled nav-link" href="#messages">Messages</a></li></ul>'
24
+ expected = "<ul class=\"nav nav-pills\"><li class=\"nav-item\"><a href=\"#Home\" class=\"active nav-link\">Home</a></li><li class=\"nav-item\"><a href=\"#profile\" class=\"nav-link\">Profile</a></li><li class=\"nav-item\"><a href=\"#messages\" class=\"disabled nav-link\">Messages</a></li></ul>"
24
25
 
25
26
  assert_equal expected, actual
26
27
  end
@@ -31,7 +32,7 @@ class NavTest < ActionView::TestCase
31
32
  n.link 'Profile', url: '#profile', selector: 'profile', label: 16
32
33
  n.link 'Messages', url: '#messages', selector: 'messages', state: :disabled
33
34
  end
34
- expected = '<ul class="nav justify-content-end"><li class="nav-item"><a class="active nav-link" href="#Home">Home</a></li><li class="nav-item"><a class="nav-link" href="#profile">Profile</a></li><li class="nav-item"><a class="disabled nav-link" href="#messages">Messages</a></li></ul>'
35
+ expected = "<ul class=\"nav justify-content-end\"><li class=\"nav-item\"><a href=\"#Home\" class=\"active nav-link\">Home</a></li><li class=\"nav-item\"><a href=\"#profile\" class=\"nav-link\">Profile</a></li><li class=\"nav-item\"><a href=\"#messages\" class=\"disabled nav-link\">Messages</a></li></ul>"
35
36
 
36
37
  assert_equal expected, actual
37
38
  end
@@ -42,7 +43,7 @@ class NavTest < ActionView::TestCase
42
43
  n.link 'Profile', url: '#profile', selector: 'profile', label: 16
43
44
  n.link 'Messages', url: '#messages', selector: 'messages', state: :disabled
44
45
  end
45
- expected = '<ul class="nav"><li class="nav-item"><a class="active nav-link" href="#Home">Home</a></li><li class="nav-item"><a class="nav-link" href="#profile">Profile</a></li><li class="nav-item"><a class="disabled nav-link" href="#messages">Messages</a></li></ul>'
46
+ expected = "<ul class=\"nav\"><li class=\"nav-item\"><a href=\"#Home\" class=\"active nav-link\">Home</a></li><li class=\"nav-item\"><a href=\"#profile\" class=\"nav-link\">Profile</a></li><li class=\"nav-item\"><a href=\"#messages\" class=\"disabled nav-link\">Messages</a></li></ul>"
46
47
 
47
48
  assert_equal expected, actual
48
49
  end
@@ -53,7 +54,7 @@ class NavTest < ActionView::TestCase
53
54
  n.link 'Profile', url: '#profile', selector: 'profile', label: 16
54
55
  n.link 'Messages', url: '#messages', selector: 'messages', state: :disabled
55
56
  end
56
- expected = '<ul class="nav flex-column"><li class="nav-item"><a class="active nav-link" href="#Home">Home</a></li><li class="nav-item"><a class="nav-link" href="#profile">Profile</a></li><li class="nav-item"><a class="disabled nav-link" href="#messages">Messages</a></li></ul>'
57
+ expected = "<ul class=\"nav flex-column\"><li class=\"nav-item\"><a href=\"#Home\" class=\"active nav-link\">Home</a></li><li class=\"nav-item\"><a href=\"#profile\" class=\"nav-link\">Profile</a></li><li class=\"nav-item\"><a href=\"#messages\" class=\"disabled nav-link\">Messages</a></li></ul>"
57
58
 
58
59
  assert_equal expected, actual
59
60
  end
@@ -64,7 +65,7 @@ class NavTest < ActionView::TestCase
64
65
  n.link 'Profile', url: '#profile', selector: 'profile', label: 16
65
66
  n.link 'Messages', url: '#messages', selector: 'messages', state: :disabled
66
67
  end
67
- expected = "<div class=\"list-group\" role=\"tablist\"><a class=\"active list-group-item list-group-item-action\" data-toggle=\"tab\" role=\"tab\" aria-controls=\"Home\" href=\"#Home\">Home</a><a class=\"list-group-item list-group-item-action\" data-toggle=\"tab\" role=\"tab\" aria-controls=\"Profile\" href=\"#profile\">Profile</a><a class=\"disabled list-group-item list-group-item-action\" data-toggle=\"tab\" role=\"tab\" aria-controls=\"Messages\" href=\"#messages\">Messages</a></div>"
68
+ expected = "<div class=\"list-group\" role=\"tablist\"><a href=\"#Home\" class=\"active list-group-item list-group-item-action\" data-toggle=\"tab\" role=\"tab\" aria-controls=\"home\">Home</a><a href=\"#profile\" class=\"list-group-item list-group-item-action\" data-toggle=\"tab\" role=\"tab\" aria-controls=\"profile\">Profile</a><a href=\"#messages\" class=\"disabled list-group-item list-group-item-action\" data-toggle=\"tab\" role=\"tab\" aria-controls=\"messages\">Messages</a></div>"
68
69
 
69
70
  assert_equal expected, actual
70
71
  end
@@ -3,16 +3,14 @@
3
3
  require 'test_helper'
4
4
  class NavbarTest < ActionView::TestCase
5
5
  test 'Navbar' do
6
- actual = UiBibz::Ui::Core::Navigations::Navbar.new.tap do |nb|
7
- end
6
+ actual = UiBibz::Ui::Core::Navigations::Navbar.new
8
7
  expected = "<nav class=\"navbar navbar-light navbar-expand-lg\"><div class=\"container\"><button class=\"navbar-toggler hidden-sm-up\" type=\"button\" data-toggle=\"collapse\" data-target=\"##{actual.id}\">☰</button><div class=\"navbar-collapse collapse\" id=\"#{actual.id}\"></div></div></nav>"
9
8
 
10
9
  assert_equal expected, actual.render
11
10
  end
12
11
 
13
12
  test 'Navbar with options' do
14
- actual = UiBibz::Ui::Core::Navigations::Navbar.new(title: 'Brand', expand_size: :xs, status: :primary, position: :top, brand_position: :right).tap do |nb|
15
- end
13
+ actual = UiBibz::Ui::Core::Navigations::Navbar.new(title: 'Brand', expand_size: :xs, status: :primary, position: :top, brand_position: :right)
16
14
  expected = "<nav class=\"bg-primary navbar navbar-light fixed-top navbar-expand-xs\"><div class=\"container\"><button class=\"navbar-toggler hidden-sm-up\" type=\"button\" data-toggle=\"collapse\" data-target=\"##{actual.id}\">☰</button><span class=\"navbar-brand\">Brand</span><div class=\"navbar-collapse collapse\" id=\"#{actual.id}\"></div></div></nav>"
17
15
 
18
16
  assert_equal expected, actual.render
@@ -32,7 +30,7 @@ class NavbarTest < ActionView::TestCase
32
30
  end
33
31
  nb.text 'test'
34
32
  end
35
- expected = "<nav class=\"navbar navbar-light navbar-expand-lg\"><div class=\"container\"><span class=\"navbar-brand\">Brand</span><button class=\"navbar-toggler hidden-sm-up\" type=\"button\" data-toggle=\"collapse\" data-target=\"##{actual.id}\">☰</button><div class=\"navbar-collapse collapse\" id=\"#{actual.id}\"><ul class=\"navbar-nav\"><li class=\"nav-item\"><a class=\"active nav-link\" href=\"#Home\">Home</a></li><li class=\"nav-item\"><a class=\"nav-link\" href=\"#profile\">Profile</a></li><li class=\"nav-item\"><a class=\"nav-link\" href=\"#messages\">Messages</a></li></ul><form type=\"form_tag\" position=\"right\" class=\"d-flex\" action=\"#\" accept-charset=\"UTF-8\" method=\"post\"><button class=\"btn-secondary btn\">Search</button></form><span class=\"navbar-text\">test</span></div></div></nav>"
33
+ expected = "<nav class=\"navbar navbar-light navbar-expand-lg\"><div class=\"container\"><span class=\"navbar-brand\">Brand</span><button class=\"navbar-toggler hidden-sm-up\" type=\"button\" data-toggle=\"collapse\" data-target=\"##{actual.id}\">☰</button><div class=\"navbar-collapse collapse\" id=\"#{actual.id}\"><ul class=\"navbar-nav\"><li class=\"nav-item\"><a href=\"#Home\" class=\"active nav-link\">Home</a></li><li class=\"nav-item\"><a href=\"#profile\" class=\"nav-link\">Profile</a></li><li class=\"nav-item\"><a href=\"#messages\" class=\"nav-link\">Messages</a></li></ul><form type=\"form_tag\" position=\"right\" class=\"d-flex\" action=\"#\" accept-charset=\"UTF-8\" method=\"post\"><button class=\"btn-secondary btn\">Search</button></form><span class=\"navbar-text\">test</span></div></div></nav>"
36
34
 
37
35
  assert_equal expected, actual.render
38
36
  end
@@ -44,7 +42,8 @@ class NavbarTest < ActionView::TestCase
44
42
  n.link 'Link', url: '#link'
45
43
  end
46
44
  end
47
- expected = "<nav class=\"bg-dark navbar navbar-dark navbar-expand-lg\"><div class=\"container\"><span class=\"navbar-brand\"><img src=\"/images/ruby-white\" /></span><button class=\"navbar-toggler hidden-sm-up\" type=\"button\" data-toggle=\"collapse\" data-target=\"##{actual.id}\">☰</button><div class=\"navbar-collapse collapse\" id=\"#{actual.id}\"><ul class=\"navbar-nav\"><li class=\"nav-item\"><a class=\"nav-link\" href=\"#link\">Link</a></li></ul></div></div></nav>"
45
+ expected =
46
+ "<nav class=\"bg-dark navbar navbar-dark navbar-expand-lg\"><div class=\"container\"><span class=\"navbar-brand\"><img src=\"/images/ruby-white\" /></span><button class=\"navbar-toggler hidden-sm-up\" type=\"button\" data-toggle=\"collapse\" data-target=\"##{actual.id}\">☰</button><div class=\"navbar-collapse collapse\" id=\"#{actual.id}\"><ul class=\"navbar-nav\"><li class=\"nav-item\"><a href=\"#link\" class=\"nav-link\">Link</a></li></ul></div></div></nav>"
48
47
 
49
48
  assert_equal expected, actual.render
50
49
  end
@@ -10,7 +10,7 @@ class TabGroupTest < ActionView::TestCase
10
10
  n.tab 'Profile', url: '#profile', selector: 'profile'
11
11
  n.tab 'Messages', url: '#messages', selector: 'messages'
12
12
  end
13
- expected = '<ul class="nav nav-tabs"><li class="nav-item"><a class="active nav-link" data-toggle="tab" role="tab" href="#Home">Home</a></li><li class="nav-item"><a class="nav-link" data-toggle="tab" role="tab" href="#profile">Profile</a></li><li class="nav-item"><a class="nav-link" data-toggle="tab" role="tab" href="#messages">Messages</a></li></ul>'
13
+ expected = "<ul class=\"nav nav-tabs\" role=\"tablist\"><li class=\"nav-item\"><a href=\"#Home\" class=\"active nav-link\" data-toggle=\"tab\" role=\"tab\">Home</a></li><li class=\"nav-item\"><a href=\"#profile\" class=\"nav-link\" data-toggle=\"tab\" role=\"tab\">Profile</a></li><li class=\"nav-item\"><a href=\"#messages\" class=\"nav-link\" data-toggle=\"tab\" role=\"tab\">Messages</a></li></ul>"
14
14
 
15
15
  assert_equal expected, actual
16
16
  end
@@ -21,7 +21,7 @@ class TabGroupTest < ActionView::TestCase
21
21
  n.tab 'Profile', url: '#profile', selector: 'profile'
22
22
  n.tab 'Messages', url: '#messages', selector: 'messages'
23
23
  end
24
- expected = '<ul class="nav nav-tabs"><li class="nav-item"><a class="active nav-link" data-toggle="tab" role="tab" href="#Home">Home</a></li><li class="nav-item"><a class="nav-link" data-toggle="tab" role="tab" href="#profile">Profile</a></li><li class="nav-item"><a class="nav-link" data-toggle="tab" role="tab" href="#messages">Messages</a></li></ul>'
24
+ expected = "<ul class=\"nav nav-tabs\" role=\"tablist\"><li class=\"nav-item\"><a href=\"#Home\" class=\"active nav-link\" data-toggle=\"tab\" role=\"tab\">Home</a></li><li class=\"nav-item\"><a href=\"#profile\" class=\"nav-link\" data-toggle=\"tab\" role=\"tab\">Profile</a></li><li class=\"nav-item\"><a href=\"#messages\" class=\"nav-link\" data-toggle=\"tab\" role=\"tab\">Messages</a></li></ul>"
25
25
 
26
26
  assert_equal expected, actual
27
27
  end
@@ -32,7 +32,7 @@ class TabGroupTest < ActionView::TestCase
32
32
  n.tab 'Profile', url: '#profile', selector: 'profile'
33
33
  n.tab 'Messages', url: '#messages', selector: 'messages'
34
34
  end
35
- expected = '<ul class="nav nav-tabs"><li class="nav-item"><span class="active nav-link" data-toggle="tab" role="tab">Home</span></li><li class="nav-item"><span class="nav-link" data-toggle="tab" role="tab">Profile</span></li><li class="nav-item"><span class="nav-link" data-toggle="tab" role="tab">Messages</span></li></ul>'
35
+ expected = "<ul class=\"nav nav-tabs\" role=\"tablist\"><li class=\"nav-item\"><span class=\"active nav-link\" data-toggle=\"tab\" role=\"tab\">Home</span></li><li class=\"nav-item\"><span class=\"nav-link\" data-toggle=\"tab\" role=\"tab\">Profile</span></li><li class=\"nav-item\"><span class=\"nav-link\" data-toggle=\"tab\" role=\"tab\">Messages</span></li></ul>"
36
36
 
37
37
  assert_equal expected, actual
38
38
  end
@@ -43,7 +43,7 @@ class TabGroupTest < ActionView::TestCase
43
43
  n.tab 'Profile', url: '#profile', selector: 'profile', label: 16
44
44
  n.tab 'Messages', url: '#messages', selector: 'messages', state: :disabled
45
45
  end
46
- expected = '<ul class="nav nav-tabs justify-content-end"><li class="nav-item"><a class="active nav-link" data-toggle="tab" role="tab" href="#Home">Home</a></li><li class="nav-item"><a class="nav-link" data-toggle="tab" role="tab" href="#profile">Profile</a></li><li class="nav-item"><a class="disabled nav-link" data-toggle="tab" role="tab" href="#messages">Messages</a></li></ul>'
46
+ expected = "<ul class=\"nav nav-tabs justify-content-end\" role=\"tablist\"><li class=\"nav-item\"><a href=\"#Home\" class=\"active nav-link\" data-toggle=\"tab\" role=\"tab\">Home</a></li><li class=\"nav-item\"><a href=\"#profile\" class=\"nav-link\" data-toggle=\"tab\" role=\"tab\">Profile</a></li><li class=\"nav-item\"><a href=\"#messages\" class=\"disabled nav-link\" data-toggle=\"tab\" role=\"tab\">Messages</a></li></ul>"
47
47
 
48
48
  assert_equal expected, actual
49
49
  end
@@ -54,7 +54,7 @@ class TabGroupTest < ActionView::TestCase
54
54
  n.tab 'Profile', url: '#profile', selector: 'profile', label: 16
55
55
  n.tab 'Messages', url: '#messages', selector: 'messages', state: :disabled
56
56
  end
57
- expected = '<ul class="nav nav-tabs"><li class="nav-item"><a class="active nav-link" data-toggle="tab" role="tab" href="#Home">Home</a></li><li class="nav-item"><a class="nav-link" data-toggle="tab" role="tab" href="#profile">Profile</a></li><li class="nav-item"><a class="disabled nav-link" data-toggle="tab" role="tab" href="#messages">Messages</a></li></ul>'
57
+ expected = "<ul class=\"nav nav-tabs\" role=\"tablist\"><li class=\"nav-item\"><a href=\"#Home\" class=\"active nav-link\" data-toggle=\"tab\" role=\"tab\">Home</a></li><li class=\"nav-item\"><a href=\"#profile\" class=\"nav-link\" data-toggle=\"tab\" role=\"tab\">Profile</a></li><li class=\"nav-item\"><a href=\"#messages\" class=\"disabled nav-link\" data-toggle=\"tab\" role=\"tab\">Messages</a></li></ul>"
58
58
 
59
59
  assert_equal expected, actual
60
60
  end