ui_bibz 2.0.0.beta2.2 → 2.0.0.beta2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1767f59b9f0c9eee7efc9759a09f82d025695a55
4
- data.tar.gz: 2e1af8f6817a7d016788bfaf4ca35deec50fc1c3
3
+ metadata.gz: 376efa6f5ae5db474e06c0ddc60400790155ac73
4
+ data.tar.gz: 8a5f2563fd2e2257148e144b49bdb5397430423d
5
5
  SHA512:
6
- metadata.gz: cf2175011ffefa7359a9513a7f74f1c93c9be0f088bb54ffcd87f116e1a7ddb199bcd056284af9127a6c8bf2f3a4e63586be142790d2f66cf17a001968072953
7
- data.tar.gz: a34605b4e843169ffa75ea716a6732f5d4b9b781f225b28c93a0e165ad63fcba50d41b7dcb2911f328d5ce8379f79acbf3186386cd2f9dcf2b713b6464025e34
6
+ metadata.gz: 3b37bd2f78f10a524bf4365af5439d2c1543b5d20196b8c71dfd43148a75875067dd42427b5243357942cf5ffc6656b85ee5d0632693337edc6f9a9a3fc57294
7
+ data.tar.gz: bf5fb06d604297f5ef30ef22f068f8f02015e3404ef2a38d011709f0e361f900de0dbd101075003ea3d1784eec3db50d8cb194994eb953dbd06a3185fb790959
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ui_bibz (2.0.0.beta2.2)
4
+ ui_bibz (2.0.0.beta2.3)
5
5
  bootstrap (= 4.0.0.beta2)
6
6
  font-awesome-sass
7
7
  haml
@@ -16,7 +16,7 @@ module UiBibzInputs
16
16
 
17
17
  def new_options
18
18
  label_method, value_method = detect_collection_methods
19
- new_value = @builder.object.send(attribute_name).blank? ? @builder.object.send(attribute_name) : ActiveSupport::JSON.decode(@builder.object.send(attribute_name).to_s)
19
+ new_value =
20
20
 
21
21
  if options[:grouped] == true
22
22
  options.merge({ option_tags: option_groups_from_collection_for_select(
@@ -32,6 +32,18 @@ module UiBibzInputs
32
32
  end
33
33
  end
34
34
 
35
+ def new_value
36
+ if @builder.object.send(attribute_name).blank?
37
+ @builder.object.send(attribute_name)
38
+ else
39
+ begin
40
+ ActiveSupport::JSON.decode(@builder.object.send(attribute_name).to_s)
41
+ rescue
42
+ @builder.object.send(attribute_name)
43
+ end
44
+ end
45
+ end
46
+
35
47
  def grouped_collection
36
48
  @grouped_collection ||= begin
37
49
  grouped_collection = options.delete(:collection)
@@ -149,8 +149,12 @@ module UiBibz::Ui::Core::Dropdowns
149
149
  "btn-group" if @options[:inline]
150
150
  end
151
151
 
152
+ def outline
153
+ "outline" if @options[:outline]
154
+ end
155
+
152
156
  def button_status
153
- "btn-#{ @status || :primary }"
157
+ ["btn", outline, @status || :secondary].compact.join('-')
154
158
  end
155
159
 
156
160
  # :lg, :sm or :xs
@@ -1,3 +1,3 @@
1
1
  module UiBibz
2
- VERSION = "2.0.0.beta2.2"
2
+ VERSION = "2.0.0.beta2.3"
3
3
  end
@@ -26,7 +26,7 @@ class SimpleFormTest < ActionView::TestCase
26
26
  f.input :name_fr, as: :ui_auto_complete_field, collection: @users, label_method: :name_fr
27
27
  end
28
28
 
29
- expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><input type=\"hidden\" name=\"_method\" value=\"patch\" /><div class=\"form-group ui_auto_complete_field optional user_name_fr\"><label class=\"control-label ui_auto_complete_field optional\" for=\"user_name_fr\">Name fr</label><input type=\"text\" name=\"user[name_fr]\" id=\"user_name_fr\" value=\"test1\" class=\"ui_auto_complete_field optional form-control auto-complete-field\" autocomplete=\"true\" list=\"user_name_fr-datalist\" /><datalist id=\"user_name_fr-datalist\"><option value=\"1\">test1</option>
29
+ expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><input type=\"hidden\" name=\"_method\" value=\"patch\" /><div class=\"form-group ui_auto_complete_field optional user_name_fr\"><label class=\"control-label ui_auto_complete_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 auto-complete-field\" autocomplete=\"true\" list=\"user_name_fr-datalist\" /><datalist id=\"user_name_fr-datalist\"><option value=\"1\">test1</option>
30
30
  <option value=\"2\">test2</option></datalist></div></form>"
31
31
 
32
32
  assert_equal expected, actual
@@ -47,7 +47,7 @@ class SimpleFormTest < ActionView::TestCase
47
47
  f.input :name_fr, as: :ui_dropdown_select_field, collection: @users, label_method: :name_fr
48
48
  end
49
49
 
50
- expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><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=\"ui_dropdown_select_field optional dropdown-select-field\"><option value=\"1\">test1</option>
50
+ expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><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=\"dropdown-select-field\"><option value=\"1\">test1</option>
51
51
  <option value=\"2\">test2</option></select></div></form>"
52
52
 
53
53
  assert_equal expected, actual
@@ -59,7 +59,7 @@ class SimpleFormTest < ActionView::TestCase
59
59
  f.input :name_fr, as: :ui_dropdown_select_field, collection: @continents, toto: 'lala', grouped: true, group_method: :countries
60
60
  end
61
61
 
62
- expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><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=\"ui_dropdown_select_field optional dropdown-select-field\"><optgroup label=\"Europe\"><option value=\"1\">France</option>
62
+ expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><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=\"dropdown-select-field\"><optgroup label=\"Europe\"><option value=\"1\">France</option>
63
63
  <option value=\"2\">Deutchland</option></optgroup></select></div></form>"
64
64
 
65
65
  assert_equal expected, actual
@@ -73,7 +73,7 @@ class SimpleFormTest < ActionView::TestCase
73
73
  f.input :price, as: :ui_formula_field
74
74
  end
75
75
 
76
- expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><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\"><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-addon\">=</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-addon\"><i class=\"glyph-danger glyph fa fa-exclamation-triangle\"></i></span></div></div></form>"
76
+ expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><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-addon\">=</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-addon\"><i class=\"glyph-danger glyph fa fa-exclamation-triangle\"></i></span></div></div></form>"
77
77
 
78
78
  assert_equal expected, actual
79
79
  end
@@ -94,7 +94,7 @@ class SimpleFormTest < ActionView::TestCase
94
94
  f.input :name_fr, as: :ui_multi_column_field, collection: @users, label_method: :name_fr
95
95
  end
96
96
 
97
- expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><input type=\"hidden\" name=\"_method\" value=\"patch\" /><div class=\"form-group ui_multi_column_field optional user_name_fr\"><label class=\"control-label ui_multi_column_field optional\" for=\"user_name_fr\">Name fr</label><select name=\"name_fr[]\" id=\"name_fr\" class=\"ui_multi_column_field optional multi-column-field\" multiple=\"multiple\"><option value=\"1\">test1</option>
97
+ expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><input type=\"hidden\" name=\"_method\" value=\"patch\" /><div class=\"form-group ui_multi_column_field optional user_name_fr\"><label class=\"control-label ui_multi_column_field optional\" for=\"user_name_fr\">Name fr</label><select name=\"name_fr[]\" id=\"name_fr\" class=\"multi-column-field\" multiple=\"multiple\"><option value=\"1\">test1</option>
98
98
  <option value=\"2\">test2</option></select></div></form>"
99
99
 
100
100
  assert_equal expected, actual
@@ -105,7 +105,7 @@ class SimpleFormTest < ActionView::TestCase
105
105
  f.input :name_fr, as: :ui_multi_select_field, collection: @users, label_method: :name_fr
106
106
  end
107
107
 
108
- expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><input type=\"hidden\" name=\"_method\" value=\"patch\" /><div class=\"form-group ui_multi_select_field optional user_name_fr\"><label class=\"control-label ui_multi_select_field optional\" for=\"user_name_fr\">Name fr</label><select name=\"name_fr[]\" id=\"name_fr\" class=\"ui_multi_select_field optional btn-secondary multi-select-field\" multiple=\"multiple\"><option value=\"1\">test1</option>
108
+ expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><input type=\"hidden\" name=\"_method\" value=\"patch\" /><div class=\"form-group ui_multi_select_field optional user_name_fr\"><label class=\"control-label ui_multi_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>
109
109
  <option value=\"2\">test2</option></select></div></form>"
110
110
 
111
111
  assert_equal expected, actual
@@ -117,7 +117,7 @@ class SimpleFormTest < ActionView::TestCase
117
117
  f.input :name_fr, as: :ui_multi_select_field, collection: @continents, toto: 'lala', grouped: true, group_method: :countries
118
118
  end
119
119
 
120
- expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><input type=\"hidden\" name=\"_method\" value=\"patch\" /><div class=\"form-group ui_multi_select_field optional user_name_fr\"><label class=\"control-label ui_multi_select_field optional\" for=\"user_name_fr\">Name fr</label><select name=\"name_fr[]\" id=\"name_fr\" class=\"ui_multi_select_field optional btn-secondary multi-select-field\" multiple=\"multiple\"><optgroup label=\"Europe\"><option value=\"1\">France</option>
120
+ expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><input type=\"hidden\" name=\"_method\" value=\"patch\" /><div class=\"form-group ui_multi_select_field optional user_name_fr\"><label class=\"control-label ui_multi_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>
121
121
  <option value=\"2\">Deutchland</option></optgroup></select></div></form>"
122
122
 
123
123
  assert_equal expected, actual
@@ -159,7 +159,7 @@ class SimpleFormTest < ActionView::TestCase
159
159
  f.input :name_fr, as: :ui_select_field, collection: @users, label_method: :name_fr
160
160
  end
161
161
 
162
- expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><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><select name=\"user[name_fr]\" id=\"user_name_fr\" class=\"ui_select_field optional select-field form-control\"><option value=\"1\">test1</option>
162
+ expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><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><select name=\"user[name_fr]\" id=\"user_name_fr\" class=\"select-field form-control\"><option value=\"1\">test1</option>
163
163
  <option value=\"2\">test2</option></select></div></form>"
164
164
 
165
165
  assert_equal expected, actual
@@ -170,8 +170,8 @@ class SimpleFormTest < ActionView::TestCase
170
170
  f.input :name_fr, as: :ui_select_field, refresh: { target: { data: [] }}, collection: @users, label_method: :name_fr
171
171
  end
172
172
 
173
- expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><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\"><select name=\"user[name_fr]\" id=\"user_name_fr\" class=\"ui_select_field optional select-field form-control\"><option value=\"1\">test1</option>
174
- <option value=\"2\">test2</option></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;#user_name_fr&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></div></form>"
173
+ expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><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=\"select-field form-control\"><option value=\"1\">test1</option>
174
+ <option value=\"2\">test2</option></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;#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 fa fa-refresh\"></i> </span></div></div></div></form>"
175
175
 
176
176
  assert_equal expected, actual
177
177
  end
@@ -182,7 +182,7 @@ class SimpleFormTest < ActionView::TestCase
182
182
  f.input :name_fr, as: :ui_select_field, collection: @continents, toto: 'lala', grouped: true, group_method: :countries
183
183
  end
184
184
 
185
- expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><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><select name=\"user[name_fr]\" id=\"user_name_fr\" class=\"ui_select_field optional select-field form-control\"><optgroup label=\"Europe\"><option value=\"1\">France</option>
185
+ expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><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><select name=\"user[name_fr]\" id=\"user_name_fr\" class=\"select-field form-control\"><optgroup label=\"Europe\"><option value=\"1\">France</option>
186
186
  <option value=\"2\">Deutchland</option></optgroup></select></div></form>"
187
187
 
188
188
  assert_equal expected, actual
@@ -195,7 +195,7 @@ class SimpleFormTest < ActionView::TestCase
195
195
  f.input :name_fr, as: :ui_select_field, collection: @countries
196
196
  end
197
197
 
198
- expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><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><select name=\"user[name_fr]\" id=\"user_name_fr\" class=\"ui_select_field optional select-field form-control\"><option selected=\"selected\" value=\"1\">France</option>
198
+ expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><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><select name=\"user[name_fr]\" id=\"user_name_fr\" class=\"select-field form-control\"><option value=\"1\">France</option>
199
199
  <option value=\"2\">Deutchland</option></select></div></form>"
200
200
 
201
201
  assert_equal expected, actual
@@ -208,7 +208,7 @@ class SimpleFormTest < ActionView::TestCase
208
208
  f.input :name_fr, as: :ui_select_field, collection: @continents, toto: 'lala', grouped: true, group_method: :countries
209
209
  end
210
210
 
211
- expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><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><select name=\"user[name_fr]\" id=\"user_name_fr\" class=\"ui_select_field optional select-field form-control\"><optgroup label=\"Europe\"><option selected=\"selected\" value=\"1\">France</option>
211
+ expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><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><select name=\"user[name_fr]\" id=\"user_name_fr\" class=\"select-field form-control\"><optgroup label=\"Europe\"><option value=\"1\">France</option>
212
212
  <option value=\"2\">Deutchland</option></optgroup></select></div></form>"
213
213
 
214
214
  assert_equal expected, actual
@@ -12,6 +12,24 @@ class CardTest < ActionView::TestCase
12
12
  assert_equal expected, actual
13
13
  end
14
14
 
15
+ test 'card status' do
16
+ actual = ui_card 'test', status: :primary
17
+ expected = "<div class=\"bg-primary text-white card\"><div class=\"card-body\">test</div></div>"
18
+
19
+ assert_equal expected, actual
20
+ end
21
+
22
+ test 'card outline' do
23
+ actual = ui_card 'test', status: :success, outline: true, tap: true do |c|
24
+ c.header 'header'
25
+ c.body 'header'
26
+ c.footer 'header'
27
+ end
28
+ expected = "<div class=\"border-success text-white card bg-transparent\"><div class=\"card-header text-success border-success bg-transparent\">header</div><div class=\"card-body\">test</div><div class=\"card-body text-success\">header</div><div class=\"card-footer text-success border-success bg-transparent\">header</div></div>"
29
+
30
+ assert_equal expected, actual
31
+ end
32
+
15
33
  test 'create card with image, list and body' do
16
34
  actual = ui_card(tap: true) do |c|
17
35
  c.image 'image.svg'
@@ -28,18 +46,31 @@ class CardTest < ActionView::TestCase
28
46
  link_to "Card link", '#', class: "card-link"
29
47
  end
30
48
  end
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>"
49
+ expected = "<div class=\"card\"><img class=\"card-img-top\" 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
50
 
33
51
  assert_equal expected, actual
34
52
  end
35
53
 
36
54
  test 'create card with header, body and footer' do
37
- actual = ui_card(status: :danger, tap: true, class: 'state') do |p|
55
+ actual = ui_card tap: true, class: 'state' do |p|
38
56
  p.header 'state', glyph: 'eye'
39
57
  p.body 'state'
40
58
  p.footer 'state'
41
59
  end
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>"
60
+ expected = "<div class=\"state card\"><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>"
61
+
62
+ assert_equal expected, actual
63
+ end
64
+
65
+ test 'position' do
66
+ actual = ui_card tap: true, text: { position: :right, size: :md } do |p|
67
+ p.body tap: true do |b|
68
+ b.title "Special title treatment"
69
+ b.text "With supporting text below as a natural lead-in to additional content."
70
+ b.link "Go somewhere", url: '#go-somewhere', class: 'btn btn-primary'
71
+ end
72
+ end
73
+ expected = "<div class=\"card text-md-right\"><div class=\"card-body\"><h4 class=\"card-title\">Special title treatment</h4><p class=\"card-text\">With supporting text below as a natural lead-in to additional content.</p><a class=\"btn btn-primary card-link\" href=\"#go-somewhere\">Go somewhere</a></div></div>"
43
74
 
44
75
  assert_equal expected, actual
45
76
  end
@@ -84,7 +115,7 @@ class CardTest < ActionView::TestCase
84
115
  lg.list "list 3"
85
116
  end
86
117
  end
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>"
118
+ 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>"
88
119
 
89
120
  assert_equal expected, actual
90
121
  end
@@ -97,7 +128,7 @@ class CardTest < ActionView::TestCase
97
128
  b.link 'link', url: '#'
98
129
  end
99
130
  end
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>"
131
+ expected = "<div class=\"card\"><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>"
101
132
 
102
133
  assert_equal expected, actual
103
134
  end
@@ -3,29 +3,52 @@ class DropdownTest < ActionView::TestCase
3
3
  include UiBibz::Helpers::Ui::CoreHelper
4
4
 
5
5
  test 'Dropdown' do
6
- actual = ui_dropdown("Dropdown", type: :dropup, status: :success) do |d|
6
+ actual = UiBibz::Ui::Core::Dropdowns::Dropdown.new("Dropdown").tap do |d|
7
+ d.link 'link'
8
+ end
9
+ expected = "<div class=\"dropdown\"><button class=\"btn btn-secondary dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\" id=\"#{ actual.id }\">Dropdown <span class=\"caret\"></span></button><div class=\"dropdown-menu\" arial-labelledby=\"#{ actual.id }\"><a class=\"dropdown-item\" href=\"#\">link</a></div></div>"
10
+
11
+ assert_equal expected, actual.render
12
+ end
13
+
14
+ test 'Dropdown status' do
15
+ actual = UiBibz::Ui::Core::Dropdowns::Dropdown.new("Dropdown", status: :primary).tap do |d|
16
+ d.link 'link'
17
+ end
18
+ expected = "<div class=\"dropdown\"><button class=\"btn btn-primary dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\" id=\"#{ actual.id }\">Dropdown <span class=\"caret\"></span></button><div class=\"dropdown-menu\" arial-labelledby=\"#{ actual.id }\"><a class=\"dropdown-item\" href=\"#\">link</a></div></div>"
19
+
20
+ assert_equal expected, actual.render
21
+ end
22
+
23
+ test 'Dropdown outline' do
24
+ actual = UiBibz::Ui::Core::Dropdowns::Dropdown.new("Dropdown", status: :primary, outline: true).tap do |d|
25
+ d.link 'link'
26
+ end
27
+ expected = "<div class=\"dropdown\"><button class=\"btn btn-outline-primary dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\" id=\"#{ actual.id }\">Dropdown <span class=\"caret\"></span></button><div class=\"dropdown-menu\" arial-labelledby=\"#{ actual.id }\"><a class=\"dropdown-item\" href=\"#\">link</a></div></div>"
28
+
29
+ assert_equal expected, actual.render
30
+ end
31
+
32
+ test 'Dropdown options' do
33
+ actual = UiBibz::Ui::Core::Dropdowns::Dropdown.new("Dropdown", type: :dropup, status: :success, glyph: 'diamond').tap do |d|
7
34
  d.link 'Link 1', url: '#link1', glyph: 'eye'
8
35
  d.header 'header'
9
36
  d.link 'Link 2', url: '#link2'
10
37
  d.divider
11
38
  d.link 'Link3', url: '#link3'
12
39
  end
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>"
40
+ expected = "<div class=\"dropup\"><button class=\"btn btn-success dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\" id=\"#{ actual.id }\"><i class=\"glyph fa fa-diamond\"></i> Dropdown <span class=\"caret\"></span></button><div class=\"dropdown-menu\" arial-labelledby=\"#{ actual.id }\"><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
41
 
15
- assert_equal expected, actual
42
+ assert_equal expected, actual.render
16
43
  end
17
44
 
18
45
  test 'Split Dropdown' do
19
- actual = ui_dropdown("Split Dropdown", type: :dropup, status: :primary) do |d|
46
+ actual = UiBibz::Ui::Core::Dropdowns::Dropdown.new("Split Dropdown").tap do |d|
20
47
  d.link 'state'
21
- d.header 'header'
22
- d.link 'momo'
23
- d.divider
24
- d.link 'lolo'
25
48
  end
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>"
49
+ expected = "<div class=\"dropdown\"><button class=\"btn btn-secondary dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\" id=\"#{ actual.id }\">Split Dropdown <span class=\"caret\"></span></button><div class=\"dropdown-menu\" arial-labelledby=\"#{ actual.id }\"><a class=\"dropdown-item\" href=\"#\">state</a></div></div>"
27
50
 
28
- assert_equal expected, actual
51
+ assert_equal expected, actual.render
29
52
  end
30
53
 
31
54
  end
@@ -8,7 +8,7 @@ class ButtonChoiceTest < ActionView::TestCase
8
8
  bc.button 'Checkbox 1'
9
9
  bc.button 'Checkbox 2', state: :active
10
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>"
11
+ expected = "<div data-toggle=\"buttons\" class=\"btn-group button-choice\"><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>"
12
12
 
13
13
  assert_equal expected, actual
14
14
  end
@@ -18,7 +18,7 @@ class ButtonChoiceTest < ActionView::TestCase
18
18
  bc.button 'Radio 1'
19
19
  bc.button 'Radio 2', state: :active
20
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>"
21
+ expected = "<div data-toggle=\"buttons\" class=\"btn-group button-choice\"><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
22
 
23
23
  assert_equal expected, actual
24
24
  end
@@ -28,7 +28,7 @@ class ButtonChoiceTest < ActionView::TestCase
28
28
  bc.button 'Radio 1', glyph: 'diamond', status: :primary
29
29
  bc.button 'Radio 2', state: :active
30
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>"
31
+ expected = "<div data-toggle=\"buttons\" class=\"btn-group btn-group-lg button-choice\"><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>"
32
32
 
33
33
  assert_equal expected, actual
34
34
  end
@@ -41,11 +41,11 @@ class ButtonGroupTest < ActionView::TestCase
41
41
 
42
42
  test 'button group with dropdown' do
43
43
  actual = ui_button_group do |bg|
44
- bg.dropdown("Dropdown", type: :dropup, status: :success) do |d|
44
+ bg.dropdown("Dropdown", { type: :dropup, status: :success }, { id: 'dropdown-test' }) do |d|
45
45
  d.link 'Link 1', url: '#link1', glyph: 'eye'
46
46
  end
47
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>"
48
+ expected = "<div class=\"btn-group\" role=\"group\"><div id=\"dropdown-test\" class=\"dropup\"><button class=\"btn btn-success dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\" id=\"dropdown-test\">Dropdown <span class=\"caret\"></span></button><div class=\"dropdown-menu\" arial-labelledby=\"dropdown-test\"><a class=\"dropdown-item\" href=\"#link1\"><i class=\"glyph fa fa-eye\"></i> Link 1</a></div></div></div>"
49
49
 
50
50
  assert_equal expected, actual
51
51
  end
@@ -26,7 +26,7 @@ class ButtonLinkTest < ActionView::TestCase
26
26
 
27
27
  test 'button_link outline' do
28
28
  actual = ui_button_link('state', status: :success, outline: true)
29
- expected = "<a class=\"btn-success btn\" role=\"button\" href=\"#\">state</a>"
29
+ expected = "<a class=\"btn-outline-success btn\" role=\"button\" href=\"#\">state</a>"
30
30
 
31
31
  assert_equal expected, actual
32
32
  end
@@ -4,7 +4,7 @@ class DatePickerFieldTest < ActionView::TestCase
4
4
 
5
5
  test "Date Picker Field" do
6
6
  actual = UiBibz::Ui::Core::Forms::Dates::DatePickerField.new(['date_1', 'date_2'], { append: 'a', prepend: 'b', range: 'u' }, { class: 'datepicker-test' }).render
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>"
7
+ expected = "<div class=\"input-daterange input-group ui_surround_field\"><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>"
8
8
 
9
9
  assert_equal expected, actual
10
10
  end
@@ -4,7 +4,7 @@ class FormulaFieldTest < ActionView::TestCase
4
4
 
5
5
  test 'formula_field' do
6
6
  actual = UiBibz::Ui::Core::Forms::Numbers::FormulaField.new('value').render
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>"
7
+ expected = "<div class=\"formula_field input-group ui_surround_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\" 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>"
8
8
 
9
9
  assert_equal expected, actual
10
10
  end
@@ -76,7 +76,7 @@ class DropdownSelectFieldTest < ActionView::TestCase
76
76
 
77
77
  test 'dropdown_select_field refresh' do
78
78
  actual = UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new('test', { refresh: { mode: 'local', target: { data: [] }}}).render
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>"
79
+ expected = "<div class=\"field-refresh input-group ui_surround_field\"><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-secondary ui-bibz-connect btn input-refresh-button\"><i class=\"glyph fa fa-refresh\"></i> </span></div></div>"
80
80
 
81
81
  assert_equal expected, actual
82
82
  end
@@ -24,7 +24,7 @@ class MultiSelectFieldTest < ActionView::TestCase
24
24
 
25
25
  test 'Multi select Field refresh option' do
26
26
  actual = UiBibz::Ui::Core::Forms::Selects::MultiSelectField.new('test', { refresh: { target: { url: '/'}}}).render
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>"
27
+ expected = "<div class=\"field-refresh input-group ui_surround_field\"><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-secondary ui-bibz-connect btn input-refresh-button\"><i class=\"glyph fa fa-refresh\"></i> </span></div></div>"
28
28
 
29
29
  assert_equal expected, actual
30
30
  end
@@ -13,7 +13,7 @@ class SelectFieldTest < ActionView::TestCase
13
13
 
14
14
  test "Select Field refresh" do
15
15
  actual = UiBibz::Ui::Core::Forms::Selects::SelectField.new('example', refresh: { target: { url: '/' }}).render
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>"
16
+ expected = "<div class=\"field-refresh input-group ui_surround_field\"><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-secondary ui-bibz-connect btn input-refresh-button\"><i class=\"glyph fa fa-refresh\"></i> </span></div></div>"
17
17
 
18
18
  assert_equal expected, actual
19
19
  end
@@ -6,7 +6,7 @@ class SurroundFieldTest < ActionView::TestCase
6
6
  actual = UiBibz::Ui::Core::Forms::Surrounds::SurroundField.new.tap do |sf|
7
7
  sf.glyph 'pencil'
8
8
  end.render
9
- expected = "<div class=\"input-group\"><span class=\"input-group-addon\"><i class=\"glyph fa fa-pencil\"></i></span></div>"
9
+ expected = "<div class=\"input-group ui_surround_field\"><span class=\"input-group-addon\"><i class=\"glyph fa fa-pencil\"></i></span></div>"
10
10
 
11
11
  assert_equal expected, actual
12
12
  end
@@ -15,14 +15,14 @@ class SurroundFieldTest < ActionView::TestCase
15
15
  actual = UiBibz::Ui::Core::Forms::Surrounds::SurroundField.new.tap do |sf|
16
16
  sf.addon 'content addon'
17
17
  end.render
18
- expected = "<div class=\"input-group\"><span class=\"input-group-addon\">content addon</span></div>"
18
+ expected = "<div class=\"input-group ui_surround_field\"><span class=\"input-group-addon\">content addon</span></div>"
19
19
 
20
20
  assert_equal expected, actual
21
21
  end
22
22
 
23
23
  test 'surround_field with dropdown' do
24
24
  actual = UiBibz::Ui::Core::Forms::Surrounds::SurroundField.new.tap do |sf|
25
- sf.dropdown "Dropdown" do |d|
25
+ sf.dropdown "Dropdown", {}, { id: 'dropdown-test'} do |d|
26
26
  d.link 'Link 1', url: '#link1', glyph: 'eye'
27
27
  d.header 'header'
28
28
  d.link 'Link 2', url: '#link2'
@@ -30,7 +30,7 @@ class SurroundFieldTest < ActionView::TestCase
30
30
  d.link 'Link3', url: '#link3'
31
31
  end
32
32
  end.render
33
- expected = "<div class=\"input-group\"><div class=\"dropdown btn-group input-group-btn\"><button class=\"btn btn-primary 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></div>"
33
+ 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 <span class=\"caret\"></span></button><div class=\"dropdown-menu\" arial-labelledby=\"dropdown-test\"><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></div>"
34
34
 
35
35
  assert_equal expected, actual
36
36
  end
@@ -39,7 +39,7 @@ class SurroundFieldTest < ActionView::TestCase
39
39
  actual = UiBibz::Ui::Core::Forms::Surrounds::SurroundField.new.tap do |sf|
40
40
  sf.button 'Submit'
41
41
  end.render
42
- expected = "<div class=\"input-group\"><div class=\"input-group-btn\"><button class=\"btn-primary btn\">Submit</button></div></div>"
42
+ expected = "<div class=\"input-group ui_surround_field\"><div class=\"input-group-btn\"><button class=\"btn\">Submit</button></div></div>"
43
43
 
44
44
  assert_equal expected, actual
45
45
  end
@@ -50,7 +50,7 @@ class SurroundFieldTest < ActionView::TestCase
50
50
  sf.addon '€'
51
51
  sf.glyph 'pencil'
52
52
  end.render
53
- expected = "<div class=\"input-group\"><div class=\"input-group-btn\"><button class=\"btn-primary btn\">Submit</button></div><span class=\"input-group-addon\">€</span><span class=\"input-group-addon\"><i class=\"glyph fa fa-pencil\"></i></span></div>"
53
+ expected = "<div class=\"input-group ui_surround_field\"><div class=\"input-group-btn\"><button class=\"btn\">Submit</button></div><span class=\"input-group-addon\">€</span><span class=\"input-group-addon\"><i class=\"glyph fa fa-pencil\"></i></span></div>"
54
54
 
55
55
  assert_equal expected, actual
56
56
  end
@@ -14,8 +14,8 @@ class AutoCompleteFieldTest < ActionView::TestCase
14
14
  test 'auto_complete_field with refresh button' do
15
15
  options = options_for_select(2.times.map{ |i| "option #{i}" })
16
16
  actual = UiBibz::Ui::Core::Forms::Texts::AutoCompleteField.new('test', { option_tags: options, refresh: { target: { url: '/'}} }, { id: 'test' }).render
17
- expected = "<div class=\"field-refresh input-group\"><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>
18
- <option value=\"option 1\">option 1</option></datalist><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-datalist&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>"
17
+ 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>
18
+ <option value=\"option 1\">option 1</option></datalist><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-datalist&quot;,&quot;url&quot;:&quot;/&quot;,&quot;data&quot;:[]}}\" class=\"btn-secondary ui-bibz-connect btn input-refresh-button\"><i class=\"glyph fa fa-refresh\"></i> </span></div></div>"
19
19
 
20
20
  assert_equal expected, actual
21
21
  end
@@ -23,8 +23,8 @@ class AutoCompleteFieldTest < ActionView::TestCase
23
23
  test 'auto_complete_field with refresh button and append content' do
24
24
  options = options_for_select(2.times.map{ |i| "option #{i}" })
25
25
  actual = UiBibz::Ui::Core::Forms::Texts::AutoCompleteField.new('test', { option_tags: options, append: 'Append content', refresh: { target: { url: '/'}} }, { id: 'test' }).render
26
- expected = "<div class=\"field-refresh input-group\"><span class=\"input-group-addon\">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>
27
- <option value=\"option 1\">option 1</option></datalist><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-datalist&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>"
26
+ expected = "<div class=\"field-refresh input-group ui_surround_field\"><span class=\"input-group-addon\">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>
27
+ <option value=\"option 1\">option 1</option></datalist><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-datalist&quot;,&quot;url&quot;:&quot;/&quot;,&quot;data&quot;:[]}}\" class=\"btn-secondary ui-bibz-connect btn input-refresh-button\"><i class=\"glyph fa fa-refresh\"></i> </span></div></div>"
28
28
 
29
29
  assert_equal expected, actual
30
30
  end
@@ -32,7 +32,7 @@ class AutoCompleteFieldTest < ActionView::TestCase
32
32
  test 'auto_complete_field with prepend content' do
33
33
  options = options_for_select(2.times.map{ |i| "option #{i}" })
34
34
  actual = UiBibz::Ui::Core::Forms::Texts::AutoCompleteField.new('test', { option_tags: options, prepend: 'Append content' }, { id: 'test' }).render
35
- expected = "<div class=\"input-group\"><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>
35
+ expected = "<div class=\"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>
36
36
  <option value=\"option 1\">option 1</option></datalist><span class=\"input-group-addon\">Append content</span></div>"
37
37
 
38
38
  assert_equal expected, actual
@@ -11,14 +11,14 @@ class TextFieldTest < ActionView::TestCase
11
11
 
12
12
  test 'text_field with prepend and append' do
13
13
  actual = UiBibz::Ui::Core::Forms::Texts::TextField.new('test', append: '1', prepend: '2').render
14
- expected = "<div class=\"input-group\"><span class=\"input-group-addon\">1</span><input type=\"text\" name=\"test\" id=\"test\" class=\"form-control\" /><span class=\"input-group-addon\">2</span></div>"
14
+ expected = "<div class=\"input-group ui_surround_field\"><span class=\"input-group-addon\">1</span><input type=\"text\" name=\"test\" id=\"test\" class=\"form-control\" /><span class=\"input-group-addon\">2</span></div>"
15
15
 
16
16
  assert_equal expected, actual
17
17
  end
18
18
 
19
19
  test 'text_field size' do
20
20
  actual = UiBibz::Ui::Core::Forms::Texts::TextField.new('test', size: :xs, append: '1', prepend: '2').render
21
- expected = "<div class=\"input-group-xs input-group\"><span class=\"input-group-addon\">1</span><input type=\"text\" name=\"test\" id=\"test\" class=\"form-control\" /><span class=\"input-group-addon\">2</span></div>"
21
+ expected = "<div class=\"input-group-xs input-group ui_surround_field\"><span class=\"input-group-addon\">1</span><input type=\"text\" name=\"test\" id=\"test\" class=\"form-control\" /><span class=\"input-group-addon\">2</span></div>"
22
22
 
23
23
  assert_equal expected, actual
24
24
  end
@@ -1,7 +1,7 @@
1
1
  # encoding: UTF-8
2
2
  require 'test_helper'
3
3
 
4
- class UiHelperTest < ActionView::TestCase
4
+ class JumbotronTest < ActionView::TestCase
5
5
  include UiBibz::Helpers::Ui::CoreHelper
6
6
 
7
7
  test 'jumbotron with full_width' do
@@ -11,7 +11,7 @@ class ListGroupTest < ActionView::TestCase
11
11
  l.body 'My body'
12
12
  end
13
13
  end
14
- expected = "<div class=\"list-group\"><a class=\"list-group-item-success list-group-item\" href=\"#momo\">Momo</a><a type=\"link\" class=\"list-group-item\" href=\"#state\"><h4 class=\"list-group-item-heading\">My title</h4><p class=\"list-group-item-text\">My body</p></a></div>"
14
+ expected = "<ul class=\"list-group\"><li href=\"#momo\" class=\"list-group-item-success list-group-item\">Momo</li><li href=\"#state\" class=\"list-group-item flex-column align-items-start\"><div class=\"d-flex w-100 justify-content-between\"><h5 class=\"mb-1\">My title</h5><small></small></div><p class=\"mb-1\">My body</p><small></small></li></ul>"
15
15
 
16
16
  assert_equal expected, actual
17
17
  end
@@ -20,7 +20,7 @@ class ListGroupTest < ActionView::TestCase
20
20
  actual = ui_list_group(type: :link) do |lg|
21
21
  lg.list 'Lulu'
22
22
  lg.list 'state'
23
- end.render
23
+ end
24
24
  expected = "<ul class=\"list-group\"><li class=\"list-group-item\">Lulu</li><li class=\"list-group-item\">state</li></ul>"
25
25
 
26
26
  assert_equal expected, actual
@@ -1,5 +1,6 @@
1
1
  require 'test_helper'
2
2
  class NavTest < ActionView::TestCase
3
+ include UiBibz::Helpers::Ui::CoreHelper
3
4
 
4
5
  test 'Nav with tab' do
5
6
  actual = ui_nav(type: :tabs) do |n|
@@ -12,12 +13,45 @@ class NavTest < ActionView::TestCase
12
13
  end
13
14
 
14
15
  test 'Nav with pills' do
15
- actual = ui_nav(type: :pills, position: :justified) do |n|
16
+ actual = ui_nav(type: :pills) do |n|
16
17
  n.link 'Home', state: :active, url: "#Home", selector: 'home'
17
18
  n.link 'Profile', url: "#profile", selector: 'profile', label: 16
18
19
  n.link 'Messages', url: "#messages", selector: 'messages', state: :disabled
19
20
  end
20
- expected = "<ul class=\"nav nav-pills pull-justified\"><li class=\"nav-item\"><a class=\"active nav-link\" href=\"#Home\">Home</a></li><li class=\"nav-item\"><a class=\"nav-link\" href=\"#profile\">Profile</a></li><li class=\"nav-item\"><a class=\"disabled nav-link\" href=\"#messages\">Messages</a></li></ul>"
21
+ expected = "<ul class=\"nav nav-pills\"><li class=\"nav-item\"><a class=\"active nav-link\" href=\"#Home\">Home</a></li><li class=\"nav-item\"><a class=\"nav-link\" href=\"#profile\">Profile</a></li><li class=\"nav-item\"><a class=\"disabled nav-link\" href=\"#messages\">Messages</a></li></ul>"
22
+
23
+ assert_equal expected, actual
24
+ end
25
+
26
+ test 'Position' do
27
+ actual = ui_nav(position: :right) do |n|
28
+ n.link 'Home', state: :active, url: "#Home", selector: 'home'
29
+ n.link 'Profile', url: "#profile", selector: 'profile', label: 16
30
+ n.link 'Messages', url: "#messages", selector: 'messages', state: :disabled
31
+ end
32
+ expected = "<ul class=\"nav justify-content-end\"><li class=\"nav-item\"><a class=\"active nav-link\" href=\"#Home\">Home</a></li><li class=\"nav-item\"><a class=\"nav-link\" href=\"#profile\">Profile</a></li><li class=\"nav-item\"><a class=\"disabled nav-link\" href=\"#messages\">Messages</a></li></ul>"
33
+
34
+ assert_equal expected, actual
35
+ end
36
+
37
+ test 'Justified' do
38
+ actual = ui_nav(justified: true) do |n|
39
+ n.link 'Home', state: :active, url: "#Home", selector: 'home'
40
+ n.link 'Profile', url: "#profile", selector: 'profile', label: 16
41
+ n.link 'Messages', url: "#messages", selector: 'messages', state: :disabled
42
+ end
43
+ expected = "<ul class=\"nav\"><li class=\"nav-item\"><a class=\"active nav-link\" href=\"#Home\">Home</a></li><li class=\"nav-item\"><a class=\"nav-link\" href=\"#profile\">Profile</a></li><li class=\"nav-item\"><a class=\"disabled nav-link\" href=\"#messages\">Messages</a></li></ul>"
44
+
45
+ assert_equal expected, actual
46
+ end
47
+
48
+ test 'stacked' do
49
+ actual = ui_nav(stacked: true) do |n|
50
+ n.link 'Home', state: :active, url: "#Home", selector: 'home'
51
+ n.link 'Profile', url: "#profile", selector: 'profile', label: 16
52
+ n.link 'Messages', url: "#messages", selector: 'messages', state: :disabled
53
+ end
54
+ expected = "<ul class=\"nav flex-column\"><li class=\"nav-item\"><a class=\"active nav-link\" href=\"#Home\">Home</a></li><li class=\"nav-item\"><a class=\"nav-link\" href=\"#profile\">Profile</a></li><li class=\"nav-item\"><a class=\"disabled nav-link\" href=\"#messages\">Messages</a></li></ul>"
21
55
 
22
56
  assert_equal expected, actual
23
57
  end
@@ -31,7 +31,19 @@ class NavbarTest < ActionView::TestCase
31
31
  end
32
32
  nb.text 'test'
33
33
  end
34
- expected = "<nav class=\"navbar navbar-light navbar-expand-lg\"><a class=\"navbar-brand\" href=\"/\">Brand</a><button class=\"navbar-toggler hidden-sm-up\" type=\"button\" data-toggle=\"collapse\" data-target=\"##{ actual.id }\">☰</button><div class=\"collapse navbar-collapse\" id=\"#{ actual.id }\"><ul class=\"navbar-nav mr-auto\"><li class=\"nav-item\"><a class=\"active nav-link\" href=\"#Home\">Home</a></li><li class=\"nav-item\"><a class=\"nav-link\" href=\"#profile\">Profile</a></li><li class=\"nav-item\"><a class=\"nav-link\" href=\"#messages\">Messages</a></li></ul><form type=\"form_tag\" position=\"right\" class=\"navbar-form form-inline pull-right\" action=\"#\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><button class=\"btn-primary btn\">Search</button></form><span class=\"navbar-text\">test</span></div></nav>"
34
+ expected = "<nav class=\"navbar navbar-light navbar-expand-lg\"><a class=\"navbar-brand\" href=\"/\">Brand</a><button class=\"navbar-toggler hidden-sm-up\" type=\"button\" data-toggle=\"collapse\" data-target=\"##{ actual.id }\">☰</button><div class=\"collapse navbar-collapse\" id=\"#{ actual.id }\"><ul class=\"navbar-nav\"><li class=\"nav-item\"><a class=\"active nav-link\" href=\"#Home\">Home</a></li><li class=\"nav-item\"><a class=\"nav-link\" href=\"#profile\">Profile</a></li><li class=\"nav-item\"><a class=\"nav-link\" href=\"#messages\">Messages</a></li></ul><form type=\"form_tag\" position=\"right\" class=\"navbar-form form-inline pull-right my-2 my-lg-0\" action=\"#\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><button class=\"btn\">Search</button></form><span class=\"navbar-text\">test</span></div></nav>"
35
+
36
+ assert_equal expected, actual.render
37
+ end
38
+
39
+ test 'status' do
40
+ actual = UiBibz::Ui::Core::Navs::Navbar.new(type: :dark, status: :dark).tap do |nb|
41
+ nb.brand image_tag 'ruby-white'
42
+ nb.nav do |n|
43
+ n.link 'Link', url: '#link'
44
+ end
45
+ end
46
+ expected = "<nav class=\"bg-dark navbar navbar-dark navbar-expand-lg\"><a class=\"navbar-brand\" href=\"/\"><img src=\"/images/ruby-white\" alt=\"Ruby white\" /></a><button class=\"navbar-toggler hidden-sm-up\" type=\"button\" data-toggle=\"collapse\" data-target=\"##{ actual.id }\">☰</button><div class=\"collapse navbar-collapse\" id=\"#{ actual.id }\"><ul class=\"navbar-nav\"><li class=\"nav-item\"><a class=\"nav-link\" href=\"#link\">Link</a></li></ul></div></nav>"
35
47
 
36
48
  assert_equal expected, actual.render
37
49
  end
@@ -4,7 +4,7 @@ class BreadcrumbTest < ActionView::TestCase
4
4
  include UiBibz::Helpers::Ui::CoreHelper
5
5
 
6
6
  test 'breadcrumb' do
7
- actual = ui_breadcrumb do |b|
7
+ actual = ui_breadcrumb tap: true do |b|
8
8
  b.link 'Home', url: '#home', glyph: 'home'
9
9
  b.link 'state', { url: '#state', state: :active }
10
10
  end
@@ -1,12 +1,50 @@
1
1
  # encoding: UTF-8
2
2
  require 'test_helper'
3
3
 
4
- class UiHelperTest < ActionView::TestCase
4
+ class ProgressTest < ActionView::TestCase
5
5
  include UiBibz::Helpers::Ui::CoreHelper
6
6
 
7
7
  test 'progress bar' do
8
- actual = ui_progress(20)
9
- expected = "<progress class=\"progress\" max=\"100\" value=\"20\">20</progress>"
8
+ actual = ui_progress_bar(20)
9
+ expected = "<div class=\"progress\"><div class=\"progress-bar\" aria-valuenow=\"20.0\" aria-valuemin=\"0\" aria-valuemax=\"100\" style=\"width: 20.0%\" role=\"progressbar\"></div></div>"
10
+
11
+ assert_equal expected, actual
12
+ end
13
+
14
+ test 'progress bar status' do
15
+ actual = ui_progress_bar(70, status: :danger)
16
+ expected = "<div class=\"progress\"><div class=\"bg-danger progress-bar\" aria-valuenow=\"70.0\" aria-valuemin=\"0\" aria-valuemax=\"100\" style=\"width: 70.0%\" role=\"progressbar\"></div></div>"
17
+
18
+ assert_equal expected, actual
19
+ end
20
+
21
+ test 'progress bar striped' do
22
+ actual = ui_progress_bar(70, striped: true)
23
+ expected = "<div class=\"progress\"><div class=\"progress-bar progress-bar-striped\" aria-valuenow=\"70.0\" aria-valuemin=\"0\" aria-valuemax=\"100\" style=\"width: 70.0%\" role=\"progressbar\"></div></div>"
24
+
25
+ assert_equal expected, actual
26
+ end
27
+
28
+ test 'progress bar animated' do
29
+ actual = ui_progress_bar(70, animated: true)
30
+ expected = "<div class=\"progress\"><div class=\"progress-bar progress-bar-animated\" aria-valuenow=\"70.0\" aria-valuemin=\"0\" aria-valuemax=\"100\" style=\"width: 70.0%\" role=\"progressbar\"></div></div>"
31
+
32
+ assert_equal expected, actual
33
+ end
34
+
35
+ test 'progress bar stacked' do
36
+ actual = ui_progress_bar(76, animated: true)
37
+ expected = "<div class=\"progress\"><div class=\"progress-bar progress-bar-animated\" aria-valuenow=\"76.0\" aria-valuemin=\"0\" aria-valuemax=\"100\" style=\"width: 76.0%\" role=\"progressbar\"></div></div>"
38
+
39
+ assert_equal expected, actual
40
+ end
41
+
42
+ test 'progress bar custom' do
43
+ actual = ui_progress_bar tap: true do |pb|
44
+ pb.bar 25, status: :warning, striped: true
45
+ pb.bar 65, status: :danger
46
+ end
47
+ expected = "<div class=\"progress\"><div class=\"bg-warning progress-bar progress-bar-striped\" aria-valuenow=\"25.0\" aria-valuemin=\"0\" aria-valuemax=\"100\" style=\"width: 25.0%\" role=\"progressbar\"></div><div class=\"bg-danger progress-bar\" aria-valuenow=\"65.0\" aria-valuemin=\"0\" aria-valuemax=\"100\" style=\"width: 65.0%\" role=\"progressbar\"></div></div>"
10
48
 
11
49
  assert_equal expected, actual
12
50
  end
@@ -1,6 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class StarTest < ActionView::TestCase
4
+ include UiBibz::Helpers::Ui::CoreHelper
4
5
 
5
6
  test "stars with 1" do
6
7
  actual = ui_star(1)
@@ -27,7 +28,7 @@ class StarTest < ActionView::TestCase
27
28
  end
28
29
 
29
30
  test "stars with 5" do
30
- actual = ui_star.new(5)
31
+ actual = ui_star(5)
31
32
  expected = "<span class=\"stars-notation\"><i class=\"glyph fa fa-star\"></i> <i class=\"glyph fa fa-star\"></i> <i class=\"glyph fa fa-star\"></i> <i class=\"glyph fa fa-star\"></i> <i class=\"glyph fa fa-star\"></i></span>"
32
33
  assert_equal expected, actual
33
34
  end
@@ -13,7 +13,7 @@ class UiHelperTest < ActionView::TestCase
13
13
  concat ui_button_link 'Save', url: '#', status: :primary
14
14
  end
15
15
  end
16
- expected = "<div class=\"modal\"><div class=\"modal-dialog \" role=\"document\"><div class=\"modal-content\"><div class=\"modal-header\"><button class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span><span class=\"sr-only\">Close</span></button><h4 class=\"modal-title\">My title</h4></div><div class=\"modal-body\">My body</div><div class=\"modal-footer\"><a class=\"btn-link btn\" href=\"#\">Close</a><a class=\"btn-primary btn\" href=\"#\">Save</a></div></div></div></div>"
16
+ expected = "<div class=\"modal\"><div class=\"modal-dialog \" role=\"document\"><div class=\"modal-content\"><div class=\"modal-header\"><h5 class=\"modal-title\">My title</h5><button class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span><span class=\"sr-only\">Close</span></button></div><div class=\"modal-body\">My body</div><div class=\"modal-footer\"><a class=\"btn-link btn\" role=\"button\" href=\"#\">Close</a><a class=\"btn-primary btn\" role=\"button\" href=\"#\">Save</a></div></div></div></div>"
17
17
 
18
18
  assert_equal expected, actual
19
19
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ui_bibz
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.beta2.2
4
+ version: 2.0.0.beta2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thooams
@@ -483,7 +483,6 @@ files:
483
483
  - test/ui/core/windows/modal_test.rb
484
484
  - test/ui/ux/tables/table_test.rb
485
485
  - test/ui_bibz_test.rb
486
- - ui_bibz-2.0.0.beta2.gem
487
486
  - ui_bibz.gemspec
488
487
  - vendor/assets/images/switch.png
489
488
  - vendor/assets/javascripts/bootstrap-datepicker.min.js
Binary file