ui_bibz 3.0.0.alpha8 → 3.0.0.beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +1 -0
  3. data/Gemfile.lock +19 -16
  4. data/README.md +5 -1
  5. data/lib/ui_bibz/concerns/models/searchable.rb +1 -1
  6. data/lib/ui_bibz/infos.rb +4 -4
  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 +8 -2
  9. data/lib/ui_bibz/ui/core/boxes/components/card_body.rb +1 -1
  10. data/lib/ui_bibz/ui/core/boxes/components/card_image.rb +5 -1
  11. data/lib/ui_bibz/ui/core/forms/buttons/button.rb +5 -14
  12. data/lib/ui_bibz/ui/core/forms/buttons/button_link.rb +2 -3
  13. data/lib/ui_bibz/ui/core/forms/buttons/button_refresh.rb +0 -1
  14. data/lib/ui_bibz/ui/core/forms/dropdowns/dropdown.rb +5 -3
  15. data/lib/ui_bibz/ui/core/forms/dropdowns/split_dropdown.rb +1 -1
  16. data/lib/ui_bibz/ui/core/forms/numbers/formula_field.rb +1 -1
  17. data/lib/ui_bibz/ui/core/forms/numbers/slider_header.rb +2 -2
  18. data/lib/ui_bibz/ui/core/forms/selects/dropdown_select_field.rb +35 -5
  19. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button.rb +1 -7
  20. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button_link.rb +1 -7
  21. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_dropdown.rb +5 -4
  22. data/lib/ui_bibz/ui/core/icons/glyph.rb +9 -1
  23. data/lib/ui_bibz/ui/core/lists/list_group.rb +1 -1
  24. data/lib/ui_bibz/ui/core/navigations/components/nav_dropdown.rb +1 -1
  25. data/lib/ui_bibz/ui/core/navigations/components/nav_link_link.rb +2 -2
  26. data/lib/ui_bibz/ui/core/navigations/components/nav_link_span.rb +1 -1
  27. data/lib/ui_bibz/ui/core/navigations/components/nav_text.rb +1 -1
  28. data/lib/ui_bibz/ui/core/navigations/link.rb +1 -1
  29. data/lib/ui_bibz/ui/core/navigations/nav.rb +3 -3
  30. data/lib/ui_bibz/ui/core/navigations/navbar.rb +1 -1
  31. data/lib/ui_bibz/ui/core/navigations/tab_group.rb +5 -1
  32. data/lib/ui_bibz/ui/core/notifications/components/alert_header.rb +1 -1
  33. data/lib/ui_bibz/ui/core/notifications/components/toast_header.rb +16 -2
  34. data/lib/ui_bibz/ui/core/notifications/toast.rb +1 -1
  35. data/lib/ui_bibz/ui/core/windows/components/modal_header.rb +1 -1
  36. data/lib/ui_bibz/ui/extensions/core/component/glyph_extension.rb +9 -24
  37. data/lib/ui_bibz/ui/extensions/core/component/popover_extension.rb +7 -7
  38. data/lib/ui_bibz/ui/ux/tables/table_search_field.rb +1 -1
  39. data/test/simple_form_test.rb +5 -5
  40. data/test/ui/core/boxes/card_test.rb +2 -2
  41. data/test/ui/core/component_test.rb +2 -2
  42. data/test/ui/core/forms/buttons/button_group_test.rb +1 -1
  43. data/test/ui/core/forms/buttons/button_link_test.rb +2 -9
  44. data/test/ui/core/forms/buttons/button_refresh_test.rb +1 -1
  45. data/test/ui/core/forms/buttons/button_test.rb +8 -15
  46. data/test/ui/core/forms/choices/choice_group_test.rb +3 -3
  47. data/test/ui/core/forms/dropdowns/dropdown_test.rb +5 -5
  48. data/test/ui/core/forms/numbers/formula_field_test.rb +1 -1
  49. data/test/ui/core/forms/selects/multi_select_field_test.rb +3 -3
  50. data/test/ui/core/forms/selects/select_field_test.rb +1 -1
  51. data/test/ui/core/forms/surrounds/surround_field_test.rb +2 -2
  52. data/test/ui/core/forms/texts/auto_complete_field_test.rb +2 -2
  53. data/test/ui/core/lists/list_group_test.rb +1 -1
  54. data/test/ui/core/navigations/breadcrumb_test.rb +1 -1
  55. data/test/ui/core/navigations/link_test.rb +2 -2
  56. data/test/ui/core/navigations/nav_test.rb +2 -2
  57. data/test/ui/core/navigations/navbar_test.rb +4 -4
  58. data/test/ui/core/navigations/tab_group_test.rb +5 -5
  59. data/test/ui/core/notifications/alert_test.rb +1 -1
  60. data/test/ui/core/notifications/badge_test.rb +2 -2
  61. data/test/ui/core/notifications/toast_test.rb +1 -1
  62. data/test/ui/core/windows/modal_test.rb +2 -2
  63. data/test/ui/ux/containers/panel_test.rb +1 -1
  64. data/test/ui/ux/tables/table_test.rb +2 -2
  65. data/ui_bibz.gemspec +2 -1
  66. metadata +20 -6
@@ -1,11 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UiBibz::Ui::Core::Forms::Surrounds
4
- class SurroundButton < UiBibz::Ui::Core::Forms::Buttons::Button
5
- # See UiBibz::Ui::Core::Dropdown.initialize
6
-
7
- def pre_render
8
- button_html_tag
9
- end
10
- end
4
+ class SurroundButton < UiBibz::Ui::Core::Forms::Buttons::Button; end
11
5
  end
@@ -1,11 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UiBibz::Ui::Core::Forms::Surrounds
4
- class SurroundButtonLink < UiBibz::Ui::Core::Forms::Buttons::ButtonLink
5
- # See UiBibz::Ui::Core::Dropdown.initialize
6
-
7
- def pre_render
8
- button_link_html_tag
9
- end
10
- end
4
+ class SurroundButtonLink < UiBibz::Ui::Core::Forms::Buttons::ButtonLink; end
11
5
  end
@@ -4,10 +4,11 @@ module UiBibz::Ui::Core::Forms::Surrounds
4
4
  class SurroundDropdown < UiBibz::Ui::Core::Forms::Dropdowns::Dropdown
5
5
  # See UiBibz::Ui::Core::Dropdown.initialize
6
6
 
7
- private
8
-
9
- def component_html_classes
10
- super << 'input-group-btn'
7
+ def pre_render
8
+ capture do
9
+ concat button_html
10
+ concat ul_html
11
+ end
11
12
  end
12
13
  end
13
14
  end
@@ -61,7 +61,7 @@ module UiBibz::Ui::Core::Icons
61
61
 
62
62
  # Render html tag
63
63
  def pre_render
64
- [content_tag(:i, '', html_options), options[:label]].compact.join(' ').html_safe
64
+ [content_tag(:i, '', html_options), label].compact.join(' ').html_safe
65
65
  end
66
66
 
67
67
  private
@@ -138,5 +138,13 @@ module UiBibz::Ui::Core::Icons
138
138
  def match_style
139
139
  { solid: 'fas', regular: 'far', light: 'fal', brands: 'fab' }
140
140
  end
141
+
142
+ def label
143
+ if options[:text] == false
144
+ content_tag :span, options[:label], class: 'visually-hidden'
145
+ else
146
+ options[:label]
147
+ end
148
+ end
141
149
  end
142
150
  end
@@ -90,7 +90,7 @@ module UiBibz::Ui::Core::Lists
90
90
  options = options.merge({ tag_type: @options[:tag_type] }) unless @options[:tag_type].nil?
91
91
 
92
92
  @lists << if tapped?(block)
93
- content = (content || {}).merge(tap: true)
93
+ content = (content || {}).merge(options)
94
94
  UiBibz::Ui::Core::Lists::Components::List.new(content, options, html_options).tap(&block).render
95
95
  else
96
96
  UiBibz::Ui::Core::Lists::Components::List.new(content, options, html_options, &block).render
@@ -60,7 +60,7 @@ module UiBibz::Ui::Core::Navigations
60
60
  end
61
61
 
62
62
  def link_html
63
- content_tag :a, button_content, class: join_classes(size, state, 'dropdown-toggle', 'nav-link'), 'data-toggle' => 'dropdown', 'aria-expanded' => false
63
+ content_tag :a, button_content, class: join_classes(size, state, 'dropdown-toggle', 'nav-link'), href: '#', 'data-bs-toggle' => 'dropdown', 'aria-expanded' => false
64
64
  end
65
65
  end
66
66
  end
@@ -40,12 +40,12 @@ module UiBibz::Ui::Core::Navigations
40
40
  end
41
41
 
42
42
  def component_html_options
43
- html_tag_base = { 'data-toggle' => 'tab', role: 'tab' }
43
+ html_tag_base = { 'data-bs-toggle' => 'tab', role: 'tab' }
44
44
  case options[:nav_type]
45
45
  when 'nav-tabs'
46
46
  html_tag_base
47
47
  when 'list-group'
48
- html_tag_base.merge("aria-controls": sanitize_text(content))
48
+ html_tag_base.merge("aria-controls": sanitize_text(content).parameterize)
49
49
  else
50
50
  {}
51
51
  end.merge(options[:a_html] || {})
@@ -36,7 +36,7 @@ module UiBibz::Ui::Core::Navigations
36
36
  end
37
37
 
38
38
  def component_html_options
39
- { 'data-toggle' => 'tab', role: 'tab' }
39
+ { 'data-bs-toggle' => 'tab', role: 'tab' }
40
40
  end
41
41
 
42
42
  def component_html_data
@@ -40,7 +40,7 @@ module UiBibz::Ui::Core::Navigations
40
40
  end
41
41
 
42
42
  def component_html_options
43
- options[:nav_type] == 'nav-tabs' ? { 'data-toggle' => 'tab', role: 'tab' } : {}
43
+ options[:nav_type] == 'nav-tabs' ? { 'data-bs-toggle' => 'tab', role: 'tab' } : {}
44
44
  end
45
45
  end
46
46
  end
@@ -58,7 +58,7 @@ module UiBibz::Ui::Core::Navigations
58
58
  def collapse
59
59
  {
60
60
  role: 'button',
61
- data: { toggle: :collapse },
61
+ data: { "bs-toggle": :collapse },
62
62
  aria: {
63
63
  controls: options[:collapse],
64
64
  expanded: options[:active_collapse].nil? ? false : options[:active_collapse]
@@ -82,7 +82,7 @@ module UiBibz::Ui::Core::Navigations
82
82
  # Add nav link items
83
83
  # See UiBibz::Ui::Core::Navigations::NavLink
84
84
  def link(content = nil, options = {}, html_options = nil, &block)
85
- if block_given?
85
+ if block
86
86
  content[:nav_type] = type
87
87
  content[:nav_tags] = nav_tags
88
88
  else
@@ -93,7 +93,7 @@ module UiBibz::Ui::Core::Navigations
93
93
  end
94
94
 
95
95
  def text(content = nil, options = {}, html_options = nil, &block)
96
- block_given? ? content[:nav_type] = type : options[:nav_type] = type
96
+ block ? content[:nav_type] = type : options[:nav_type] = type
97
97
  @items << NavText.new(content, options, html_options, &block)
98
98
  end
99
99
 
@@ -120,7 +120,7 @@ module UiBibz::Ui::Core::Navigations
120
120
  end
121
121
 
122
122
  def component_html_options
123
- @options[:type] == :list ? { role: 'tablist' } : super
123
+ %i[tabs list].include?(@options[:type]) ? { role: 'tablist' } : super
124
124
  end
125
125
 
126
126
  # tabs or pills
@@ -163,7 +163,7 @@ module UiBibz::Ui::Core::Navigations
163
163
  end
164
164
 
165
165
  def navbar_toggle_button_html
166
- content_tag :button, '☰', class: 'navbar-toggler hidden-sm-up', type: :button, data: { toggle: 'collapse', target: "##{id}" }
166
+ content_tag :button, '☰', class: 'navbar-toggler hidden-sm-up', type: :button, data: { "bs-toggle": 'collapse', target: "##{id}" }
167
167
  end
168
168
 
169
169
  def expand_size
@@ -67,7 +67,7 @@ module UiBibz::Ui::Core::Navigations
67
67
  # Add nav link items
68
68
  # See UiBibz::Ui::Core::Navigations::NavLink
69
69
  def tab(content = nil, options = {}, html_options = nil, &block)
70
- if block_given?
70
+ if block
71
71
  content[:nav_type] = type
72
72
  content[:tag_type] = @options[:tag_type]
73
73
  else
@@ -83,6 +83,10 @@ module UiBibz::Ui::Core::Navigations
83
83
  ['nav', 'nav-tabs', position, justify, fill]
84
84
  end
85
85
 
86
+ def component_html_options
87
+ { role: 'tablist' }
88
+ end
89
+
86
90
  def type
87
91
  'nav-tabs'
88
92
  end
@@ -54,7 +54,7 @@ module UiBibz::Ui::Core::Notifications::Components
54
54
  end
55
55
 
56
56
  def close_html
57
- content_tag :button, '', type: 'button', class: 'btn-close', 'data-dismiss' => 'alert', 'aria-label' => 'Close'
57
+ content_tag :button, '', type: 'button', class: 'btn-close', 'data-bs-dismiss' => 'alert', 'aria-label' => 'Close'
58
58
  end
59
59
  end
60
60
  end
@@ -31,12 +31,13 @@ module UiBibz::Ui::Core::Notifications::Components
31
31
  # end.render
32
32
  #
33
33
  class ToastHeader < UiBibz::Ui::Core::Component
34
+ include Webpacker::Helper if defined?(Webpacker)
34
35
  # See UiBibz::Ui::Core::Component.initialize
35
36
 
36
37
  def pre_render
37
38
  content_tag :div, html_options do
38
39
  concat UiBibz::Ui::Core::Icons::Glyph.new(options[:glyph], class: 'mr-2').render unless options[:glyph].nil?
39
- concat image_tag(options[:img], class: 'rounded mr-2') unless options[:img].nil?
40
+ concat image unless options[:image].nil?
40
41
  concat content_tag(:strong, content, class: 'mr-auto')
41
42
  concat content_tag(:small, options[:time], class: 'text-muted') unless options[:time].nil?
42
43
  concat close_button
@@ -45,8 +46,21 @@ module UiBibz::Ui::Core::Notifications::Components
45
46
 
46
47
  private
47
48
 
49
+ def image
50
+ if options[:image].is_a?(String)
51
+ image_tag(options[:image], class: 'rounded mr-2', alt: sanitize_text(options[:image])) unless options[:image].nil?
52
+ else
53
+ options[:image][:class] = UiBibz::Utils::Screwdriver.join_classes(options[:image][:class], 'rounded mr-2')
54
+ if options[:image].delete(:pack)
55
+ image_pack_tag(options[:image].delete(:href), **options[:image])
56
+ else
57
+ image_tag(options[:image].delete(:href), **options[:image])
58
+ end
59
+ end
60
+ end
61
+
48
62
  def close_button
49
- content_tag :button, '', class: 'ml-2 mb-1 btn-close', "data-dismiss": 'toast', "aria-label": 'Close'
63
+ content_tag :button, '', class: 'ml-2 mb-1 btn-close', "data-bs-dismiss": 'toast', "aria-label": 'Close'
50
64
  end
51
65
 
52
66
  def component_html_classes
@@ -91,7 +91,7 @@ module UiBibz::Ui::Core::Notifications
91
91
 
92
92
  def component_html_data
93
93
  super
94
- add_html_data 'autohide', value: options[:auto_hide] if options[:auto_hide]
94
+ add_html_data 'bs-autohide', value: options[:auto_hide] if options[:auto_hide]
95
95
  end
96
96
 
97
97
  def status
@@ -48,7 +48,7 @@ module UiBibz::Ui::Core::Windows::Components
48
48
  end
49
49
 
50
50
  def close_button_html
51
- content_tag :button, '', class: 'btn-close', 'data-dismiss' => 'modal', 'aria-label' => 'Close'
51
+ content_tag :button, '', class: 'btn-close', 'data-bs-dismiss' => 'modal', 'aria-label' => 'Close'
52
52
  end
53
53
  end
54
54
  end
@@ -3,28 +3,11 @@
3
3
  module GlyphExtension
4
4
  # Render glyph and content html
5
5
  def glyph_and_content_html(content_html = nil)
6
- [glyph_with_space, ct_html(content_html)].compact.join(' ').html_safe
7
- end
8
-
9
- def ct_html(content_html)
10
- content_html || content if options[:text].nil? || options[:text] == true
11
- end
12
-
13
- # Render glyph with space html
14
- def glyph_with_space
15
- out = [glyph]
16
- out << if options[:text] == false
17
- content_tag(:span, ' ', class: 'empty-space')
18
- else
19
- ' '
20
- end
21
- out.join unless glyph.nil?
6
+ options[:glyph] ? generate_glyph(content_html) : content_html || content
22
7
  end
23
8
 
24
9
  # Render glyph html
25
- def glyph
26
- options[:content] = content if options[:text] == false
27
-
10
+ def generate_glyph(content_html)
28
11
  glyph_options = if options[:glyph].is_a?(Hash)
29
12
  options[:glyph]
30
13
  elsif options[:glyph]
@@ -33,11 +16,13 @@ module GlyphExtension
33
16
  {}
34
17
  end
35
18
 
36
- glyph_options[:text] = options[:text] unless options[:text].nil?
37
- glyph_options[:content] = options[:content] unless options[:content].nil?
38
- glyph_options[:shortcut] = options[:shortcut] unless options[:shortcut].nil?
39
- glyph_options[:html_options] = options[:html_options] unless options[:html_options].nil?
19
+ glyph_options = glyph_options.tap do |h|
20
+ h[:text] = options[:text]
21
+ h[:label] = options[:label] || content_html || content
22
+ h[:shortcut] = options[:shortcut] unless options[:shortcut].nil?
23
+ end
40
24
 
41
- UiBibz::Utils::GlyphChanger.new(glyph_options[:name], glyph_options).render unless glyph_options[:name].nil?
25
+ # UiBibz::Utils::GlyphChanger.new(glyph_options[:name], glyph_options).render unless glyph_options[:name].nil?
26
+ UiBibz::Ui::Core::Icons::Glyph.new(glyph_options[:name], glyph_options).render if glyph_options[:name].present?
42
27
  end
43
28
  end
@@ -4,31 +4,31 @@ module PopoverExtension
4
4
  TOOLTIP_METHODS = %i[animation container delay html placement selector template title trigger
5
5
  offset fallback_placement boundary sanitize white_list santitize_fn].freeze
6
6
 
7
- POPOVER_METHODS = %i[animation container content delay html placement selector template title
7
+ POPOVER_METHODS = %i[animation container delay html placement selector template title
8
8
  trigger offset fallback_placement boundary sanitize white_list sanitize_fn].freeze
9
9
 
10
10
  def popover_data_html
11
11
  if options[:popover].present?
12
- add_html_data :toggle, value: 'popover'
13
- add_html_data :content, value: (options[:popover].is_a?(String) ? options[:popover] : options[:popover][:content])
12
+ add_html_data 'bs-toggle', value: 'popover'
13
+ add_html_data 'bs-content', value: (options[:popover].is_a?(String) ? options[:popover] : options[:popover][:content])
14
14
  end
15
15
 
16
16
  return unless options[:popover].is_a?(Hash)
17
17
 
18
18
  POPOVER_METHODS.each { |mth| add_html_data(mth, value: options[:popover].try(:[], mth)) unless options[:popover].try(:[], mth).nil? }
19
- add_html_data :placement, value: options[:popover].try(:[], :position) unless options[:popover].try(:[], :position).nil?
19
+ add_html_data 'bs-placement', value: options[:popover].try(:[], :position) unless options[:popover].try(:[], :position).nil?
20
20
  end
21
21
 
22
22
  def tooltip_data_html
23
23
  return if options[:tooltip].nil?
24
24
 
25
- add_html_data :toggle, value: 'tooltip'
25
+ add_html_data 'bs-toggle', value: 'tooltip'
26
26
 
27
27
  if options[:tooltip].is_a?(Hash)
28
28
  TOOLTIP_METHODS.each { |mth| add_html_data(mth, value: options[:tooltip].try(:[], mth)) unless options[:tooltip].try(:[], mth).nil? }
29
- add_html_data :placement, value: options[:tooltip].try(:[], :position) unless options[:tooltip].try(:[], :position).nil?
29
+ add_html_data 'bs-placement', value: options[:tooltip].try(:[], :position) unless options[:tooltip].try(:[], :position).nil?
30
30
  else
31
- add_html_data :title, value: options[:tooltip]
31
+ add_html_data :title, value: options[:tooltip] == true ? sanitize_text(content) : options[:tooltip]
32
32
  end
33
33
  end
34
34
  end
@@ -69,7 +69,7 @@ module UiBibz::Ui::Ux::Tables
69
69
  end
70
70
 
71
71
  def clear_button
72
- content_tag :button, UiBibz::Ui::Core::Icons::Glyph.new('times-circle').render, type: :button, class: 'btn btn-secondary input-group-btn clear-search-btn'
72
+ content_tag :button, UiBibz::Ui::Core::Icons::Glyph.new('times-circle', text: false, label: 'Clear Search').render, type: :button, class: 'btn btn-secondary input-group-btn clear-search-btn'
73
73
  end
74
74
 
75
75
  def component_html_classes
@@ -50,7 +50,7 @@ class SimpleFormTest < ActionView::TestCase
50
50
  f.input :price, as: :ui_formula_field
51
51
  end
52
52
 
53
- 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_formula_field optional user_price"><label class="control-label ui_formula_field optional" for="user_price">Price</label><div class="formula_field input-group ui_surround_field"><input type="text" name="user[price_formula]" id="user_price_formula" value="1+2" class="ui_formula_field optional formula-field form-control" formula_field_value="1+2" /><span class="formula-field-sign input-group-text">=</span><input type="text" name="user[price]" id="user_price" value="3.0" class="formula-field-result form-control" readonly="readonly" /><span data-toggle="tooltip" class="formula-field-alert input-group-text"><i class="glyph-danger glyph fas fa-exclamation-triangle"></i></span></div></div></form>'
53
+ 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_formula_field optional user_price"><label class="control-label ui_formula_field optional" for="user_price">Price</label><div class="formula_field input-group ui_surround_field"><input type="text" name="user[price_formula]" id="user_price_formula" value="1+2" class="ui_formula_field optional formula-field form-control" formula_field_value="1+2" /><span class="formula-field-sign input-group-text">=</span><input type="text" name="user[price]" id="user_price" value="3.0" class="formula-field-result form-control" readonly="readonly" /><span data-bs-toggle="tooltip" class="formula-field-alert input-group-text"><i class="glyph-danger glyph fas fa-exclamation-triangle"></i></span></div></div></form>'
54
54
 
55
55
  assert_equal expected, actual
56
56
  end
@@ -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-bs-toggle=\"tab\" role=\"tab\">link1</a></li><li class=\"nav-item\"><a href=\"#link2\" class=\"nav-link\" data-bs-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-bs-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