ui_bibz 3.0.0.alpha5 → 3.0.0.alpha11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +9 -9
  3. data/README.md +4 -0
  4. data/lib/ui_bibz/concerns/models/searchable.rb +1 -1
  5. data/lib/ui_bibz/infos.rb +4 -4
  6. data/lib/ui_bibz/inputs/ui_bibz_inputs/ui_checkbox_field_input.rb +1 -1
  7. data/lib/ui_bibz/inputs/ui_bibz_inputs/ui_text_field_input.rb +1 -1
  8. data/lib/ui_bibz/ui/concerns/html_concern.rb +3 -3
  9. data/lib/ui_bibz/ui/core/boxes/components/card_image.rb +5 -1
  10. data/lib/ui_bibz/ui/core/forms/buttons/button.rb +3 -12
  11. data/lib/ui_bibz/ui/core/forms/buttons/button_link.rb +1 -2
  12. data/lib/ui_bibz/ui/core/forms/buttons/button_refresh.rb +0 -1
  13. data/lib/ui_bibz/ui/core/forms/choices/checkbox_field.rb +7 -1
  14. data/lib/ui_bibz/ui/core/forms/choices/radio_field.rb +7 -1
  15. data/lib/ui_bibz/ui/core/forms/choices/switch_field.rb +4 -0
  16. data/lib/ui_bibz/ui/core/forms/dropdowns/dropdown.rb +6 -6
  17. data/lib/ui_bibz/ui/core/forms/dropdowns/split_dropdown.rb +1 -1
  18. data/lib/ui_bibz/ui/core/forms/numbers/formula_field.rb +2 -0
  19. data/lib/ui_bibz/ui/core/forms/numbers/range_field.rb +19 -1
  20. data/lib/ui_bibz/ui/core/forms/numbers/slider_field.rb +13 -1
  21. data/lib/ui_bibz/ui/core/forms/numbers/slider_header.rb +2 -2
  22. data/lib/ui_bibz/ui/core/forms/selects/dropdown_select_field.rb +29 -5
  23. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button.rb +1 -9
  24. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button_link.rb +1 -9
  25. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_dropdown.rb +5 -4
  26. data/lib/ui_bibz/ui/core/forms/surrounds/surround_field.rb +3 -8
  27. data/lib/ui_bibz/ui/core/icons/glyph.rb +9 -1
  28. data/lib/ui_bibz/ui/core/navigations/components/nav_dropdown.rb +1 -1
  29. data/lib/ui_bibz/ui/core/navigations/components/nav_link_link.rb +1 -1
  30. data/lib/ui_bibz/ui/core/navigations/nav.rb +3 -3
  31. data/lib/ui_bibz/ui/core/navigations/navbar.rb +6 -4
  32. data/lib/ui_bibz/ui/core/navigations/tab_group.rb +5 -1
  33. data/lib/ui_bibz/ui/core/notifications/components/toast_header.rb +15 -1
  34. data/lib/ui_bibz/ui/core/windows/modal.rb +6 -2
  35. data/lib/ui_bibz/ui/extensions/core/component/glyph_extension.rb +11 -24
  36. data/lib/ui_bibz/ui/extensions/core/component/popover_extension.rb +1 -1
  37. data/lib/ui_bibz/ui/extensions/core/forms/surround_extension.rb +1 -1
  38. data/lib/ui_bibz/ui/ux/containers/components/panel_header.rb +3 -2
  39. data/lib/ui_bibz/ui/ux/containers/components/panel_header_title.rb +47 -0
  40. data/lib/ui_bibz/ui/ux/tables/table_pagination_per_page.rb +3 -3
  41. data/lib/ui_bibz/ui/ux/tables/table_search_field.rb +4 -4
  42. data/lib/ui_bibz/utils/breakdown_class_name_generator.rb +14 -6
  43. data/lib/ui_bibz/utils/internationalization.rb +1 -1
  44. data/test/simple_form_test.rb +4 -4
  45. data/test/ui/core/boxes/card_test.rb +2 -2
  46. data/test/ui/core/component_test.rb +2 -2
  47. data/test/ui/core/forms/buttons/button_group_test.rb +1 -1
  48. data/test/ui/core/forms/buttons/button_link_test.rb +1 -8
  49. data/test/ui/core/forms/buttons/button_refresh_test.rb +1 -1
  50. data/test/ui/core/forms/buttons/button_test.rb +2 -9
  51. data/test/ui/core/forms/choices/checkbox_field_test.rb +2 -2
  52. data/test/ui/core/forms/choices/choice_group_test.rb +3 -3
  53. data/test/ui/core/forms/choices/radio_field_test.rb +1 -1
  54. data/test/ui/core/forms/dropdowns/dropdown_test.rb +2 -2
  55. data/test/ui/core/forms/numbers/range_field_test.rb +14 -0
  56. data/test/ui/core/forms/numbers/slider_field_test.rb +2 -2
  57. data/test/ui/core/forms/selects/multi_select_field_test.rb +3 -3
  58. data/test/ui/core/forms/selects/select_field_test.rb +1 -1
  59. data/test/ui/core/forms/surrounds/surround_field_test.rb +27 -3
  60. data/test/ui/core/forms/texts/auto_complete_field_test.rb +2 -2
  61. data/test/ui/core/navigations/breadcrumb_test.rb +1 -1
  62. data/test/ui/core/navigations/link_test.rb +1 -1
  63. data/test/ui/core/navigations/nav_test.rb +2 -2
  64. data/test/ui/core/navigations/navbar_test.rb +2 -4
  65. data/test/ui/core/navigations/tab_group_test.rb +5 -5
  66. data/test/ui/core/notifications/alert_test.rb +1 -1
  67. data/test/ui/core/notifications/badge_test.rb +2 -2
  68. data/test/ui/utils/breakdown_class_name_generator_test.rb +14 -0
  69. data/test/ui/ux/containers/panel_test.rb +1 -1
  70. data/test/ui/ux/tables/table_test.rb +2 -2
  71. data/ui_bibz.gemspec +1 -1
  72. metadata +7 -6
@@ -12,7 +12,7 @@ module UiBibz::Utils
12
12
  end
13
13
 
14
14
  def translate
15
- I18n.t(@translation, options_with_default)
15
+ I18n.t(@translation, **options_with_default)
16
16
  end
17
17
 
18
18
  private
@@ -82,7 +82,7 @@ test1</textarea></div></form>"
82
82
  f.input :name_fr, as: :ui_dropdown_select_field, multiple: true, collection: @users, label_method: :name_fr
83
83
  end
84
84
 
85
- expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input type=\"hidden\" name=\"_method\" value=\"patch\" /><div class=\"form-group ui_dropdown_select_field optional user_name_fr\"><label class=\"control-label ui_dropdown_select_field optional\" for=\"user_name_fr\">Name fr</label><select name=\"user[name_fr][]\" id=\"user_name_fr\" class=\"btn-secondary multi-select-field\" multiple=\"multiple\"><option value=\"1\">test1</option>
85
+ expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input type=\"hidden\" name=\"_method\" value=\"patch\" /><div class=\"form-group ui_dropdown_select_field optional user_name_fr\"><label class=\"control-label ui_dropdown_select_field optional\" for=\"user_name_fr\">Name fr</label><select name=\"user[name_fr][]\" id=\"user_name_fr\" class=\"btn-secondary multi-select-field\" multiple=\"multiple\" data-dropdown-classes=\"dropdown\"><option value=\"1\">test1</option>
86
86
  <option value=\"2\">test2</option></select></div></form>"
87
87
 
88
88
  assert_equal expected, actual
@@ -93,7 +93,7 @@ test1</textarea></div></form>"
93
93
  f.input :name_fr, as: :ui_dropdown_select_field, multiple: true, collection: @continents, toto: 'lala', grouped: true, group_method: :countries
94
94
  end
95
95
 
96
- expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input type=\"hidden\" name=\"_method\" value=\"patch\" /><div class=\"form-group ui_dropdown_select_field optional user_name_fr\"><label class=\"control-label ui_dropdown_select_field optional\" for=\"user_name_fr\">Name fr</label><select name=\"user[name_fr][]\" id=\"user_name_fr\" class=\"btn-secondary multi-select-field\" multiple=\"multiple\"><optgroup label=\"Europe\"><option value=\"1\">France</option>
96
+ expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input type=\"hidden\" name=\"_method\" value=\"patch\" /><div class=\"form-group ui_dropdown_select_field optional user_name_fr\"><label class=\"control-label ui_dropdown_select_field optional\" for=\"user_name_fr\">Name fr</label><select name=\"user[name_fr][]\" id=\"user_name_fr\" class=\"btn-secondary multi-select-field\" multiple=\"multiple\" data-dropdown-classes=\"dropdown\"><optgroup label=\"Europe\"><option value=\"1\">France</option>
97
97
  <option value=\"2\">Deutchland</option></optgroup></select></div></form>"
98
98
 
99
99
  assert_equal expected, actual
@@ -104,7 +104,7 @@ test1</textarea></div></form>"
104
104
  f.input :name_fr, as: :ui_text_field
105
105
  end
106
106
 
107
- expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input type=\"hidden\" name=\"_method\" value=\"patch\" /><div class=\"form-group ui_text_field optional user_name_fr\"><label class=\"control-label ui_text_field optional\" for=\"user_name_fr\">Name fr</label><input type=\"ui_text_field\" name=\"user[name_fr]\" id=\"user_name_fr\" value=\"test1\" class=\"form-control string ui_text_field optional\" /></div></form>"
107
+ expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input type=\"hidden\" name=\"_method\" value=\"patch\" /><div class=\"form-group ui_text_field optional user_name_fr\"><label class=\"control-label ui_text_field optional\" for=\"user_name_fr\">Name fr</label><input type=\"text\" name=\"user[name_fr]\" id=\"user_name_fr\" value=\"test1\" class=\"form-control string ui_text_field optional\" /></div></form>"
108
108
 
109
109
  assert_equal expected, actual
110
110
  end
@@ -147,7 +147,7 @@ test1</textarea></div></form>"
147
147
  end
148
148
 
149
149
  expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input type=\"hidden\" name=\"_method\" value=\"patch\" /><div class=\"form-group ui_select_field optional user_name_fr\"><label class=\"control-label ui_select_field optional\" for=\"user_name_fr\">Name fr</label><div class=\"field-refresh input-group ui_surround_field\"><select name=\"user[name_fr]\" id=\"user_name_fr\" class=\"form-control select-field form-select\"><option value=\"1\">test1</option>
150
- <option value=\"2\">test2</option></select><span data-connect=\"{&quot;events&quot;:&quot;click&quot;,&quot;mode&quot;:&quot;remote&quot;,&quot;target&quot;:{&quot;selector&quot;:&quot;#user_name_fr&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></div></form>"
150
+ <option value=\"2\">test2</option></select><span data-connect=\"{&quot;events&quot;:&quot;click&quot;,&quot;mode&quot;:&quot;remote&quot;,&quot;target&quot;:{&quot;selector&quot;:&quot;#user_name_fr&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></div></form>"
151
151
 
152
152
  assert_equal expected, actual
153
153
  end
@@ -59,7 +59,7 @@ class CardTest < ActionView::TestCase
59
59
  p.body 'state'
60
60
  p.footer 'state'
61
61
  end
62
- expected = '<div class="state card"><div class="card-header"><i class="glyph fas fa-eye"></i> state</div><div class="card-body">state</div><div class="card-footer">state</div></div>'
62
+ expected = "<div class=\"state card\"><div class=\"card-header\"><i class=\"glyph fas fa-eye\"></i> state</div><div class=\"card-body\">state</div><div class=\"card-footer\">state</div></div>"
63
63
 
64
64
  assert_equal expected, actual
65
65
  end
@@ -145,7 +145,7 @@ class CardTest < ActionView::TestCase
145
145
  end
146
146
  end
147
147
  end
148
- expected = "<div class=\"card\"><div class=\"card-header\"><ul class=\"nav nav-tabs card-header-tabs\"><li class=\"nav-item\"><a href=\"#link1\" class=\"nav-link\" data-toggle=\"tab\" role=\"tab\">link1</a></li><li class=\"nav-item\"><a href=\"#link2\" class=\"nav-link\" data-toggle=\"tab\" role=\"tab\">link2</a></li></ul></div></div>"
148
+ expected = "<div class=\"card\"><div class=\"card-header\"><ul class=\"nav nav-tabs card-header-tabs\" role=\"tablist\"><li class=\"nav-item\"><a href=\"#link1\" class=\"nav-link\" data-toggle=\"tab\" role=\"tab\">link1</a></li><li class=\"nav-item\"><a href=\"#link2\" class=\"nav-link\" data-toggle=\"tab\" role=\"tab\">link2</a></li></ul></div></div>"
149
149
 
150
150
  assert_equal expected, actual
151
151
  end
@@ -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
@@ -47,7 +47,7 @@ class ButtonGroupTest < ActionView::TestCase
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,8 +4,8 @@ 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
8
- expected = "<div class=\"form-check\"><input type=\"checkbox\" name=\"John\" id=\"John\" value=\"1\" class=\"form-check-input\" /><label class=\"form-check-label\" for=\"John\">John</label></div>"
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
9
 
10
10
  assert_equal expected, actual
11
11
  end
@@ -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', position: :up, alignement: :right, 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 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>"
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
@@ -6,7 +6,7 @@ class DropdownSelectFieldTest < ActionView::TestCase
6
6
  test 'Multi Select Field' do
7
7
  options = options_for_select(Array.new(2) { |i| "option #{i}" })
8
8
  actual = UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new('example', multiple: true, option_tags: options).render
9
- expected = "<select name=\"example[]\" id=\"example\" class=\"btn-secondary multi-select-field\" multiple=\"multiple\"><option value=\"option 0\">option 0</option>
9
+ expected = "<select name=\"example[]\" id=\"example\" data-dropdown-classes=\"dropdown\" 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
 
12
12
  assert_equal expected, actual
@@ -15,7 +15,7 @@ class DropdownSelectFieldTest < ActionView::TestCase
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
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>
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\" data-dropdown-classes=\"dropdown\" 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>"
@@ -25,7 +25,7 @@ class DropdownSelectFieldTest < ActionView::TestCase
25
25
 
26
26
  test 'Multi select Field refresh option' do
27
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>'
28
+ expected = "<div class=\"field-refresh input-group ui_surround_field\"><select name=\"test[]\" id=\"test\" data-dropdown-classes=\"dropdown\" 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\" data-dropdown-classes=\"dropdown\" 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,7 @@ 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 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>"
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
@@ -65,7 +65,7 @@ class NavTest < ActionView::TestCase
65
65
  n.link 'Profile', url: '#profile', selector: 'profile', label: 16
66
66
  n.link 'Messages', url: '#messages', selector: 'messages', state: :disabled
67
67
  end
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
+ 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>"
69
69
 
70
70
  assert_equal expected, actual
71
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
@@ -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 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>"
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 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>"
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 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>"
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 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>"
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