ui_bibz 3.0.0.alpha2 → 3.0.0.alpha9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +9 -9
  3. data/README.md +1 -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 +3 -3
  7. data/lib/ui_bibz/inputs/ui_bibz_inputs/base_input.rb +4 -3
  8. data/lib/ui_bibz/inputs/ui_bibz_inputs/ui_checkbox_field_input.rb +5 -1
  9. data/lib/ui_bibz/inputs/ui_bibz_inputs/ui_multi_select_field_input.rb +3 -3
  10. data/lib/ui_bibz/inputs/ui_bibz_inputs/ui_slider_field_input.rb +1 -0
  11. data/lib/ui_bibz/rails/engine.rb +0 -4
  12. data/lib/ui_bibz/ui/concerns/card_itemable_concern.rb +2 -0
  13. data/lib/ui_bibz/ui/concerns/html_concern.rb +3 -3
  14. data/lib/ui_bibz/ui/core/boxes/components/card_body.rb +8 -0
  15. data/lib/ui_bibz/ui/core/boxes/components/card_image.rb +6 -2
  16. data/lib/ui_bibz/ui/core/forms/buttons/button.rb +3 -12
  17. data/lib/ui_bibz/ui/core/forms/buttons/button_link.rb +0 -1
  18. data/lib/ui_bibz/ui/core/forms/buttons/button_refresh.rb +0 -1
  19. data/lib/ui_bibz/ui/core/forms/choices/checkbox_field.rb +13 -4
  20. data/lib/ui_bibz/ui/core/forms/choices/radio_field.rb +7 -1
  21. data/lib/ui_bibz/ui/core/forms/choices/switch_field.rb +4 -0
  22. data/lib/ui_bibz/ui/core/forms/dropdowns/dropdown.rb +12 -8
  23. data/lib/ui_bibz/ui/core/forms/dropdowns/split_dropdown.rb +7 -2
  24. data/lib/ui_bibz/ui/core/forms/numbers/formula_field.rb +2 -0
  25. data/lib/ui_bibz/ui/core/forms/numbers/range_field.rb +19 -1
  26. data/lib/ui_bibz/ui/core/forms/numbers/slider_field.rb +14 -2
  27. data/lib/ui_bibz/ui/core/forms/numbers/slider_header.rb +3 -3
  28. data/lib/ui_bibz/ui/core/forms/selects/dropdown_select_field.rb +41 -59
  29. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button.rb +1 -3
  30. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button_link.rb +1 -3
  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 +1 -1
  36. data/lib/ui_bibz/ui/core/navigations/navbar.rb +6 -4
  37. data/lib/ui_bibz/ui/core/navigations/tab_group.rb +4 -0
  38. data/lib/ui_bibz/ui/core/windows/modal.rb +6 -2
  39. data/lib/ui_bibz/ui/extensions/core/component/glyph_extension.rb +12 -24
  40. data/lib/ui_bibz/ui/extensions/core/forms/surround_extension.rb +1 -1
  41. data/lib/ui_bibz/ui/ux/containers/components/panel_header.rb +3 -2
  42. data/lib/ui_bibz/ui/ux/containers/components/panel_header_title.rb +47 -0
  43. data/lib/ui_bibz/ui/ux/tables/table_pagination_per_page.rb +3 -3
  44. data/lib/ui_bibz/ui/ux/tables/table_search_field.rb +4 -4
  45. data/lib/ui_bibz/utils/breakdown_class_name_generator.rb +20 -7
  46. data/lib/ui_bibz/utils/internationalization.rb +1 -1
  47. data/test/simple_form_test.rb +6 -28
  48. data/test/ui/core/boxes/card_test.rb +2 -2
  49. data/test/ui/core/component_test.rb +2 -2
  50. data/test/ui/core/forms/buttons/button_group_test.rb +2 -2
  51. data/test/ui/core/forms/buttons/button_link_test.rb +1 -8
  52. data/test/ui/core/forms/buttons/button_refresh_test.rb +1 -1
  53. data/test/ui/core/forms/buttons/button_test.rb +2 -9
  54. data/test/ui/core/forms/choices/checkbox_field_test.rb +8 -1
  55. data/test/ui/core/forms/choices/choice_group_test.rb +3 -3
  56. data/test/ui/core/forms/choices/radio_field_test.rb +1 -1
  57. data/test/ui/core/forms/dropdowns/dropdown_test.rb +2 -2
  58. data/test/ui/core/forms/numbers/range_field_test.rb +14 -0
  59. data/test/ui/core/forms/numbers/slider_field_test.rb +2 -2
  60. data/test/ui/core/forms/selects/multi_select_field_test.rb +6 -6
  61. data/test/ui/core/forms/selects/select_field_test.rb +1 -1
  62. data/test/ui/core/forms/surrounds/surround_field_test.rb +27 -3
  63. data/test/ui/core/forms/texts/auto_complete_field_test.rb +2 -2
  64. data/test/ui/core/navigations/breadcrumb_test.rb +1 -1
  65. data/test/ui/core/navigations/link_test.rb +1 -1
  66. data/test/ui/core/navigations/nav_test.rb +7 -6
  67. data/test/ui/core/navigations/navbar_test.rb +5 -6
  68. data/test/ui/core/navigations/tab_group_test.rb +5 -5
  69. data/test/ui/core/notifications/alert_test.rb +1 -1
  70. data/test/ui/core/notifications/badge_test.rb +2 -2
  71. data/test/ui/utils/breakdown_class_name_generator_test.rb +14 -0
  72. data/test/ui/ux/containers/panel_test.rb +1 -1
  73. data/test/ui/ux/tables/table_test.rb +2 -2
  74. metadata +5 -8
  75. data/lib/ui_bibz/ui/core/forms/selects/multi_select_field.rb +0 -122
  76. data/package.json +0 -5
  77. data/test/ui/core/forms/selects/dropdown_select_field_test.rb +0 -84
@@ -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\"><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>"
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
@@ -16,7 +16,7 @@ class AlertTest < ActionView::TestCase
16
16
  a.header 'Information'
17
17
  a.body 'Body text'
18
18
  end
19
- expected = "<div class=\"alert-success alert alert-dismissible\" role=\"alert\"><h4 class=\"alert-header\"><i class=\"glyph fas fa-thumbs-o-up\"></i> Information<button type=\"button\" class=\"btn-close\" data-dismiss=\"alert\" aria-label=\"Close\"></button></h4><hr /><p class=\"alert-body mb-0\">Body text</p></div>"
19
+ expected = "<div class=\"alert-success alert alert-dismissible\" role=\"alert\"><h4 class=\"alert-header\"><i class=\"glyph fas fa-thumbs-o-up\"></i> Information<button type=\"button\" class=\"btn-close\" data-dismiss=\"alert\" aria-label=\"Close\"></button></h4><hr /><p class=\"alert-body mb-0\">Body text</p></div>"
20
20
 
21
21
  assert_equal expected, actual
22
22
  end
@@ -6,7 +6,7 @@ class BadgeTest < ActionView::TestCase
6
6
 
7
7
  test 'badge' do
8
8
  actual = ui_badge 'state', status: :success, glyph: 'pencil'
9
- expected = '<span class="bg-success badge"><i class="glyph fas fa-pencil"></i> state</span>'
9
+ expected = "<span class=\"bg-success badge\"><i class=\"glyph fas fa-pencil\"></i> state</span>"
10
10
 
11
11
  assert_equal expected, actual
12
12
  end
@@ -20,7 +20,7 @@ class BadgeTest < ActionView::TestCase
20
20
 
21
21
  test 'badge pill' do
22
22
  actual = ui_badge 'state', status: :success, type: :pill, glyph: 'pencil'
23
- expected = '<span class="bg-success badge rounded-pill"><i class="glyph fas fa-pencil"></i> state</span>'
23
+ expected = "<span class=\"bg-success badge rounded-pill\"><i class=\"glyph fas fa-pencil\"></i> state</span>"
24
24
 
25
25
  assert_equal expected, actual
26
26
  end
@@ -57,4 +57,18 @@ class BreakdownClassNameGeneratorTest < ActionView::TestCase
57
57
 
58
58
  assert_equal expected, actual
59
59
  end
60
+
61
+ test "name generator with order" do
62
+ actual = UiBibz::Utils::BreakdownClassNameGenerator.new(md: { num: 2 }, order: 2).class_names
63
+ expected = %w[col-md-2 order-2]
64
+
65
+ assert_equal expected, actual
66
+ end
67
+
68
+ test "name generator with md: 8" do
69
+ actual = UiBibz::Utils::BreakdownClassNameGenerator.new(md: 8).class_names
70
+ expected = ["col-md-8"]
71
+
72
+ assert_equal expected, actual
73
+ end
60
74
  end
@@ -35,7 +35,7 @@ class CardTest < ActionView::TestCase
35
35
  end
36
36
  p.footer 'Footer'
37
37
  end
38
- expected = "<div class=\"panel\"><div class=\"panel-header justify-content-between\"><div class=\"panel-title\">My header</div><div class=\"btn-group btn-group-sm\" role=\"group\"><button class=\"btn-outline-secondary btn btn-sm without-text\"><i class=\"glyph fas fa-caret-up\"></i><span class=\"empty-space\"> </span></button><button class=\"btn-outline-secondary btn btn-sm without-text\"><i class=\"glyph fas fa-cog\"></i><span class=\"empty-space\"> </span></button><button class=\"btn-outline-secondary btn btn-sm without-text\"><i class=\"glyph fas fa-Close\"></i><span class=\"empty-space\"> </span></button></div></div><div class=\"btn-toolbar justify-content-between panel-toolbar\" role=\"toolbar\"><div role=\"group\" class=\"btn-group btn-group-sm mr-2\"><button class=\"btn-secondary btn btn-sm\">Copy</button><button class=\"btn-secondary btn btn-sm\">Cut</button><button class=\"btn-secondary btn btn-sm\">Paste</button></div><div class=\"btn-group btn-group-sm\" role=\"group\"><button class=\"btn-secondary btn btn-sm\">Delete</button></div></div><div class=\"panel-body\">Body</div><div class=\"btn-toolbar panel-toolbar\" role=\"toolbar\"><div class=\"btn-group btn-group-sm\" role=\"group\"><button class=\"btn-success btn btn-sm without-text\"><i class=\"glyph fas fa-plus-circle\"></i><span class=\"empty-space\"> </span></button><button class=\"btn-danger btn btn-sm without-text\"><i class=\"glyph fas fa-minus-circle\"></i><span class=\"empty-space\"> </span></button></div></div><div class=\"panel-footer\">Footer</div></div>"
38
+ expected = "<div class=\"panel\"><div class=\"panel-header justify-content-between\"><div class=\"panel-title\">My header</div><div class=\"btn-group btn-group-sm\" role=\"group\"><button class=\"btn-outline-secondary btn btn-sm\"><i class=\"glyph fas fa-caret-up\"></i> <span class=\"visually-hidden\">Minimize</span></button><button class=\"btn-outline-secondary btn btn-sm\"><i class=\"glyph fas fa-cog\"></i> <span class=\"visually-hidden\">Options</span></button><button class=\"btn-outline-secondary btn btn-sm\"><i class=\"glyph fas fa-Close\"></i> <span class=\"visually-hidden\">Close</span></button></div></div><div class=\"btn-toolbar justify-content-between panel-toolbar\" role=\"toolbar\"><div role=\"group\" class=\"btn-group btn-group-sm mr-2\"><button class=\"btn-secondary btn btn-sm\">Copy</button><button class=\"btn-secondary btn btn-sm\">Cut</button><button class=\"btn-secondary btn btn-sm\">Paste</button></div><div class=\"btn-group btn-group-sm\" role=\"group\"><button class=\"btn-secondary btn btn-sm\">Delete</button></div></div><div class=\"panel-body\">Body</div><div class=\"btn-toolbar panel-toolbar\" role=\"toolbar\"><div class=\"btn-group btn-group-sm\" role=\"group\"><button class=\"btn-success btn btn-sm\"><i class=\"glyph fas fa-plus-circle\"></i> <span class=\"visually-hidden\">Add</span></button><button class=\"btn-danger btn btn-sm\"><i class=\"glyph fas fa-minus-circle\"></i> <span class=\"visually-hidden\">Remove</span></button></div></div><div class=\"panel-footer\">Footer</div></div>"
39
39
 
40
40
  assert_equal expected, actual
41
41
  end
@@ -26,7 +26,7 @@ class TableTest < ActionView::TestCase
26
26
 
27
27
  test 'table search field' do
28
28
  actual = UiBibz::Ui::Ux::Tables::TableSearchField.new({ store: @users }).render
29
- expected = "<form class=\"form-table-search-field\" action=\"/users?direction=asc&amp;page=1&amp;per_page=2&amp;search=Name+fr&amp;sort=users.name_fr\" accept-charset=\"UTF-8\" method=\"get\"><div class=\"input-group input-group-sm table-search-field\"><span class=\"input-group-text\"><i class=\"glyph fas fa-search\"></i></span><input type=\"hidden\" name=\"sort\" value=\"users.name_fr\" /><input type=\"hidden\" name=\"direction\" value=\"asc\" /><input type=\"hidden\" name=\"per_page\" value=\"2\" /><input type=\"hidden\" name=\"page\" value=\"1\" /><input type=\"hidden\" name=\"only_path\" value=\"true\" /><input type=\"hidden\" name=\"link_type\" value=\"search\" /><input type=\"search\" value=\"Name fr\" name=\"search\" class=\"form-control\" placeholder=\"Search by Name fr and Name en...\" /><button type=\"button\" class=\"btn btn-secondary input-group-btn clear-search-btn\"><i class=\"glyph fas fa-times-circle\"></i></button></div></form>"
29
+ expected = "<form class=\"form-table-search-field\" action=\"/users?direction=asc&amp;page=1&amp;per_page=2&amp;search=Name+fr&amp;sort=users.name_fr\" accept-charset=\"UTF-8\" method=\"get\"><div class=\"input-group input-group-sm table-search-field\"><span class=\"input-group-text\"><i class=\"glyph fas fa-search\"></i></span><input type=\"hidden\" name=\"sort\" value=\"users.name_fr\" /><input type=\"hidden\" name=\"direction\" value=\"asc\" /><input type=\"hidden\" name=\"per_page\" value=\"2\" /><input type=\"hidden\" name=\"page\" value=\"1\" /><input type=\"hidden\" name=\"only_path\" value=\"true\" /><input type=\"hidden\" name=\"link_type\" value=\"search\" /><input type=\"search\" value=\"Name fr\" name=\"search\" class=\"form-control\" placeholder=\"Search by Name fr and Name en...\" /><button type=\"button\" class=\"btn btn-secondary input-group-btn clear-search-btn\"><i class=\"glyph fas fa-times-circle\"></i> <span class=\"visually-hidden\">Clear Search</span></button></div></form>"
30
30
 
31
31
  assert_equal expected, actual
32
32
  end
@@ -97,7 +97,7 @@ class TableTest < ActionView::TestCase
97
97
  test 'table searchable' do
98
98
  options = { searchable: true }
99
99
  actual = UiBibz::Ui::Ux::Tables::Searchable.new(@store, options).render
100
- expected = "<div><div class=\"title\">Users list</div><form class=\"form-table-search-field\" action=\"/users?direction=asc&amp;page=1&amp;per_page=2&amp;search=Name+fr&amp;sort=users.name_fr\" accept-charset=\"UTF-8\" method=\"get\"><div class=\"input-group input-group-sm table-search-field\"><span class=\"input-group-text\"><i class=\"glyph fas fa-search\"></i></span><input type=\"hidden\" name=\"sort\" value=\"users.name_fr\" /><input type=\"hidden\" name=\"direction\" value=\"asc\" /><input type=\"hidden\" name=\"per_page\" value=\"2\" /><input type=\"hidden\" name=\"page\" value=\"1\" /><input type=\"hidden\" name=\"only_path\" value=\"true\" /><input type=\"hidden\" name=\"link_type\" value=\"search\" /><input type=\"search\" value=\"Name fr\" name=\"search\" class=\"form-control\" placeholder=\"Search by Name fr and Name en...\" /><button type=\"button\" class=\"btn btn-secondary input-group-btn clear-search-btn\"><i class=\"glyph fas fa-times-circle\"></i></button></div></form><br class=\"ui-bibz-clear\" /></div>"
100
+ expected = "<div><div class=\"title\">Users list</div><form class=\"form-table-search-field\" action=\"/users?direction=asc&amp;page=1&amp;per_page=2&amp;search=Name+fr&amp;sort=users.name_fr\" accept-charset=\"UTF-8\" method=\"get\"><div class=\"input-group input-group-sm table-search-field\"><span class=\"input-group-text\"><i class=\"glyph fas fa-search\"></i></span><input type=\"hidden\" name=\"sort\" value=\"users.name_fr\" /><input type=\"hidden\" name=\"direction\" value=\"asc\" /><input type=\"hidden\" name=\"per_page\" value=\"2\" /><input type=\"hidden\" name=\"page\" value=\"1\" /><input type=\"hidden\" name=\"only_path\" value=\"true\" /><input type=\"hidden\" name=\"link_type\" value=\"search\" /><input type=\"search\" value=\"Name fr\" name=\"search\" class=\"form-control\" placeholder=\"Search by Name fr and Name en...\" /><button type=\"button\" class=\"btn btn-secondary input-group-btn clear-search-btn\"><i class=\"glyph fas fa-times-circle\"></i> <span class=\"visually-hidden\">Clear Search</span></button></div></form><br class=\"ui-bibz-clear\" /></div>"
101
101
 
102
102
  assert_equal expected, actual
103
103
  end