ui_bibz 2.0.0.alpha32 → 2.0.0.beta2

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 (160) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -1
  3. data/Gemfile.lock +111 -87
  4. data/app/assets/javascripts/form.coffee +24 -8
  5. data/app/assets/javascripts/ui_bibz.coffee +3 -2
  6. data/app/assets/stylesheets/bootstrap-switch.sass +17 -8
  7. data/app/assets/stylesheets/fix-dropdown-select.sass +1 -1
  8. data/app/assets/stylesheets/table.sass +1 -1
  9. data/app/assets/stylesheets/ui_bibz.sass +60 -22
  10. data/app/inputs/ui_bibz_form/ui_bibz_form_builder.rb +35 -0
  11. data/app/inputs/ui_bibz_inputs/auto_complete_field_input.rb +14 -0
  12. data/app/inputs/{custom_inputs → ui_bibz_inputs}/base_input.rb +7 -1
  13. data/app/inputs/{custom_inputs → ui_bibz_inputs}/collection_input.rb +6 -3
  14. data/app/inputs/{custom_inputs → ui_bibz_inputs}/string_input.rb +5 -1
  15. data/app/inputs/ui_bibz_inputs/ui_auto_complete_field_input.rb +14 -0
  16. data/app/inputs/ui_bibz_inputs/ui_button_choices_input.rb +20 -0
  17. data/app/inputs/{custom_inputs/date_picker_field_input.rb → ui_bibz_inputs/ui_date_picker_field_input.rb} +2 -2
  18. data/app/inputs/{custom_inputs/dropdown_select_field_input.rb → ui_bibz_inputs/ui_dropdown_select_field_input.rb} +2 -2
  19. data/app/inputs/{custom_inputs/formula_field_input.rb → ui_bibz_inputs/ui_formula_field_input.rb} +2 -2
  20. data/app/inputs/{custom_inputs/markdown_editor_field_input.rb → ui_bibz_inputs/ui_markdown_editor_field_input.rb} +2 -2
  21. data/app/inputs/{custom_inputs/multi_column_field_input.rb → ui_bibz_inputs/ui_multi_column_field_input.rb} +2 -2
  22. data/app/inputs/ui_bibz_inputs/ui_multi_select_field_input.rb +9 -0
  23. data/app/inputs/{custom_inputs/radio_field_input.rb → ui_bibz_inputs/ui_radio_field_input.rb} +2 -2
  24. data/app/inputs/{custom_inputs/select_field_input.rb → ui_bibz_inputs/ui_select_field_input.rb} +2 -2
  25. data/app/inputs/{custom_inputs/switch_field_input.rb → ui_bibz_inputs/ui_switch_field_input.rb} +2 -2
  26. data/app/inputs/ui_bibz_inputs/ui_text_field_input.rb +13 -0
  27. data/config/initializers/ui_bibz.rb +7 -0
  28. data/lib/ui_bibz/helpers/ui/core/cards_helper.rb +42 -0
  29. data/lib/ui_bibz/helpers/ui/core/dropdowns_helper.rb +21 -0
  30. data/lib/ui_bibz/helpers/ui/core/forms_helper.rb +148 -0
  31. data/lib/ui_bibz/helpers/ui/core/layouts_helper.rb +27 -0
  32. data/lib/ui_bibz/helpers/ui/core/lists_helper.rb +11 -0
  33. data/lib/ui_bibz/helpers/ui/core/navs_helper.rb +27 -0
  34. data/lib/ui_bibz/helpers/ui/core/paths_helper.rb +16 -0
  35. data/lib/ui_bibz/helpers/ui/core/windows_helper.rb +11 -0
  36. data/lib/ui_bibz/helpers/ui/core_helper.rb +89 -0
  37. data/lib/ui_bibz/helpers/{ui_ux_helper.rb → ui/ux_helper.rb} +8 -18
  38. data/lib/ui_bibz/helpers/utils_helper.rb +22 -1
  39. data/lib/ui_bibz/rails/engine.rb +6 -2
  40. data/lib/ui_bibz/ui/base.rb +4 -0
  41. data/lib/ui_bibz/ui/core/{tag.rb → badge.rb} +10 -10
  42. data/lib/ui_bibz/ui/core/cards/card.rb +37 -13
  43. data/lib/ui_bibz/ui/core/cards/components/{block/card_block_link.rb → body/card_body_link.rb} +6 -6
  44. data/lib/ui_bibz/ui/core/cards/components/{block/card_block_text.rb → body/card_body_text.rb} +6 -6
  45. data/lib/ui_bibz/ui/core/cards/components/{block/card_block_title.rb → body/card_body_title.rb} +6 -6
  46. data/lib/ui_bibz/ui/core/cards/components/{card_block.rb → card_body.rb} +17 -13
  47. data/lib/ui_bibz/ui/core/cards/components/card_footer.rb +5 -1
  48. data/lib/ui_bibz/ui/core/cards/components/card_header.rb +5 -1
  49. data/lib/ui_bibz/ui/core/cards/components/card_image.rb +3 -2
  50. data/lib/ui_bibz/ui/core/component.rb +8 -6
  51. data/lib/ui_bibz/ui/core/dropdowns/dropdown.rb +21 -5
  52. data/lib/ui_bibz/ui/core/forms/buttons/button.rb +37 -8
  53. data/lib/ui_bibz/ui/core/forms/buttons/button_choice.rb +17 -29
  54. data/lib/ui_bibz/ui/core/forms/buttons/button_group.rb +51 -11
  55. data/lib/ui_bibz/ui/core/forms/buttons/button_link.rb +18 -5
  56. data/lib/ui_bibz/ui/core/forms/buttons/button_refresh.rb +13 -4
  57. data/lib/ui_bibz/ui/core/forms/buttons/button_toolbar.rb +90 -0
  58. data/lib/ui_bibz/ui/core/forms/buttons/components/choice.rb +116 -0
  59. data/lib/ui_bibz/ui/core/forms/choices/checkbox_field.rb +21 -8
  60. data/lib/ui_bibz/ui/core/forms/choices/radio_field.rb +22 -9
  61. data/lib/ui_bibz/ui/core/forms/choices/switch_field.rb +17 -5
  62. data/lib/ui_bibz/ui/core/forms/dates/date_picker_field.rb +36 -16
  63. data/lib/ui_bibz/ui/core/forms/numbers/formula_field.rb +20 -19
  64. data/lib/ui_bibz/ui/core/forms/selects/abstract_select.rb +99 -0
  65. data/lib/ui_bibz/ui/core/forms/selects/dropdown_select_field.rb +16 -16
  66. data/lib/ui_bibz/ui/core/forms/selects/multi_column_field.rb +8 -13
  67. data/lib/ui_bibz/ui/core/forms/selects/multi_select_field.rb +17 -18
  68. data/lib/ui_bibz/ui/core/forms/selects/select_field.rb +8 -20
  69. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_addon.rb +25 -0
  70. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button.rb +16 -0
  71. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button_group.rb +16 -0
  72. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button_link.rb +16 -0
  73. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button_refresh.rb +16 -0
  74. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_checkbox_field.rb +16 -0
  75. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_dropdown.rb +16 -0
  76. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_radio_field.rb +16 -0
  77. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_switch_field.rb +16 -0
  78. data/lib/ui_bibz/ui/core/forms/surrounds/surround_field.rb +153 -0
  79. data/lib/ui_bibz/ui/core/forms/texts/auto_complete_field.rb +13 -38
  80. data/lib/ui_bibz/ui/core/forms/texts/text_field.rb +81 -0
  81. data/lib/ui_bibz/ui/core/glyph.rb +1 -1
  82. data/lib/ui_bibz/ui/core/layouts/col.rb +10 -2
  83. data/lib/ui_bibz/ui/core/layouts/row.rb +7 -1
  84. data/lib/ui_bibz/ui/core/lists/components/list/list_body.rb +4 -2
  85. data/lib/ui_bibz/ui/core/lists/components/list/list_header.rb +5 -2
  86. data/lib/ui_bibz/ui/core/lists/components/list.rb +35 -14
  87. data/lib/ui_bibz/ui/core/lists/list_group.rb +4 -4
  88. data/lib/ui_bibz/ui/core/navs/components/navbar_form.rb +7 -2
  89. data/lib/ui_bibz/ui/core/navs/components/navbar_nav.rb +4 -0
  90. data/lib/ui_bibz/ui/core/navs/components/navbar_text.rb +1 -1
  91. data/lib/ui_bibz/ui/core/navs/components/pagination_link.rb +60 -0
  92. data/lib/ui_bibz/ui/core/navs/nav.rb +31 -3
  93. data/lib/ui_bibz/ui/core/navs/navbar.rb +32 -22
  94. data/lib/ui_bibz/ui/core/navs/pagination.rb +97 -0
  95. data/lib/ui_bibz/ui/core/{alert.rb → notifications/alert.rb} +23 -11
  96. data/lib/ui_bibz/ui/core/notifications/components/alert_body.rb +50 -0
  97. data/lib/ui_bibz/ui/core/notifications/components/alert_header.rb +67 -0
  98. data/lib/ui_bibz/ui/core/{progress.rb → progresses/components/bar.rb} +21 -28
  99. data/lib/ui_bibz/ui/core/progresses/progress_bar.rb +115 -0
  100. data/lib/ui_bibz/ui/core/windows/components/modal_header.rb +1 -1
  101. data/lib/ui_bibz/ui/{core → extensions/core}/component/glyph_extension.rb +2 -2
  102. data/lib/ui_bibz/ui/{core → extensions/core}/component/klass_extension.rb +1 -2
  103. data/lib/ui_bibz/ui/extensions/core/forms/connect_extension.rb +31 -0
  104. data/lib/ui_bibz/ui/extensions/core/forms/surround_extension.rb +48 -0
  105. data/lib/ui_bibz/utils/internationalization.rb +9 -0
  106. data/lib/ui_bibz/version.rb +1 -1
  107. data/lib/ui_bibz.rb +23 -7
  108. data/test/simple_form_test.rb +58 -41
  109. data/test/ui/core/badge_test.rb +19 -0
  110. data/test/ui/core/cards/card_test.rb +34 -35
  111. data/test/ui/{component_test.rb → core/component_test.rb} +0 -1
  112. data/test/ui/core/dropdowns/dropdown_test.rb +5 -5
  113. data/test/ui/core/forms/buttons/button_choice_test.rb +23 -7
  114. data/test/ui/core/forms/buttons/button_group_test.rb +35 -17
  115. data/test/ui/core/forms/buttons/button_link_test.rb +74 -4
  116. data/test/ui/core/forms/buttons/button_refresh_test.rb +1 -2
  117. data/test/ui/core/forms/buttons/button_test.rb +66 -3
  118. data/test/ui/core/forms/choices/checkbox_field_test.rb +1 -2
  119. data/test/ui/core/forms/choices/radio_field_test.rb +1 -2
  120. data/test/ui/core/forms/choices/switch_field_test.rb +0 -1
  121. data/test/ui/core/forms/dates/date_picker_field_test.rb +2 -3
  122. data/test/ui/core/forms/numbers/formula_field_test.rb +1 -2
  123. data/test/ui/core/forms/selects/dropdown_select_field_test.rb +1 -2
  124. data/test/ui/core/forms/selects/multi_column_field_test.rb +0 -1
  125. data/test/ui/core/forms/selects/multi_select_field_test.rb +1 -2
  126. data/test/ui/core/forms/selects/select_field_test.rb +1 -2
  127. data/test/ui/core/forms/surrounds/surround_field_test.rb +58 -0
  128. data/test/ui/core/forms/textareas/markdown_editor_field_test.rb +0 -1
  129. data/test/ui/core/forms/texts/auto_complete_field_test.rb +21 -4
  130. data/test/ui/core/forms/texts/text_field_test.rb +25 -0
  131. data/test/ui/{glyph_test.rb → core/glyph_test.rb} +5 -5
  132. data/test/ui/core/jumbotron_test.rb +20 -0
  133. data/test/ui/core/layouts/col_test.rb +31 -0
  134. data/test/ui/core/layouts/container_test.rb +13 -0
  135. data/test/ui/core/layouts/row_test.rb +24 -0
  136. data/test/ui/core/lists/list_group_test.rb +5 -4
  137. data/test/ui/core/navs/nav_test.rb +4 -5
  138. data/test/ui/core/navs/navbar_test.rb +39 -0
  139. data/test/ui/core/notifications/alert_test.rb +22 -0
  140. data/test/ui/core/paths/breadcrumb_test.rb +15 -4
  141. data/test/ui/core/progress_test.rb +14 -0
  142. data/test/ui/{star_test.rb → core/star_test.rb} +6 -7
  143. data/test/ui/core/windows/modal_test.rb +20 -0
  144. data/test/ui/ux/tables/table_test.rb +2 -3
  145. data/ui_bibz.gemspec +2 -1
  146. data/vendor/assets/javascripts/bootstrap-select.min.js +8 -7
  147. data/vendor/assets/stylesheets/awesome-bootstrap-checkbox.scss +62 -42
  148. data/vendor/assets/stylesheets/bootstrap-multiselect.min.css +1 -1
  149. data/vendor/assets/stylesheets/bootstrap-select.min.css +3 -3
  150. data/vendor/assets/stylesheets/bootstrap-theme.min.css +1 -1
  151. metadata +105 -44
  152. data/app/inputs/custom_inputs/auto_complete_field_input.rb +0 -16
  153. data/app/inputs/custom_inputs/multi_select_field_input.rb +0 -9
  154. data/app/inputs/custom_inputs/surround_field_input.rb +0 -10
  155. data/lib/ui_bibz/helpers/ui_core_helper.rb +0 -347
  156. data/lib/ui_bibz/ui/core/connected_component.rb +0 -87
  157. data/lib/ui_bibz/ui/core/forms/texts/surround_field.rb +0 -87
  158. data/test/ui/core/forms/texts/surround_field_test.rb +0 -26
  159. data/test/ui/grid_test.rb +0 -31
  160. data/test/ui_helper_test.rb +0 -109
@@ -1,21 +1,21 @@
1
1
  require 'test_helper'
2
- include UiBibz::Helpers
3
- include UiBibz::Helpers::UiCoreHelper
2
+
4
3
  class CardTest < ActionView::TestCase
4
+ include UiBibz::Helpers::Ui::CoreHelper
5
5
 
6
6
  test 'create card' do
7
- actual = card do
7
+ actual = ui_card do
8
8
  'test'
9
9
  end
10
- expected = "<div class=\"card card-block\">test</div>"
10
+ expected = "<div class=\"card\"><div class=\"card-body\">test</div></div>"
11
11
 
12
12
  assert_equal expected, actual
13
13
  end
14
14
 
15
- test 'create card with image, list and block' do
16
- actual = card(tap: true) do |c|
15
+ test 'create card with image, list and body' do
16
+ actual = ui_card(tap: true) do |c|
17
17
  c.image 'image.svg'
18
- c.block do
18
+ c.body do
19
19
  "test"
20
20
  end
21
21
  c.list_group do |lg|
@@ -23,82 +23,81 @@ class CardTest < ActionView::TestCase
23
23
  lg.list "Dapibas ac facilisis in"
24
24
  lg.list "vestibulum at eros"
25
25
  end
26
- c.block do
26
+ c.body do
27
27
  link_to "Card link", '#', class: "card-link"
28
28
  link_to "Card link", '#', class: "card-link"
29
29
  end
30
30
  end
31
- expected = "<div class=\"card\"><img src=\"/assets/image.svg\" alt=\"Image\" /><div class=\"card-block\">test</div><ul class=\"list-group-flush list-group\"><li class=\"list-group-item\">Cras justo odio</li><li class=\"list-group-item\">Dapibas ac facilisis in</li><li class=\"list-group-item\">vestibulum at eros</li></ul><div class=\"card-block\"><a class=\"card-link\" href=\"#\">Card link</a></div></div>"
31
+ expected = "<div class=\"card\"><div class=\"card-body\"></div><img src=\"/images/image.svg\" alt=\"Image\" /><div class=\"card-body\">test</div><ul class=\"list-group-flush list-group\"><li class=\"list-group-item\">Cras justo odio</li><li class=\"list-group-item\">Dapibas ac facilisis in</li><li class=\"list-group-item\">vestibulum at eros</li></ul><div class=\"card-body\"><a class=\"card-link\" href=\"#\">Card link</a></div></div>"
32
32
 
33
33
  assert_equal expected, actual
34
34
  end
35
35
 
36
- test 'create card with header, block and footer' do
37
- actual = card(status: :danger, tap: true, class: 'state') do |p|
36
+ test 'create card with header, body and footer' do
37
+ actual = ui_card(status: :danger, tap: true, class: 'state') do |p|
38
38
  p.header 'state', glyph: 'eye'
39
- p.block 'state'
39
+ p.body 'state'
40
40
  p.footer 'state'
41
41
  end
42
- expected = "<div class=\"card-danger state card\"><div class=\"card-header\"><i class=\"glyph fa fa-eye\"></i> state</div><div class=\"card-block\">state</div><div class=\"card-footer\">state</div></div>"
42
+ expected = "<div class=\"card-danger state card\"><div class=\"card-body\"></div><div class=\"card-header\"><i class=\"glyph fa fa-eye\"></i> state</div><div class=\"card-body\">state</div><div class=\"card-footer\">state</div></div>"
43
43
 
44
44
  assert_equal expected, actual
45
45
  end
46
46
 
47
47
  test 'create card group' do
48
- actual = card_group do |cg|
49
- cg.card 'test 1', block: true
50
- cg.card 'test 2', block: true
51
- cg.card 'test 3', block: true
48
+ actual = ui_card_group do |cg|
49
+ cg.card 'test 1', body: true
50
+ cg.card 'test 2', body: true
51
+ cg.card 'test 3', body: true
52
52
  end
53
- expected = "<div class=\"card-group\"><div class=\"card card-block\">test 1</div><div class=\"card card-block\">test 2</div><div class=\"card card-block\">test 3</div></div>"
53
+ expected = "<div class=\"card-group\"><div class=\"card\"><div class=\"card-body\">test 1</div></div><div class=\"card\"><div class=\"card-body\">test 2</div></div><div class=\"card\"><div class=\"card-body\">test 3</div></div></div>"
54
54
 
55
55
  assert_equal expected, actual
56
56
  end
57
57
 
58
58
  test 'create card deck' do
59
- actual = card_deck do |cg|
60
- cg.card 'test 1', block: true
61
- cg.card 'test 2', block: true
62
- cg.card 'test 3', block: true
59
+ actual = ui_card_deck do |cg|
60
+ cg.card 'test 1', body: true
61
+ cg.card 'test 2', body: true
62
+ cg.card 'test 3', body: true
63
63
  end
64
- expected = "<div class=\"card-deck-wrapper\"><div class=\"card-deck\"><div class=\"card card-block\">test 1</div><div class=\"card card-block\">test 2</div><div class=\"card card-block\">test 3</div></div></div>"
65
-
64
+ expected = "<div class=\"card-deck-wrapper\"><div class=\"card-deck\"><div class=\"card\"><div class=\"card-body\">test 1</div></div><div class=\"card\"><div class=\"card-body\">test 2</div></div><div class=\"card\"><div class=\"card-body\">test 3</div></div></div></div>"
66
65
  assert_equal expected, actual
67
66
  end
68
67
 
69
68
  test 'create card column' do
70
- actual = card_column do |cg|
71
- cg.card 'test 1', block: true
72
- cg.card 'test 2', block: true
73
- cg.card 'test 3', block: true
69
+ actual = ui_card_column do |cg|
70
+ cg.card 'test 1', body: true
71
+ cg.card 'test 2', body: true
72
+ cg.card 'test 3', body: true
74
73
  end
75
- expected = "<div class=\"card-columns\"><div class=\"card card-block\">test 1</div><div class=\"card card-block\">test 2</div><div class=\"card card-block\">test 3</div></div>"
74
+ expected = "<div class=\"card-columns\"><div class=\"card\"><div class=\"card-body\">test 1</div></div><div class=\"card\"><div class=\"card-body\">test 2</div></div><div class=\"card\"><div class=\"card-body\">test 3</div></div></div>"
76
75
 
77
76
  assert_equal expected, actual
78
77
  end
79
78
 
80
79
  test 'card list group' do
81
- actual = card tap: true do |c|
80
+ actual = ui_card tap: true do |c|
82
81
  c.list_group do |lg|
83
82
  lg.list "list 1"
84
83
  lg.list "list 2"
85
84
  lg.list "list 3"
86
85
  end
87
86
  end
88
- expected = "<div class=\"card\"><ul class=\"list-group-flush list-group\"><li class=\"list-group-item\">list 1</li><li class=\"list-group-item\">list 2</li><li class=\"list-group-item\">list 3</li></ul></div>"
87
+ expected = "<div class=\"card\"><div class=\"card-body\"></div><ul class=\"list-group-flush list-group\"><li class=\"list-group-item\">list 1</li><li class=\"list-group-item\">list 2</li><li class=\"list-group-item\">list 3</li></ul></div>"
89
88
 
90
89
  assert_equal expected, actual
91
90
  end
92
91
 
93
- test 'card block parameters' do
94
- actual = card tap: true do |c|
95
- c.block tap: true do |b|
92
+ test 'card body parameters' do
93
+ actual = ui_card tap: true do |c|
94
+ c.body tap: true do |b|
96
95
  b.title "title"
97
96
  b.text "text"
98
97
  b.link 'link', url: '#'
99
98
  end
100
99
  end
101
- expected = "<div class=\"card\"><div class=\"card-block\"><h4 class=\"card-title\">title</h4><p class=\"card-text\">text</p><a class=\"card-link\" href=\"#\">link</a></div></div>"
100
+ expected = "<div class=\"card\"><div class=\"card-body\"></div><div class=\"card-body\"><h4 class=\"card-title\">title</h4><p class=\"card-text\">text</p><a class=\"card-link\" href=\"#\">link</a></div></div>"
102
101
 
103
102
  assert_equal expected, actual
104
103
  end
@@ -1,6 +1,5 @@
1
1
  require 'test_helper'
2
2
 
3
- include UiBibz::Helpers
4
3
  class ComponentTest < ActionView::TestCase
5
4
 
6
5
  test 'create complex component' do
@@ -1,28 +1,28 @@
1
1
  require 'test_helper'
2
- include UiBibz::Helpers
3
2
  class DropdownTest < ActionView::TestCase
3
+ include UiBibz::Helpers::Ui::CoreHelper
4
4
 
5
5
  test 'Dropdown' do
6
- actual = UiBibz::Ui::Core::Dropdowns::Dropdown.new("Dropdown", type: :dropup, status: :success).tap do |d|
6
+ actual = ui_dropdown("Dropdown", type: :dropup, status: :success) do |d|
7
7
  d.link 'Link 1', url: '#link1', glyph: 'eye'
8
8
  d.header 'header'
9
9
  d.link 'Link 2', url: '#link2'
10
10
  d.divider
11
11
  d.link 'Link3', url: '#link3'
12
- end.render
12
+ end
13
13
  expected = "<div class=\"dropup btn-group\"><button class=\"btn btn-success dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\">Dropdown <span class=\"caret\"></span></button><div class=\"dropdown-menu dropdown-menu-left\"><a class=\"dropdown-item\" href=\"#link1\"><i class=\"glyph fa 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>"
14
14
 
15
15
  assert_equal expected, actual
16
16
  end
17
17
 
18
18
  test 'Split Dropdown' do
19
- actual = UiBibz::Ui::Core::Dropdowns::SplitDropdown.new("Split Dropdown", type: :dropup, status: :primary).tap do |d|
19
+ actual = ui_dropdown("Split Dropdown", type: :dropup, status: :primary) do |d|
20
20
  d.link 'state'
21
21
  d.header 'header'
22
22
  d.link 'momo'
23
23
  d.divider
24
24
  d.link 'lolo'
25
- end.render
25
+ end
26
26
  expected = "<div class=\"btn-group dropup\"><button class=\"btn btn-primary\">Split Dropdown</button><button class=\"btn btn-primary dropdown-toggle dropdown-toggle-split\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\"><span class=\"sr-only\">Toggle Dropdown</span></button><div class=\"dropdown-menu dropdown-menu-left\"><a class=\"dropdown-item\" href=\"#\">state</a><h6 class=\"dropdown-header\" role=\"presentation\">header</h6><a class=\"dropdown-item\" href=\"#\">momo</a><div class=\"dropdown-divider\"></div><a class=\"dropdown-item\" href=\"#\">lolo</a></div></div>"
27
27
 
28
28
  assert_equal expected, actual
@@ -1,18 +1,34 @@
1
1
  require 'test_helper'
2
- include UiBibz::Helpers
3
2
 
4
3
  class ButtonChoiceTest < ActionView::TestCase
4
+ include UiBibz::Helpers::Ui::CoreHelper
5
5
 
6
- test 'checkbox button checked' do
7
- actual = UiBibz::Ui::Core::Forms::Buttons::ButtonChoice.new('state', { state: :active }).render
8
- expected = "<label class=\"active btn-primary btn\"><input type=\"checkbox\" autocomplete=\"off\" checked=\"checked\" />state</label>"
6
+ test 'Button choice checkbox' do
7
+ actual = ui_button_choice do |bc|
8
+ bc.button 'Checkbox 1'
9
+ bc.button 'Checkbox 2', state: :active
10
+ end
11
+ expected = "<div data-toggle=\"buttons\" class=\"btn-group\"><label class=\"btn-secondary btn\"><input type=\"checkbox\" autocomplete=\"off\" />Checkbox 1</label><label class=\"active btn-secondary btn\" aria-pressed=\"true\"><input type=\"checkbox\" autocomplete=\"off\" checked=\"checked\" />Checkbox 2</label></div>"
9
12
 
10
13
  assert_equal expected, actual
11
14
  end
12
15
 
13
- test 'checkbox button non checked' do
14
- actual = UiBibz::Ui::Core::Forms::Buttons::ButtonChoice.new('state', { name: 'state', id: 'state', input_html_options: { class: 'state'}}).render
15
- expected = "<label class=\"btn-primary btn\"><input type=\"checkbox\" autocomplete=\"off\" name=\"state\" id=\"state\" class=\"state\" />state</label>"
16
+ test 'Button choice radio' do
17
+ actual = ui_button_choice type: :radio do |bc|
18
+ bc.button 'Radio 1'
19
+ bc.button 'Radio 2', state: :active
20
+ end
21
+ expected = "<div data-toggle=\"buttons\" class=\"btn-group\"><label class=\"btn-secondary btn\"><input type=\"radio\" autocomplete=\"off\" />Radio 1</label><label class=\"active btn-secondary btn\" aria-pressed=\"true\"><input type=\"radio\" autocomplete=\"off\" checked=\"checked\" />Radio 2</label></div>"
22
+
23
+ assert_equal expected, actual
24
+ end
25
+
26
+ test 'Button choice options' do
27
+ actual = ui_button_choice size: :lg, outline: true, type: :radio do |bc|
28
+ bc.button 'Radio 1', glyph: 'diamond', status: :primary
29
+ bc.button 'Radio 2', state: :active
30
+ end
31
+ expected = "<div data-toggle=\"buttons\" class=\"btn-group btn-group-lg\"><label class=\"btn-primary btn btn-lg\"><input type=\"radio\" autocomplete=\"off\" /><i class=\"glyph fa fa-diamond\"></i> Radio 1</label><label class=\"active btn-secondary btn btn-lg\" aria-pressed=\"true\"><input type=\"radio\" autocomplete=\"off\" checked=\"checked\" />Radio 2</label></div>"
16
32
 
17
33
  assert_equal expected, actual
18
34
  end
@@ -1,33 +1,51 @@
1
1
  require 'test_helper'
2
- include UiBibz::Helpers
3
2
 
4
3
  class ButtonGroupTest < ActionView::TestCase
4
+ include UiBibz::Helpers::Ui::CoreHelper
5
5
 
6
6
  test 'button group' do
7
- actual = UiBibz::Ui::Core::Forms::Buttons::ButtonGroup.new position: :vertical do
8
- UiBibz::Ui::Core::Forms::Buttons::Button.new('state').render
9
- end.render
10
- expected = "<div data-toggle=\"buttons\" class=\"btn-group btn-group-vertical\" role=\"group\"><button class=\"btn-primary btn\">state</button></div>"
7
+ actual = ui_button_group do |bg|
8
+ bg.button 'state'
9
+ end
10
+ expected = "<div class=\"btn-group\" role=\"group\"><button class=\"btn\">state</button></div>"
11
11
 
12
12
  assert_equal expected, actual
13
13
  end
14
14
 
15
- test 'button group choice checkbox' do
16
- actual = UiBibz::Ui::Core::Forms::Buttons::ButtonGroup.new do
17
- concat UiBibz::Ui::Core::Forms::Buttons::ButtonChoice.new('state1').render
18
- concat UiBibz::Ui::Core::Forms::Buttons::ButtonChoice.new('state2').render
19
- end.render
20
- expected = "<div data-toggle=\"buttons\" class=\"btn-group\" role=\"group\"><label class=\"btn-primary btn\"><input type=\"checkbox\" autocomplete=\"off\" />state1</label><label class=\"btn-primary btn\"><input type=\"checkbox\" autocomplete=\"off\" />state2</label></div>"
15
+ test 'button group vertical' do
16
+ actual = ui_button_group(position: :vertical) do |bg|
17
+ bg.button 'state'
18
+ end
19
+ expected = "<div class=\"btn-group-vertical\" role=\"group\"><button class=\"btn\">state</button></div>"
21
20
 
22
21
  assert_equal expected, actual
23
22
  end
24
23
 
25
- test 'button group choice radio' do
26
- actual = UiBibz::Ui::Core::Forms::Buttons::ButtonGroup.new do
27
- concat UiBibz::Ui::Core::Forms::Buttons::ButtonChoice.new('state1', type: :radio).render
28
- concat UiBibz::Ui::Core::Forms::Buttons::ButtonChoice.new('state2', type: :radio).render
29
- end.render
30
- expected = "<div data-toggle=\"buttons\" class=\"btn-group\" role=\"group\"><label class=\"btn-primary btn\"><input type=\"radio\" autocomplete=\"off\" />state1</label><label class=\"btn-primary btn\"><input type=\"radio\" autocomplete=\"off\" />state2</label></div>"
24
+ test 'button group status' do
25
+ actual = ui_button_group(status: :primary) do |bg|
26
+ bg.button 'state'
27
+ end
28
+ expected = "<div class=\"btn-group\" role=\"group\"><button class=\"btn-primary btn\">state</button></div>"
29
+
30
+ assert_equal expected, actual
31
+ end
32
+
33
+ test 'button group size' do
34
+ actual = ui_button_group(size: :sm) do |bg|
35
+ bg.button 'state'
36
+ end
37
+ expected = "<div class=\"btn-group btn-group-sm\" role=\"group\"><button class=\"btn btn-sm\">state</button></div>"
38
+
39
+ assert_equal expected, actual
40
+ end
41
+
42
+ test 'button group with dropdown' do
43
+ actual = ui_button_group do |bg|
44
+ bg.dropdown("Dropdown", type: :dropup, status: :success) do |d|
45
+ d.link 'Link 1', url: '#link1', glyph: 'eye'
46
+ end
47
+ end
48
+ expected = "<div class=\"btn-group\" role=\"group\"><div class=\"dropup btn-group\"><button class=\"btn btn-success dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\">Dropdown <span class=\"caret\"></span></button><div class=\"dropdown-menu dropdown-menu-left\"><a class=\"dropdown-item\" href=\"#link1\"><i class=\"glyph fa fa-eye\"></i> Link 1</a></div></div></div>"
31
49
 
32
50
  assert_equal expected, actual
33
51
  end
@@ -1,11 +1,81 @@
1
1
  require 'test_helper'
2
- include UiBibz::Helpers
3
2
 
4
3
  class ButtonLinkTest < ActionView::TestCase
4
+ include UiBibz::Helpers::Ui::CoreHelper
5
5
 
6
- test 'link button' do
7
- actual = UiBibz::Ui::Core::Forms::Buttons::ButtonLink.new('state', { url: users_path, status: :danger, glyph: 'add'}).render
8
- expected = "<a class=\"btn-danger btn\" href=\"/users\"><i class=\"glyph fa fa-add\"></i> state</a>"
6
+ test "button_link" do
7
+ actual = ui_button_link('state')
8
+ expected = "<a class=\"btn-secondary btn\" role=\"button\" href=\"#\">state</a>"
9
+
10
+ assert_equal expected, actual
11
+ end
12
+
13
+ test "button_link with url" do
14
+ actual = ui_button_link('state', url: '#new_url')
15
+ expected = "<a class=\"btn-secondary btn\" role=\"button\" href=\"#new_url\">state</a>"
16
+
17
+ assert_equal expected, actual
18
+ end
19
+
20
+ test "button_link with status" do
21
+ actual = ui_button_link('state', status: :success)
22
+ expected = "<a class=\"btn-success btn\" role=\"button\" href=\"#\">state</a>"
23
+
24
+ assert_equal expected, actual
25
+ end
26
+
27
+ test 'button_link outline' do
28
+ actual = ui_button_link('state', status: :success, outline: true)
29
+ expected = "<a class=\"btn-success btn\" role=\"button\" href=\"#\">state</a>"
30
+
31
+ assert_equal expected, actual
32
+ end
33
+
34
+ test 'button_link disabled' do
35
+ actual = ui_button_link('state', state: :disabled)
36
+ expected = "<a class=\"disabled btn-secondary btn\" disabled=\"disabled\" role=\"button\" href=\"#\">state</a>"
37
+
38
+ assert_equal expected, actual
39
+ end
40
+
41
+ test 'button_link active' do
42
+ actual = ui_button_link('state', state: :active)
43
+ expected = "<a class=\"active btn-secondary btn\" aria-pressed=\"true\" role=\"button\" href=\"#\">state</a>"
44
+
45
+ assert_equal expected, actual
46
+ end
47
+
48
+ test 'button_link badge' do
49
+ actual = ui_button_link('state', badge: 2)
50
+ expected = "<a class=\"btn-secondary btn\" role=\"button\" href=\"#\">state<span class=\"badge-secondary badge\">2</span></a>"
51
+
52
+ assert_equal expected, actual
53
+ end
54
+
55
+ test 'button_link block' do
56
+ actual = ui_button_link('state', type: :block)
57
+ expected = "<a class=\"btn-secondary btn btn-block\" role=\"button\" href=\"#\">state</a>"
58
+
59
+ assert_equal expected, actual
60
+ end
61
+
62
+ test 'button_link size' do
63
+ actual = ui_button_link('state', size: :sm)
64
+ expected = "<a class=\"btn-secondary btn btn-sm\" role=\"button\" href=\"#\">state</a>"
65
+
66
+ assert_equal expected, actual
67
+ end
68
+
69
+ test 'button_link toggle' do
70
+ actual = ui_button_link('state', toggle: true)
71
+ expected = "<a class=\"btn-secondary btn\" data-toggle=\"button\" aria-pressed=\"false\" autocomplete=\"off\" role=\"button\" href=\"#\">state</a>"
72
+
73
+ assert_equal expected, actual
74
+ end
75
+
76
+ test 'button_link glyph' do
77
+ actual = ui_button_link('state', glyph: 'diamond')
78
+ expected = "<a class=\"btn-secondary btn\" role=\"button\" href=\"#\"><i class=\"glyph fa fa-diamond\"></i> state</a>"
9
79
 
10
80
  assert_equal expected, actual
11
81
  end
@@ -1,11 +1,10 @@
1
1
  require 'test_helper'
2
- include UiBibz::Helpers
3
2
 
4
3
  class ButtonRefreshTest < ActionView::TestCase
5
4
 
6
5
  test "button" do
7
6
  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 input-refresh-button btn\"><i class=\"glyph fa fa-refresh\"></i> state</span>"
7
+ 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 fa fa-refresh\"></i> state</span>"
9
8
 
10
9
  assert_equal expected, actual
11
10
  end
@@ -1,19 +1,82 @@
1
1
  require 'test_helper'
2
- include UiBibz::Helpers
3
2
 
4
3
  class ButtonTest < ActionView::TestCase
4
+ include UiBibz::Helpers::Ui::CoreHelper
5
5
 
6
6
  test "button" do
7
- actual = UiBibz::Ui::Core::Forms::Buttons::Button.new('state', status: :success).render
7
+ actual = ui_button('state')
8
+ expected = "<button class=\"btn\">state</button>"
9
+
10
+ assert_equal expected, actual
11
+ end
12
+
13
+ test "button with status" do
14
+ actual = ui_button('state', status: :success)
8
15
  expected = "<button class=\"btn-success btn\">state</button>"
9
16
 
10
17
  assert_equal expected, actual
11
18
  end
12
19
 
13
20
  test 'button outline' do
14
- actual = UiBibz::Ui::Core::Forms::Buttons::Button.new('state', status: :success, outline: true).render
21
+ actual = ui_button('state', status: :success, outline: true)
15
22
  expected = "<button class=\"btn-outline-success btn\">state</button>"
16
23
 
17
24
  assert_equal expected, actual
18
25
  end
26
+
27
+ test 'button disabled' do
28
+ actual = ui_button('state', state: :disabled)
29
+ expected = "<button class=\"disabled btn\" disabled=\"disabled\">state</button>"
30
+
31
+ assert_equal expected, actual
32
+ end
33
+
34
+ test 'button active' do
35
+ actual = ui_button('state', state: :active)
36
+ expected = "<button class=\"active btn\" aria-pressed=\"true\">state</button>"
37
+
38
+ assert_equal expected, actual
39
+ end
40
+
41
+ test 'button badge' do
42
+ actual = ui_button('state', badge: 2)
43
+ expected = "<button class=\"btn\">state<span class=\"badge-secondary badge\">2</span></button>"
44
+
45
+ assert_equal expected, actual
46
+ end
47
+
48
+ test 'button block' do
49
+ actual = ui_button('state', type: :block)
50
+ expected = "<button class=\"btn btn-block\">state</button>"
51
+
52
+ assert_equal expected, actual
53
+ end
54
+
55
+ test 'button size' do
56
+ actual = ui_button('state', size: :sm)
57
+ expected = "<button class=\"btn btn-sm\">state</button>"
58
+
59
+ assert_equal expected, actual
60
+ end
61
+
62
+ test 'button toggle' do
63
+ actual = ui_button('state', toggle: true)
64
+ expected = "<button class=\"btn\" data-toggle=\"button\" aria-pressed=\"false\" autocomplete=\"off\">state</button>"
65
+
66
+ assert_equal expected, actual
67
+ end
68
+
69
+ test 'button glyph' do
70
+ actual = ui_button('state', glyph: 'diamond')
71
+ expected = "<button class=\"btn\"><i class=\"glyph fa fa-diamond\"></i> state</button>"
72
+
73
+ assert_equal expected, actual
74
+ end
75
+
76
+ test 'button glyph without text' do
77
+ actual = ui_button('state', glyph: 'diamond', text: false)
78
+ expected = "<button class=\"btn without-text\"><i class=\"glyph fa fa-diamond\"></i>  </button>"
79
+
80
+ assert_equal expected, actual
81
+ end
19
82
  end
@@ -1,5 +1,4 @@
1
1
  require 'test_helper'
2
- include UiBibz::Helpers
3
2
 
4
3
  class CheckboxFieldTest < ActionView::TestCase
5
4
 
@@ -8,5 +7,5 @@ class CheckboxFieldTest < ActionView::TestCase
8
7
  expected = "<div class=\"abc-checkbox-primary checkbox abc-checkbox abc-checkbox-circle\"><input type=\"checkbox\" name=\"John\" id=\"John\" value=\"1\" class=\"styled\" /><label for=\"John\">John</label></div>"
9
8
 
10
9
  assert_equal expected, actual
11
- end
10
+ end
12
11
  end
@@ -1,5 +1,4 @@
1
1
  require 'test_helper'
2
- include UiBibz::Helpers
3
2
 
4
3
  class RadioFieldTest < ActionView::TestCase
5
4
 
@@ -9,4 +8,4 @@ class RadioFieldTest < ActionView::TestCase
9
8
 
10
9
  assert_equal expected, actual
11
10
  end
12
- end
11
+ end
@@ -1,5 +1,4 @@
1
1
  require 'test_helper'
2
- include UiBibz::Helpers
3
2
 
4
3
  class SwitchFieldTest < ActionView::TestCase
5
4
 
@@ -1,18 +1,17 @@
1
1
  require 'test_helper'
2
- include UiBibz::Helpers
3
2
 
4
3
  class DatePickerFieldTest < ActionView::TestCase
5
4
 
6
5
  test "Date Picker Field" do
7
6
  actual = UiBibz::Ui::Core::Forms::Dates::DatePickerField.new(['date_1', 'date_2'], { append: 'a', prepend: 'b', range: 'u' }, { class: 'datepicker-test' }).render
8
- expected = "<div class=\"input-group input-daterange\"><span class=\"input-group-addon\">a</span><input type=\"text\" name=\"date_1\" id=\"date_1\" class=\"datepicker-test date_picker form-control\" data-date-locale=\"en\" data-provide=\"datepicker\" data-date-format=\"dd/mm/yyyy\" data-date-today-btn=\"linked\" /><span class=\"input-group-addon input-group-range\">u</span><input type=\"text\" name=\"date_2\" id=\"date_2\" class=\"datepicker-test date_picker form-control\" data-date-locale=\"en\" data-provide=\"datepicker\" data-date-format=\"dd/mm/yyyy\" data-date-today-btn=\"linked\" /><span class=\"input-group-addon\">b</span></div>"
7
+ expected = "<div class=\"input-daterange input-group\"><span class=\"input-group-addon\">a</span><input type=\"text\" name=\"date_1\" id=\"date_1\" class=\"datepicker-test date_picker form-control\" data-date-locale=\"en\" data-provide=\"datepicker\" data-date-format=\"yyyy-mm-dd\" data-date-today-btn=\"linked\" data-date-toggle-active=\"true\" /><span class=\"input-group-addon\">u</span><input type=\"text\" name=\"date_2\" id=\"date_2\" class=\"datepicker-test date_picker form-control\" data-date-locale=\"en\" data-provide=\"datepicker\" data-date-format=\"yyyy-mm-dd\" data-date-today-btn=\"linked\" data-date-toggle-active=\"true\" /><span class=\"input-group-addon\">b</span></div>"
9
8
 
10
9
  assert_equal expected, actual
11
10
  end
12
11
 
13
12
  test "Date Picker Field data html options" do
14
13
  actual = UiBibz::Ui::Core::Forms::Dates::DatePickerField.new('date', { today_highlight: true, calendar_weeks: true, autoclose: true, dates_disabled: ["11/01/2016", "12/01/2016"] }, { class: 'datepicker-test' }).render
15
- expected = "<input type=\"text\" name=\"date\" id=\"date\" class=\"datepicker-test date_picker form-control\" data-date-locale=\"en\" data-provide=\"datepicker\" data-date-format=\"dd/mm/yyyy\" data-date-today-btn=\"linked\" data-date-today-highlight=\"true\" data-date-calendar-weeks=\"true\" data-date-autoclose=\"true\" data-dates-disabled=\"[&quot;11/01/2016&quot;,&quot;12/01/2016&quot;]\" />"
14
+ expected = "<input type=\"text\" name=\"date\" id=\"date\" class=\"datepicker-test date_picker form-control\" data-date-locale=\"en\" data-provide=\"datepicker\" data-date-format=\"yyyy-mm-dd\" data-date-today-btn=\"linked\" data-date-today-highlight=\"true\" data-date-calendar-weeks=\"true\" data-date-autoclose=\"true\" data-dates-disabled=\"[&quot;11/01/2016&quot;,&quot;12/01/2016&quot;]\" data-date-toggle-active=\"true\" />"
16
15
 
17
16
  assert_equal expected, actual
18
17
  end
@@ -1,11 +1,10 @@
1
1
  require 'test_helper'
2
- include UiBibz::Helpers
3
2
 
4
3
  class FormulaFieldTest < ActionView::TestCase
5
4
 
6
5
  test 'formula_field' do
7
6
  actual = UiBibz::Ui::Core::Forms::Numbers::FormulaField.new('value').render
8
- expected = "<div class=\"input-group formula_field\"><input type=\"text\" name=\"value_formula\" id=\"value_formula\" class=\"formula-field form-control\" /><span class=\"formula-field-sign input-group-addon\">=</span><input type=\"text\" name=\"value\" id=\"value\" readonly=\"readonly\" class=\"formula-field-result form-control\" /><span class=\"formula-field-alert input-group-addon\" data-toggle=\"tooltip\"><i class=\"glyph-danger glyph fa fa-exclamation-triangle\"></i></span></div>"
7
+ expected = "<div class=\"formula_field input-group\"><input type=\"text\" name=\"value_formula\" id=\"value_formula\" class=\"formula-field form-control\" /><span class=\"formula-field-sign input-group-addon\">=</span><input type=\"text\" name=\"value\" id=\"value\" class=\"formula-field-result form-control\" readonly=\"readonly\" /><span data-toggle=\"tooltip\" class=\"formula-field-alert input-group-addon\"><i class=\"glyph-danger glyph fa fa-exclamation-triangle\"></i></span></div>"
9
8
 
10
9
  assert_equal expected, actual
11
10
  end
@@ -1,6 +1,5 @@
1
1
  require 'test_helper'
2
2
 
3
- include UiBibz::Helpers
4
3
  class DropdownSelectFieldTest < ActionView::TestCase
5
4
 
6
5
  test 'dropdown_select_field' do
@@ -77,7 +76,7 @@ class DropdownSelectFieldTest < ActionView::TestCase
77
76
 
78
77
  test 'dropdown_select_field refresh' do
79
78
  actual = UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new('test', { refresh: { mode: 'local', target: { data: [] }}}).render
80
- expected = "<div class=\"input-group field-refresh\"><select name=\"test\" id=\"test\" class=\"dropdown-select-field\"></select><span class=\"input-group-btn\"><span data-connect=\"{&quot;events&quot;:&quot;click&quot;,&quot;mode&quot;:&quot;local&quot;,&quot;target&quot;:{&quot;selector&quot;:&quot;#test&quot;,&quot;url&quot;:&quot;&quot;,&quot;data&quot;:[]}}\" class=\"btn-primary ui-bibz-connect input-refresh-button btn\"><i class=\"glyph fa fa-refresh\"></i> </span></span></div>"
79
+ expected = "<div class=\"field-refresh input-group\"><select name=\"test\" id=\"test\" class=\"dropdown-select-field\"></select><div class=\"input-group-btn\"><span data-connect=\"{&quot;events&quot;:&quot;click&quot;,&quot;mode&quot;:&quot;local&quot;,&quot;target&quot;:{&quot;selector&quot;:&quot;#test&quot;,&quot;url&quot;:&quot;&quot;,&quot;data&quot;:[]}}\" class=\"btn-primary ui-bibz-connect btn input-refresh-button\"><i class=\"glyph fa fa-refresh\"></i> </span></div></div>"
81
80
 
82
81
  assert_equal expected, actual
83
82
  end
@@ -1,5 +1,4 @@
1
1
  require 'test_helper'
2
- include UiBibz::Helpers
3
2
 
4
3
  class MultiColumnFieldTest < ActionView::TestCase
5
4
 
@@ -1,5 +1,4 @@
1
1
  require 'test_helper'
2
- include UiBibz::Helpers
3
2
 
4
3
  class MultiSelectFieldTest < ActionView::TestCase
5
4
 
@@ -25,7 +24,7 @@ class MultiSelectFieldTest < ActionView::TestCase
25
24
 
26
25
  test 'Multi select Field refresh option' do
27
26
  actual = UiBibz::Ui::Core::Forms::Selects::MultiSelectField.new('test', { refresh: { target: { url: '/'}}}).render
28
- expected = "<div class=\"input-group field-refresh\"><select name=\"test[]\" id=\"test\" class=\"btn-secondary multi-select-field\" multiple=\"multiple\"></select><span class=\"input-group-btn\"><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-primary ui-bibz-connect input-refresh-button btn\"><i class=\"glyph fa fa-refresh\"></i> </span></span></div>"
27
+ expected = "<div class=\"field-refresh input-group\"><select name=\"test[]\" id=\"test\" class=\"btn-secondary multi-select-field\" multiple=\"multiple\"></select><div class=\"input-group-btn\"><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-primary ui-bibz-connect btn input-refresh-button\"><i class=\"glyph fa fa-refresh\"></i> </span></div></div>"
29
28
 
30
29
  assert_equal expected, actual
31
30
  end
@@ -1,5 +1,4 @@
1
1
  require 'test_helper'
2
- include UiBibz::Helpers
3
2
 
4
3
  class SelectFieldTest < ActionView::TestCase
5
4
 
@@ -14,7 +13,7 @@ class SelectFieldTest < ActionView::TestCase
14
13
 
15
14
  test "Select Field refresh" do
16
15
  actual = UiBibz::Ui::Core::Forms::Selects::SelectField.new('example', refresh: { target: { url: '/' }}).render
17
- expected = "<div class=\"input-group field-refresh\"><select name=\"example\" id=\"example\" class=\"select-field form-control\"></select><span class=\"input-group-btn\"><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-primary ui-bibz-connect input-refresh-button btn\"><i class=\"glyph fa fa-refresh\"></i> </span></span></div>"
16
+ expected = "<div class=\"field-refresh input-group\"><select name=\"example\" id=\"example\" class=\"select-field form-control\"></select><div class=\"input-group-btn\"><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-primary ui-bibz-connect btn input-refresh-button\"><i class=\"glyph fa fa-refresh\"></i> </span></div></div>"
18
17
 
19
18
  assert_equal expected, actual
20
19
  end