ui_bibz 2.0.0.alpha14 → 2.0.0.alpha15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/app/inputs/custom_inputs/autocomplete_input.rb +2 -2
- data/app/inputs/custom_inputs/date_picker_input.rb +2 -2
- data/app/inputs/custom_inputs/dropdown_select_input.rb +2 -2
- data/app/inputs/custom_inputs/formula_input.rb +2 -2
- data/app/inputs/custom_inputs/markdown_editor_input.rb +2 -2
- data/app/inputs/custom_inputs/multi_column_input.rb +2 -2
- data/app/inputs/custom_inputs/multi_select_input.rb +2 -2
- data/app/inputs/custom_inputs/surround_input.rb +2 -2
- data/app/inputs/custom_inputs/switch_input.rb +2 -2
- data/lib/ui_bibz/helpers/ui_core_helper.rb +189 -25
- data/lib/ui_bibz/helpers/ui_ux_helper.rb +38 -11
- data/lib/ui_bibz/ui/core/{button → buttons}/button.rb +6 -17
- data/lib/ui_bibz/ui/core/{button → buttons}/button_choice.rb +8 -8
- data/lib/ui_bibz/ui/core/{button → buttons}/button_dropdown.rb +6 -6
- data/lib/ui_bibz/ui/core/{button → buttons}/button_group.rb +6 -6
- data/lib/ui_bibz/ui/core/{button → buttons}/button_link.rb +8 -8
- data/lib/ui_bibz/ui/core/{button → buttons}/button_split_dropdown.rb +5 -5
- data/lib/ui_bibz/ui/core/{card → cards}/card.rb +13 -13
- data/lib/ui_bibz/ui/core/{card → cards}/card_column.rb +7 -7
- data/lib/ui_bibz/ui/core/{card → cards}/card_deck.rb +7 -7
- data/lib/ui_bibz/ui/core/{card → cards}/card_group.rb +7 -7
- data/lib/ui_bibz/ui/core/{card → cards}/components/block/card_block_link.rb +6 -6
- data/lib/ui_bibz/ui/core/{card → cards}/components/block/card_block_text.rb +6 -6
- data/lib/ui_bibz/ui/core/{card → cards}/components/block/card_block_title.rb +6 -6
- data/lib/ui_bibz/ui/core/{card → cards}/components/card_block.rb +9 -9
- data/lib/ui_bibz/ui/core/{card → cards}/components/card_footer.rb +6 -6
- data/lib/ui_bibz/ui/core/{card → cards}/components/card_header.rb +6 -6
- data/lib/ui_bibz/ui/core/{card → cards}/components/card_image.rb +6 -6
- data/lib/ui_bibz/ui/core/{card → cards}/components/card_list_group.rb +5 -5
- data/lib/ui_bibz/ui/core/{input → inputs}/autocomplete_field.rb +6 -6
- data/lib/ui_bibz/ui/core/{input → inputs}/date_picker_field.rb +20 -19
- data/lib/ui_bibz/ui/core/{input → inputs}/dropdown_select_field.rb +5 -5
- data/lib/ui_bibz/ui/core/{input → inputs}/formula_field.rb +6 -6
- data/lib/ui_bibz/ui/core/{input → inputs}/markdown_editor_field.rb +6 -6
- data/lib/ui_bibz/ui/core/{input → inputs}/multi_column_field.rb +6 -6
- data/lib/ui_bibz/ui/core/{input → inputs}/multi_select_field.rb +8 -8
- data/lib/ui_bibz/ui/core/{input → inputs}/surround_field.rb +6 -6
- data/lib/ui_bibz/ui/core/{input → inputs}/switch_field.rb +4 -4
- data/lib/ui_bibz/ui/core/jumbotron.rb +2 -2
- data/lib/ui_bibz/ui/core/{layout → layouts}/col.rb +6 -6
- data/lib/ui_bibz/ui/core/{layout → layouts}/container.rb +6 -6
- data/lib/ui_bibz/ui/core/{layout → layouts}/row.rb +4 -4
- data/lib/ui_bibz/ui/core/list/list_group.rb +1 -1
- data/lib/ui_bibz/ui/core/{nav → navs}/components/nav_dropdown.rb +6 -6
- data/lib/ui_bibz/ui/core/{nav → navs}/components/nav_link.rb +11 -11
- data/lib/ui_bibz/ui/core/{nav → navs}/components/nav_link_link.rb +3 -2
- data/lib/ui_bibz/ui/core/{nav → navs}/components/nav_link_list.rb +2 -2
- data/lib/ui_bibz/ui/core/{nav → navs}/components/navbar_brand.rb +2 -2
- data/lib/ui_bibz/ui/core/{nav → navs}/components/navbar_form.rb +4 -5
- data/lib/ui_bibz/ui/core/{nav → navs}/components/navbar_nav.rb +7 -7
- data/lib/ui_bibz/ui/core/{nav → navs}/components/navbar_text.rb +6 -6
- data/lib/ui_bibz/ui/core/{nav → navs}/nav.rb +9 -9
- data/lib/ui_bibz/ui/core/{nav → navs}/navbar.rb +9 -9
- data/lib/ui_bibz/ui/ux/{table → tables}/components/actions.rb +1 -1
- data/lib/ui_bibz/ui/ux/{table → tables}/components/as.rb +1 -1
- data/lib/ui_bibz/ui/ux/{table → tables}/components/column.rb +1 -1
- data/lib/ui_bibz/ui/ux/{table → tables}/components/columns.rb +1 -1
- data/lib/ui_bibz/ui/ux/{table → tables}/components/store.rb +3 -3
- data/lib/ui_bibz/ui/ux/{table → tables}/components/thead.rb +1 -1
- data/lib/ui_bibz/ui/ux/{table → tables}/extensions/actionable.rb +2 -2
- data/lib/ui_bibz/ui/ux/{table → tables}/extensions/paginable.rb +3 -3
- data/lib/ui_bibz/ui/ux/{table → tables}/extensions/searchable.rb +1 -1
- data/lib/ui_bibz/ui/ux/{table → tables}/extensions/sortable.rb +1 -1
- data/lib/ui_bibz/ui/ux/{table → tables}/table.rb +17 -17
- data/lib/ui_bibz/ui/ux/{table → tables}/table_card.rb +10 -10
- data/lib/ui_bibz/ui/ux/{table → tables}/table_pagination.rb +3 -3
- data/lib/ui_bibz/ui/ux/{table → tables}/table_pagination_per_page.rb +3 -3
- data/lib/ui_bibz/ui/ux/{table → tables}/table_search_field.rb +3 -2
- data/lib/ui_bibz/version.rb +1 -1
- data/lib/ui_bibz.rb +45 -29
- data/test/store_test.rb +2 -2
- data/test/ui/button_test.rb +15 -15
- data/test/ui/grid_test.rb +3 -3
- data/test/ui/input_dropdown_select_field_test.rb +9 -9
- data/test/ui/input_switch_field_test.rb +10 -10
- data/test/ui/inputs_test.rb +13 -13
- data/test/ui/nav_test.rb +2 -2
- data/test/ui/table_test.rb +26 -26
- metadata +57 -57
data/test/ui/button_test.rb
CHANGED
@@ -4,15 +4,15 @@ include UiBibz::Helpers
|
|
4
4
|
class ButtonTest < ActionView::TestCase
|
5
5
|
|
6
6
|
test "button" do
|
7
|
-
actual = UiBibz::Ui::Core::Button.new('state', status: :success).render
|
7
|
+
actual = UiBibz::Ui::Core::Buttons::Button.new('state', status: :success).render
|
8
8
|
expected = "<button class=\"btn-success btn\">state</button>"
|
9
9
|
|
10
10
|
assert_equal expected, actual
|
11
11
|
end
|
12
12
|
|
13
13
|
test 'button group' do
|
14
|
-
actual = UiBibz::Ui::Core::ButtonGroup.new position: :vertical do
|
15
|
-
UiBibz::Ui::Core::Button.new('state').render
|
14
|
+
actual = UiBibz::Ui::Core::Buttons::ButtonGroup.new position: :vertical do
|
15
|
+
UiBibz::Ui::Core::Buttons::Button.new('state').render
|
16
16
|
end.render
|
17
17
|
expected = "<div data-toggle=\"buttons\" class=\"btn-group btn-group-vertical\" role=\"group\"><button class=\"btn-primary btn\">state</button></div>"
|
18
18
|
|
@@ -20,37 +20,37 @@ class ButtonTest < ActionView::TestCase
|
|
20
20
|
end
|
21
21
|
|
22
22
|
test 'link button' do
|
23
|
-
actual = UiBibz::Ui::Core::ButtonLink.new('state', { url: users_path, status: :danger, glyph: 'add'}).render
|
23
|
+
actual = UiBibz::Ui::Core::Buttons::ButtonLink.new('state', { url: users_path, status: :danger, glyph: 'add'}).render
|
24
24
|
expected = "<a class=\"btn-danger btn\" href=\"/users\"><i class=\"glyph fa fa-add\"></i> state</a>"
|
25
25
|
|
26
26
|
assert_equal expected, actual
|
27
27
|
end
|
28
28
|
|
29
29
|
test 'button outline' do
|
30
|
-
actual = UiBibz::Ui::Core::Button.new('state', status: :success, outline: true).render
|
30
|
+
actual = UiBibz::Ui::Core::Buttons::Button.new('state', status: :success, outline: true).render
|
31
31
|
expected = "<button class=\"btn-success-outline btn\">state</button>"
|
32
32
|
|
33
33
|
assert_equal expected, actual
|
34
34
|
end
|
35
35
|
|
36
36
|
test 'checkbox button checked' do
|
37
|
-
actual = UiBibz::Ui::Core::ButtonChoice.new('state', { state: :active }).render
|
37
|
+
actual = UiBibz::Ui::Core::Buttons::ButtonChoice.new('state', { state: :active }).render
|
38
38
|
expected = "<label class=\"active btn-primary btn\"><input type=\"checkbox\" autocomplete=\"off\" checked=\"checked\" />state</label>"
|
39
39
|
|
40
40
|
assert_equal expected, actual
|
41
41
|
end
|
42
42
|
|
43
43
|
test 'checkbox button non checked' do
|
44
|
-
actual = UiBibz::Ui::Core::ButtonChoice.new('state', { name: 'state', id: 'state', input_html_options: { class: 'state'}}).render
|
44
|
+
actual = UiBibz::Ui::Core::Buttons::ButtonChoice.new('state', { name: 'state', id: 'state', input_html_options: { class: 'state'}}).render
|
45
45
|
expected = "<label class=\"btn-primary btn\"><input type=\"checkbox\" autocomplete=\"off\" name=\"state\" id=\"state\" class=\"state\" />state</label>"
|
46
46
|
|
47
47
|
assert_equal expected, actual
|
48
48
|
end
|
49
49
|
|
50
50
|
test 'button group choice checkbox' do
|
51
|
-
actual = UiBibz::Ui::Core::ButtonGroup.new do
|
52
|
-
concat UiBibz::Ui::Core::ButtonChoice.new('state1').render
|
53
|
-
concat UiBibz::Ui::Core::ButtonChoice.new('state2').render
|
51
|
+
actual = UiBibz::Ui::Core::Buttons::ButtonGroup.new do
|
52
|
+
concat UiBibz::Ui::Core::Buttons::ButtonChoice.new('state1').render
|
53
|
+
concat UiBibz::Ui::Core::Buttons::ButtonChoice.new('state2').render
|
54
54
|
end.render
|
55
55
|
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>"
|
56
56
|
|
@@ -58,9 +58,9 @@ class ButtonTest < ActionView::TestCase
|
|
58
58
|
end
|
59
59
|
|
60
60
|
test 'button group choice radio' do
|
61
|
-
actual = UiBibz::Ui::Core::ButtonGroup.new do
|
62
|
-
concat UiBibz::Ui::Core::ButtonChoice.new('state1', type: :radio).render
|
63
|
-
concat UiBibz::Ui::Core::ButtonChoice.new('state2', type: :radio).render
|
61
|
+
actual = UiBibz::Ui::Core::Buttons::ButtonGroup.new do
|
62
|
+
concat UiBibz::Ui::Core::Buttons::ButtonChoice.new('state1', type: :radio).render
|
63
|
+
concat UiBibz::Ui::Core::Buttons::ButtonChoice.new('state2', type: :radio).render
|
64
64
|
end.render
|
65
65
|
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>"
|
66
66
|
|
@@ -68,7 +68,7 @@ class ButtonTest < ActionView::TestCase
|
|
68
68
|
end
|
69
69
|
|
70
70
|
test 'button dropdown' do
|
71
|
-
actual = UiBibz::Ui::Core::ButtonDropdown.new("Dropdown", type: :dropup, status: :success).tap do |d|
|
71
|
+
actual = UiBibz::Ui::Core::Buttons::ButtonDropdown.new("Dropdown", type: :dropup, status: :success).tap do |d|
|
72
72
|
d.link 'state'
|
73
73
|
d.header 'header'
|
74
74
|
d.link 'momo'
|
@@ -81,7 +81,7 @@ class ButtonTest < ActionView::TestCase
|
|
81
81
|
end
|
82
82
|
|
83
83
|
test 'button split dropdown' do
|
84
|
-
actual = UiBibz::Ui::Core::ButtonSplitDropdown.new("Dropdown", type: :dropup, status: :primary).tap do |d|
|
84
|
+
actual = UiBibz::Ui::Core::Buttons::ButtonSplitDropdown.new("Dropdown", type: :dropup, status: :primary).tap do |d|
|
85
85
|
d.link 'state'
|
86
86
|
d.header 'header'
|
87
87
|
d.link 'momo'
|
data/test/ui/grid_test.rb
CHANGED
@@ -4,7 +4,7 @@ include UiBibz::Helpers
|
|
4
4
|
class GridTest < ActionView::TestCase
|
5
5
|
|
6
6
|
test 'row' do
|
7
|
-
actual = UiBibz::Ui::Core::Row.new(class: 'test') do
|
7
|
+
actual = UiBibz::Ui::Core::Layouts::Row.new(class: 'test') do
|
8
8
|
'test'
|
9
9
|
end.render
|
10
10
|
expected = "<div class=\"test row\">test</div>"
|
@@ -13,14 +13,14 @@ class GridTest < ActionView::TestCase
|
|
13
13
|
end
|
14
14
|
|
15
15
|
test "col" do
|
16
|
-
actual = UiBibz::Ui::Core::Col.new('test', { num: 1, push: 2, offset: 3, pull: 4 }, { class: 'test' }).render
|
16
|
+
actual = UiBibz::Ui::Core::Layouts::Col.new('test', { num: 1, push: 2, offset: 3, pull: 4 }, { class: 'test' }).render
|
17
17
|
expected = "<div class=\"test col-md-1 col-md-push-2 col-md-offset-3 col-md-pull-4\">test</div>"
|
18
18
|
|
19
19
|
assert_equal expected, actual
|
20
20
|
end
|
21
21
|
|
22
22
|
test "col with several cols" do
|
23
|
-
actual = UiBibz::Ui::Core::Col.new(md: { num: 1, push: 2, pull: 4 }, xl: { num: 6, offset: 5 }, class: 'test') do
|
23
|
+
actual = UiBibz::Ui::Core::Layouts::Col.new(md: { num: 1, push: 2, pull: 4 }, xl: { num: 6, offset: 5 }, class: 'test') do
|
24
24
|
"test"
|
25
25
|
end.render
|
26
26
|
expected = "<div class=\"test col-md-1 col-md-push-2 col-md-pull-4 col-xl-6 col-xl-offset-5\">test</div>"
|
@@ -5,7 +5,7 @@ class InputDropdownSelectFieldTest < ActionView::TestCase
|
|
5
5
|
|
6
6
|
test 'dropdowm_select_field' do
|
7
7
|
options = options_for_select(2.times.map{ |i| "option #{i}" })
|
8
|
-
actual = UiBibz::Ui::Core::DropdownSelectField.new('test', options_tags: options).render
|
8
|
+
actual = UiBibz::Ui::Core::Inputs::DropdownSelectField.new('test', options_tags: options).render
|
9
9
|
expected = "<select name=\"test\" id=\"test\" class=\"selectpicker\"></select>"
|
10
10
|
|
11
11
|
assert_equal expected, actual
|
@@ -13,7 +13,7 @@ class InputDropdownSelectFieldTest < ActionView::TestCase
|
|
13
13
|
|
14
14
|
test 'dropdowm_select_field searchable' do
|
15
15
|
options = options_for_select(2.times.map{ |i| "option #{i}" })
|
16
|
-
actual = UiBibz::Ui::Core::DropdownSelectField.new('test', { options_tags: options, searchable: true }).render
|
16
|
+
actual = UiBibz::Ui::Core::Inputs::DropdownSelectField.new('test', { options_tags: options, searchable: true }).render
|
17
17
|
expected = "<select name=\"test\" id=\"test\" data-live-search=\"true\" class=\"selectpicker\"></select>"
|
18
18
|
|
19
19
|
assert_equal expected, actual
|
@@ -21,7 +21,7 @@ class InputDropdownSelectFieldTest < ActionView::TestCase
|
|
21
21
|
|
22
22
|
test 'dropdowm_select_field max_options' do
|
23
23
|
options = options_for_select(2.times.map{ |i| "option #{i}" })
|
24
|
-
actual = UiBibz::Ui::Core::DropdownSelectField.new('test', { options_tags: options, max_options: 2 }).render
|
24
|
+
actual = UiBibz::Ui::Core::Inputs::DropdownSelectField.new('test', { options_tags: options, max_options: 2 }).render
|
25
25
|
expected = "<select name=\"test\" id=\"test\" data-max-options=\"2\" class=\"selectpicker\"></select>"
|
26
26
|
|
27
27
|
assert_equal expected, actual
|
@@ -29,7 +29,7 @@ class InputDropdownSelectFieldTest < ActionView::TestCase
|
|
29
29
|
|
30
30
|
test 'dropdowm_select_field selected_text_format' do
|
31
31
|
options = options_for_select(2.times.map{ |i| "option #{i}" })
|
32
|
-
actual = UiBibz::Ui::Core::DropdownSelectField.new('test', { options_tags: options, selected_text_format: "count > x" }).render
|
32
|
+
actual = UiBibz::Ui::Core::Inputs::DropdownSelectField.new('test', { options_tags: options, selected_text_format: "count > x" }).render
|
33
33
|
expected = "<select name=\"test\" id=\"test\" data-selected-text-format=\"count > x\" class=\"selectpicker\"></select>"
|
34
34
|
|
35
35
|
assert_equal expected, actual
|
@@ -37,7 +37,7 @@ class InputDropdownSelectFieldTest < ActionView::TestCase
|
|
37
37
|
|
38
38
|
test 'dropdowm_select_field menu_size' do
|
39
39
|
options = options_for_select(2.times.map{ |i| "option #{i}" })
|
40
|
-
actual = UiBibz::Ui::Core::DropdownSelectField.new('test', { options_tags: options, menu_size: 2 }).render
|
40
|
+
actual = UiBibz::Ui::Core::Inputs::DropdownSelectField.new('test', { options_tags: options, menu_size: 2 }).render
|
41
41
|
expected = "<select name=\"test\" id=\"test\" data-size=\"2\" class=\"selectpicker\"></select>"
|
42
42
|
|
43
43
|
assert_equal expected, actual
|
@@ -45,7 +45,7 @@ class InputDropdownSelectFieldTest < ActionView::TestCase
|
|
45
45
|
|
46
46
|
test 'dropdowm_select_field actions_box' do
|
47
47
|
options = options_for_select(2.times.map{ |i| "option #{i}" })
|
48
|
-
actual = UiBibz::Ui::Core::DropdownSelectField.new('test', { options_tags: options, actions_box: true }).render
|
48
|
+
actual = UiBibz::Ui::Core::Inputs::DropdownSelectField.new('test', { options_tags: options, actions_box: true }).render
|
49
49
|
expected = "<select name=\"test\" id=\"test\" data-actions-box=\"true\" class=\"selectpicker\"></select>"
|
50
50
|
|
51
51
|
assert_equal expected, actual
|
@@ -53,7 +53,7 @@ class InputDropdownSelectFieldTest < ActionView::TestCase
|
|
53
53
|
|
54
54
|
test 'dropdowm_select_field show_tick' do
|
55
55
|
options = options_for_select(2.times.map{ |i| "option #{i}" })
|
56
|
-
actual = UiBibz::Ui::Core::DropdownSelectField.new('test', { options_tags: options, show_tick: true }).render
|
56
|
+
actual = UiBibz::Ui::Core::Inputs::DropdownSelectField.new('test', { options_tags: options, show_tick: true }).render
|
57
57
|
expected = "<select name=\"test\" id=\"test\" class=\"selectpicker show-tick\"></select>"
|
58
58
|
|
59
59
|
assert_equal expected, actual
|
@@ -61,7 +61,7 @@ class InputDropdownSelectFieldTest < ActionView::TestCase
|
|
61
61
|
|
62
62
|
test 'dropdowm_select_field show_menu_arrow' do
|
63
63
|
options = options_for_select(2.times.map{ |i| "option #{i}" })
|
64
|
-
actual = UiBibz::Ui::Core::DropdownSelectField.new('test', { options_tags: options, show_menu_arrow: true }).render
|
64
|
+
actual = UiBibz::Ui::Core::Inputs::DropdownSelectField.new('test', { options_tags: options, show_menu_arrow: true }).render
|
65
65
|
expected = "<select name=\"test\" id=\"test\" class=\"selectpicker show-menu-arrow\"></select>"
|
66
66
|
|
67
67
|
assert_equal expected, actual
|
@@ -69,7 +69,7 @@ class InputDropdownSelectFieldTest < ActionView::TestCase
|
|
69
69
|
|
70
70
|
test 'dropdowm_select_field dropup' do
|
71
71
|
options = options_for_select(2.times.map{ |i| "option #{i}" })
|
72
|
-
actual = UiBibz::Ui::Core::DropdownSelectField.new('test', { options_tags: options, dropup: true }).render
|
72
|
+
actual = UiBibz::Ui::Core::Inputs::DropdownSelectField.new('test', { options_tags: options, dropup: true }).render
|
73
73
|
expected = "<select name=\"test\" id=\"test\" class=\"selectpicker dropup\"></select>"
|
74
74
|
|
75
75
|
assert_equal expected, actual
|
@@ -5,7 +5,7 @@ class InputsSwitchFieldTest < ActionView::TestCase
|
|
5
5
|
|
6
6
|
# OK
|
7
7
|
test 'switch_field size' do
|
8
|
-
actual = UiBibz::Ui::Core::SwitchField.new('test', size: :lg).render
|
8
|
+
actual = UiBibz::Ui::Core::Inputs::SwitchField.new('test', size: :lg).render
|
9
9
|
expected = "<input type=\"checkbox\" name=\"test\" id=\"test\" data-size=\"large\" class=\"switch\" />"
|
10
10
|
|
11
11
|
assert_equal expected, actual
|
@@ -13,7 +13,7 @@ class InputsSwitchFieldTest < ActionView::TestCase
|
|
13
13
|
|
14
14
|
# OK
|
15
15
|
test 'switch_field animate' do
|
16
|
-
actual = UiBibz::Ui::Core::SwitchField.new('test', animate: false).render
|
16
|
+
actual = UiBibz::Ui::Core::Inputs::SwitchField.new('test', animate: false).render
|
17
17
|
expected = "<input type=\"checkbox\" name=\"test\" id=\"test\" data-animate=\"false\" class=\"switch\" />"
|
18
18
|
|
19
19
|
assert_equal expected, actual
|
@@ -21,7 +21,7 @@ class InputsSwitchFieldTest < ActionView::TestCase
|
|
21
21
|
|
22
22
|
# OK
|
23
23
|
test 'switch_field checked' do
|
24
|
-
actual = UiBibz::Ui::Core::SwitchField.new('test', {}, checked: true).render
|
24
|
+
actual = UiBibz::Ui::Core::Inputs::SwitchField.new('test', {}, checked: true).render
|
25
25
|
expected = "<input type=\"checkbox\" name=\"test\" id=\"test\" checked=\"checked\" class=\"switch\" />"
|
26
26
|
|
27
27
|
assert_equal expected, actual
|
@@ -29,7 +29,7 @@ class InputsSwitchFieldTest < ActionView::TestCase
|
|
29
29
|
|
30
30
|
# OK
|
31
31
|
test 'switch_field state' do
|
32
|
-
actual = UiBibz::Ui::Core::SwitchField.new('test', {}, state: "disabled").render
|
32
|
+
actual = UiBibz::Ui::Core::Inputs::SwitchField.new('test', {}, state: "disabled").render
|
33
33
|
expected = "<input type=\"checkbox\" name=\"test\" id=\"test\" state=\"disabled\" class=\"switch\" />"
|
34
34
|
|
35
35
|
assert_equal expected, actual
|
@@ -37,7 +37,7 @@ class InputsSwitchFieldTest < ActionView::TestCase
|
|
37
37
|
|
38
38
|
# NON FONCTIONNEL
|
39
39
|
test 'switch_field readonly' do
|
40
|
-
actual = UiBibz::Ui::Core::SwitchField.new('test', {}, readonly: true).render
|
40
|
+
actual = UiBibz::Ui::Core::Inputs::SwitchField.new('test', {}, readonly: true).render
|
41
41
|
expected = "<input type=\"checkbox\" name=\"test\" id=\"test\" readonly=\"readonly\" class=\"switch\" />"
|
42
42
|
|
43
43
|
assert_equal expected, actual
|
@@ -45,7 +45,7 @@ class InputsSwitchFieldTest < ActionView::TestCase
|
|
45
45
|
|
46
46
|
# OK
|
47
47
|
test 'switch_field left_color' do
|
48
|
-
actual = UiBibz::Ui::Core::SwitchField.new('test', left_color: "success").render
|
48
|
+
actual = UiBibz::Ui::Core::Inputs::SwitchField.new('test', left_color: "success").render
|
49
49
|
expected = "<input type=\"checkbox\" name=\"test\" id=\"test\" data-on-color=\"success\" class=\"switch\" />"
|
50
50
|
|
51
51
|
assert_equal expected, actual
|
@@ -53,7 +53,7 @@ class InputsSwitchFieldTest < ActionView::TestCase
|
|
53
53
|
|
54
54
|
# OK
|
55
55
|
test 'switch_field right_color' do
|
56
|
-
actual = UiBibz::Ui::Core::SwitchField.new('test', right_color: "info").render
|
56
|
+
actual = UiBibz::Ui::Core::Inputs::SwitchField.new('test', right_color: "info").render
|
57
57
|
expected = "<input type=\"checkbox\" name=\"test\" id=\"test\" data-off-color=\"info\" class=\"switch\" />"
|
58
58
|
|
59
59
|
assert_equal expected, actual
|
@@ -61,7 +61,7 @@ class InputsSwitchFieldTest < ActionView::TestCase
|
|
61
61
|
|
62
62
|
# OK
|
63
63
|
test 'switch_field middle_text' do
|
64
|
-
actual = UiBibz::Ui::Core::SwitchField.new('test', middle_text: "testlabeltext").render
|
64
|
+
actual = UiBibz::Ui::Core::Inputs::SwitchField.new('test', middle_text: "testlabeltext").render
|
65
65
|
expected = "<input type=\"checkbox\" name=\"test\" id=\"test\" data-label-text=\"testlabeltext\" class=\"switch\" />"
|
66
66
|
|
67
67
|
assert_equal expected, actual
|
@@ -69,7 +69,7 @@ class InputsSwitchFieldTest < ActionView::TestCase
|
|
69
69
|
|
70
70
|
# OK
|
71
71
|
test 'switch_field left_text' do
|
72
|
-
actual = UiBibz::Ui::Core::SwitchField.new('test', left_text: 'testonlabel').render
|
72
|
+
actual = UiBibz::Ui::Core::Inputs::SwitchField.new('test', left_text: 'testonlabel').render
|
73
73
|
expected = "<input type=\"checkbox\" name=\"test\" id=\"test\" data-on-text=\"testonlabel\" class=\"switch\" />"
|
74
74
|
|
75
75
|
assert_equal expected, actual
|
@@ -77,7 +77,7 @@ class InputsSwitchFieldTest < ActionView::TestCase
|
|
77
77
|
|
78
78
|
# OK
|
79
79
|
test 'switch_field right_text' do
|
80
|
-
actual = UiBibz::Ui::Core::SwitchField.new('test', right_text: "testofflabel").render
|
80
|
+
actual = UiBibz::Ui::Core::Inputs::SwitchField.new('test', right_text: "testofflabel").render
|
81
81
|
expected = "<input type=\"checkbox\" name=\"test\" id=\"test\" data-off-text=\"testofflabel\" class=\"switch\" />"
|
82
82
|
|
83
83
|
assert_equal expected, actual
|
data/test/ui/inputs_test.rb
CHANGED
@@ -4,22 +4,22 @@ include UiBibz::Helpers
|
|
4
4
|
class InputsTest < ActionView::TestCase
|
5
5
|
|
6
6
|
test "Date Picker Field" do
|
7
|
-
actual = UiBibz::Ui::Core::DatePickerField.new(['date_1', 'date_2'], { append: 'a', prepend: 'b', range: 'u' }, { class: 'datepicker-test' }).render
|
7
|
+
actual = UiBibz::Ui::Core::Inputs::DatePickerField.new(['date_1', 'date_2'], { append: 'a', prepend: 'b', range: 'u' }, { class: 'datepicker-test' }).render
|
8
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>"
|
9
9
|
|
10
10
|
assert_equal expected, actual
|
11
11
|
end
|
12
12
|
|
13
13
|
test "Date Picker Field data html options" do
|
14
|
-
actual = UiBibz::Ui::Core::DatePickerField.new('date', {
|
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-calendar-weeks=\"true\" data-autoclose=\"true\" data-dates-disabled=\"["11/01/2016","12/01/2016"]\" />"
|
14
|
+
actual = UiBibz::Ui::Core::Inputs::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=\"["11/01/2016","12/01/2016"]\" />"
|
16
16
|
|
17
17
|
assert_equal expected, actual
|
18
18
|
end
|
19
19
|
|
20
20
|
test "Multi Column Field" do
|
21
21
|
options = options_for_select(2.times.map{ |i| "option #{i}" })
|
22
|
-
actual = UiBibz::Ui::Core::MultiColumnField.new('example', option_tags: options).render
|
22
|
+
actual = UiBibz::Ui::Core::Inputs::MultiColumnField.new('example', option_tags: options).render
|
23
23
|
expected = "<select name=\"example[]\" id=\"example\" class=\"multi-column\" multiple=\"multiple\"><option value=\"option 0\">option 0</option>
|
24
24
|
<option value=\"option 1\">option 1</option></select>"
|
25
25
|
|
@@ -28,7 +28,7 @@ class InputsTest < ActionView::TestCase
|
|
28
28
|
|
29
29
|
test "Multi Column Field data html options" do
|
30
30
|
grouped_options = { 'North America' => [['United statuss','US'], 'Canada'], 'Europe' => ['Denmark','Germany','France'] }
|
31
|
-
actual = UiBibz::Ui::Core::MultiColumnField.new('example', { option_tags: grouped_options_for_select(grouped_options), searchable: true, selectable_opt_group: true }).render
|
31
|
+
actual = UiBibz::Ui::Core::Inputs::MultiColumnField.new('example', { option_tags: grouped_options_for_select(grouped_options), searchable: true, selectable_opt_group: true }).render
|
32
32
|
expected = "<select name=\"example[]\" id=\"example\" data-searchable=\"true\" data-selectable-optgroup=\"true\" class=\"multi-column\" multiple=\"multiple\"><optgroup label=\"North America\"><option value=\"US\">United statuss</option>
|
33
33
|
<option value=\"Canada\">Canada</option></optgroup><optgroup label=\"Europe\"><option value=\"Denmark\">Denmark</option>
|
34
34
|
<option value=\"Germany\">Germany</option>
|
@@ -39,7 +39,7 @@ class InputsTest < ActionView::TestCase
|
|
39
39
|
|
40
40
|
test "Multi Select Field" do
|
41
41
|
options = options_for_select(2.times.map{ |i| "option #{i}" })
|
42
|
-
actual = UiBibz::Ui::Core::MultiSelectField.new('example', option_tags: options).render
|
42
|
+
actual = UiBibz::Ui::Core::Inputs::MultiSelectField.new('example', option_tags: options).render
|
43
43
|
expected = "<select name=\"example[]\" id=\"example\" class=\"btn-secondary btn multi-select\" multiple=\"multiple\"><option value=\"option 0\">option 0</option>
|
44
44
|
<option value=\"option 1\">option 1</option></select>"
|
45
45
|
|
@@ -48,7 +48,7 @@ class InputsTest < ActionView::TestCase
|
|
48
48
|
|
49
49
|
test "Multi Select Field data html options" do
|
50
50
|
grouped_options = { 'North America' => [['United statuss','US'], 'Canada'], 'Europe' => ['Denmark','Germany','France'] }
|
51
|
-
actual = UiBibz::Ui::Core::MultiSelectField.new('example', { option_tags: grouped_options_for_select(grouped_options), clickable_opt_group: true, collapsible_opt_group: true, searchable: true, select_all_option: true, status: :danger }).render
|
51
|
+
actual = UiBibz::Ui::Core::Inputs::MultiSelectField.new('example', { option_tags: grouped_options_for_select(grouped_options), clickable_opt_group: true, collapsible_opt_group: true, searchable: true, select_all_option: true, status: :danger }).render
|
52
52
|
expected = "<select name=\"example[]\" id=\"example\" data-enable-clickable-opt-groups=\"true\" data-enable-collapsible-opt-groups=\"true\" data-enable-filtering=\"true\" data-include-select-all-option=\"true\" class=\"btn-danger btn multi-select\" multiple=\"multiple\"><optgroup label=\"North America\"><option value=\"US\">United statuss</option>
|
53
53
|
<option value=\"Canada\">Canada</option></optgroup><optgroup label=\"Europe\"><option value=\"Denmark\">Denmark</option>
|
54
54
|
<option value=\"Germany\">Germany</option>
|
@@ -58,21 +58,21 @@ class InputsTest < ActionView::TestCase
|
|
58
58
|
end
|
59
59
|
|
60
60
|
test 'surround_field without prepend and append' do
|
61
|
-
actual = UiBibz::Ui::Core::SurroundField.new('test').render
|
61
|
+
actual = UiBibz::Ui::Core::Inputs::SurroundField.new('test').render
|
62
62
|
expected = "<input type=\"text\" name=\"test\" id=\"test\" class=\"form-control\" />"
|
63
63
|
|
64
64
|
assert_equal expected, actual
|
65
65
|
end
|
66
66
|
|
67
67
|
test 'surround_field with prepend and append' do
|
68
|
-
actual = UiBibz::Ui::Core::SurroundField.new('test', append: '1', prepend: '2').render
|
68
|
+
actual = UiBibz::Ui::Core::Inputs::SurroundField.new('test', append: '1', prepend: '2').render
|
69
69
|
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>"
|
70
70
|
|
71
71
|
assert_equal expected, actual
|
72
72
|
end
|
73
73
|
|
74
74
|
test 'surround_field size' do
|
75
|
-
actual = UiBibz::Ui::Core::SurroundField.new('test', size: :xs, append: '1', prepend: '2').render
|
75
|
+
actual = UiBibz::Ui::Core::Inputs::SurroundField.new('test', size: :xs, append: '1', prepend: '2').render
|
76
76
|
expected = "<div class=\"input-group input-group-xs\"><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>"
|
77
77
|
|
78
78
|
assert_equal expected, actual
|
@@ -80,7 +80,7 @@ class InputsTest < ActionView::TestCase
|
|
80
80
|
|
81
81
|
test 'autocomplete_field' do
|
82
82
|
options = options_for_select(2.times.map{ |i| "option #{i}" })
|
83
|
-
actual = UiBibz::Ui::Core::AutocompleteField.new('test', { option_tags: options }, { id: 'test' }).render
|
83
|
+
actual = UiBibz::Ui::Core::Inputs::AutocompleteField.new('test', { option_tags: options }, { id: 'test' }).render
|
84
84
|
expected = "<input type=\"text\" name=\"test\" id=\"test\" class=\"form-control\" autocomplete=\"true\" list=\"test-datalist\" /><datalist id=\"test-datalist\"><option value=\"option 0\">option 0</option>
|
85
85
|
<option value=\"option 1\">option 1</option></datalist>"
|
86
86
|
|
@@ -88,14 +88,14 @@ class InputsTest < ActionView::TestCase
|
|
88
88
|
end
|
89
89
|
|
90
90
|
test 'formula_field' do
|
91
|
-
actual = UiBibz::Ui::Core::FormulaField.new('value').render
|
91
|
+
actual = UiBibz::Ui::Core::Inputs::FormulaField.new('value').render
|
92
92
|
expected = "<div class=\"input-group formula_field\"><input type=\"text\" name=\"value_formula\" id=\"value_formula\" value=\"\" class=\"formula_field_input 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>"
|
93
93
|
|
94
94
|
assert_equal expected, actual
|
95
95
|
end
|
96
96
|
|
97
97
|
test 'markdown_editor' do
|
98
|
-
actual = UiBibz::Ui::Core::MarkdownEditorField.new('comments').render
|
98
|
+
actual = UiBibz::Ui::Core::Inputs::MarkdownEditorField.new('comments').render
|
99
99
|
expected = "<textarea name=\"comments\" id=\"comments\" data-provide=\"markdown\" data-iconlibrary=\"fa\">
|
100
100
|
</textarea>"
|
101
101
|
|
data/test/ui/nav_test.rb
CHANGED
@@ -3,7 +3,7 @@ include UiBibz::Helpers
|
|
3
3
|
class NavTest < ActionView::TestCase
|
4
4
|
|
5
5
|
test 'Nav with tab' do
|
6
|
-
actual = UiBibz::Ui::Core::Nav.new(type: :tabs).tap do |n|
|
6
|
+
actual = UiBibz::Ui::Core::Navs::Nav.new(type: :tabs).tap do |n|
|
7
7
|
n.link 'Home', state: :active, url: "#Home", selector: 'home'
|
8
8
|
n.link 'Profile', url: "#profile", selector: 'profile'
|
9
9
|
n.link 'Messages', url: "#messages", selector: 'messages'
|
@@ -13,7 +13,7 @@ class NavTest < ActionView::TestCase
|
|
13
13
|
end
|
14
14
|
|
15
15
|
test 'Nav with pills' do
|
16
|
-
actual = UiBibz::Ui::Core::Nav.new(type: :pills, position: :justified).tap do |n|
|
16
|
+
actual = UiBibz::Ui::Core::Navs::Nav.new(type: :pills, position: :justified).tap do |n|
|
17
17
|
n.link 'Home', state: :active, url: "#Home", selector: 'home'
|
18
18
|
n.link 'Profile', url: "#profile", selector: 'profile', label: 16
|
19
19
|
n.link 'Messages', url: "#messages", selector: 'messages', state: :disabled
|
data/test/ui/table_test.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'test_helper'
|
2
|
-
require "ui_bibz/ui/ux/
|
3
|
-
require "ui_bibz/ui/ux/
|
4
|
-
require "ui_bibz/ui/ux/
|
5
|
-
require "ui_bibz/ui/ux/
|
6
|
-
require "ui_bibz/ui/ux/
|
2
|
+
require "ui_bibz/ui/ux/tables/components/store"
|
3
|
+
require "ui_bibz/ui/ux/tables/extensions/paginable"
|
4
|
+
require "ui_bibz/ui/ux/tables/extensions/searchable"
|
5
|
+
require "ui_bibz/ui/ux/tables/extensions/sortable"
|
6
|
+
require "ui_bibz/ui/ux/tables/extensions/actionable"
|
7
7
|
include UiBibz::Helpers
|
8
8
|
|
9
9
|
class TableTest < ActionView::TestCase
|
@@ -20,18 +20,18 @@ class TableTest < ActionView::TestCase
|
|
20
20
|
page: 1
|
21
21
|
}
|
22
22
|
@users = User.table_search_pagination(params, session)
|
23
|
-
@store = UiBibz::Ui::Ux::Store.new @users
|
23
|
+
@store = UiBibz::Ui::Ux::Tables::Store.new @users
|
24
24
|
end
|
25
25
|
|
26
26
|
test 'table search field' do
|
27
|
-
actual = UiBibz::Ui::Ux::TableSearchField.new({ store: @users}).render
|
27
|
+
actual = UiBibz::Ui::Ux::Tables::TableSearchField.new({ store: @users}).render
|
28
28
|
expected = "<form class=\"form-table-search-field\" action=\"/users?direction=asc&page=1&per_page=2&search=Name+fr&sort=users.name_fr\" accept-charset=\"UTF-8\" method=\"get\"><input name=\"utf8\" type=\"hidden\" value=\"✓\" /><div class=\"input-group input-group-sm table-search-field\"><span class=\"input-group-addon\"><i class=\"glyph fa fa-search\"></i></span><input type=\"hidden\" name=\"controller\" value=\"users\" /><input type=\"hidden\" name=\"action\" value=\"index\" /><input type=\"hidden\" name=\"sort\" value=\"users.name_fr\" /><input type=\"hidden\" name=\"direction\" value=\"asc\" /><input type=\"hidden\" name=\"search\" value=\"Name fr\" /><input type=\"hidden\" name=\"per_page\" value=\"2\" /><input type=\"hidden\" name=\"page\" value=\"1\" /><input type=\"search\" value=\"Name fr\" name=\"search\" class=\"form-control\" placeholder=\"Search by Name fr and Name en...\" /><span class=\"input-group-btn\"><button type=\"button\" class=\"btn btn-secondary\"><i class=\"glyph fa fa-times-circle\"></i></button></span></div></form>"
|
29
29
|
|
30
30
|
assert_equal expected, actual
|
31
31
|
end
|
32
32
|
|
33
33
|
test 'table pagination' do
|
34
|
-
actual = UiBibz::Ui::Ux::TablePagination.new({ store: @users }).render
|
34
|
+
actual = UiBibz::Ui::Ux::Tables::TablePagination.new({ store: @users }).render
|
35
35
|
expected = "<ul class=\"pagination pagination\"><li class=\"prev disabled\"><span>← Previous</span></li> <li class=\"active\"><span>1</span></li> <li><a rel=\"next\" href=\"/users?direction=asc&page=2&per_page=2&search=Name+fr&sort=users.name_fr\">2</a></li> <li><a href=\"/users?direction=asc&page=3&per_page=2&search=Name+fr&sort=users.name_fr\">3</a></li> <li><a href=\"/users?direction=asc&page=4&per_page=2&search=Name+fr&sort=users.name_fr\">4</a></li> <li><a href=\"/users?direction=asc&page=5&per_page=2&search=Name+fr&sort=users.name_fr\">5</a></li> <li><a href=\"/users?direction=asc&page=6&per_page=2&search=Name+fr&sort=users.name_fr\">6</a></li> <li><a href=\"/users?direction=asc&page=7&per_page=2&search=Name+fr&sort=users.name_fr\">7</a></li> <li><a href=\"/users?direction=asc&page=8&per_page=2&search=Name+fr&sort=users.name_fr\">8</a></li> <li><a href=\"/users?direction=asc&page=9&per_page=2&search=Name+fr&sort=users.name_fr\">9</a></li> <li class=\"disabled\"><span>…</span></li> <li><a href=\"/users?direction=asc&page=12&per_page=2&search=Name+fr&sort=users.name_fr\">12</a></li> <li><a href=\"/users?direction=asc&page=13&per_page=2&search=Name+fr&sort=users.name_fr\">13</a></li> <li class=\"next\"><a rel=\"next\" href=\"/users?direction=asc&page=2&per_page=2&search=Name+fr&sort=users.name_fr\">Next →</a></li></ul>"
|
36
36
|
|
37
37
|
assert_equal expected, actual
|
@@ -39,7 +39,7 @@ class TableTest < ActionView::TestCase
|
|
39
39
|
|
40
40
|
test 'table non sortable' do
|
41
41
|
options = { sortable: false }
|
42
|
-
actual = UiBibz::Ui::Ux::Sortable.new(@store, options).header(@store.columns.list.first)
|
42
|
+
actual = UiBibz::Ui::Ux::Tables::Sortable.new(@store, options).header(@store.columns.list.first)
|
43
43
|
expected = "Id"
|
44
44
|
|
45
45
|
assert_equal expected, actual
|
@@ -47,7 +47,7 @@ class TableTest < ActionView::TestCase
|
|
47
47
|
|
48
48
|
test 'table sortable' do
|
49
49
|
options = { sortable: true }
|
50
|
-
actual = UiBibz::Ui::Ux::Sortable.new(@store, options).header(@store.columns.list.first)
|
50
|
+
actual = UiBibz::Ui::Ux::Tables::Sortable.new(@store, options).header(@store.columns.list.first)
|
51
51
|
expected = "<a class=\"dropup\" href=\"/users?column_id=id&direction=asc&search=Name+fr&sort=users.id\">Id</a>"
|
52
52
|
|
53
53
|
assert_equal expected, actual
|
@@ -55,7 +55,7 @@ class TableTest < ActionView::TestCase
|
|
55
55
|
|
56
56
|
test 'table non paginable' do
|
57
57
|
options = { paginable: false }
|
58
|
-
pagination = UiBibz::Ui::Ux::Paginable.new(@store, options)
|
58
|
+
pagination = UiBibz::Ui::Ux::Tables::Paginable.new(@store, options)
|
59
59
|
actual = pagination.render if pagination.paginable?
|
60
60
|
expected = nil
|
61
61
|
|
@@ -64,7 +64,7 @@ class TableTest < ActionView::TestCase
|
|
64
64
|
|
65
65
|
test 'table paginable' do
|
66
66
|
options = { paginable: true }
|
67
|
-
pagination = UiBibz::Ui::Ux::Paginable.new(@store, options)
|
67
|
+
pagination = UiBibz::Ui::Ux::Tables::Paginable.new(@store, options)
|
68
68
|
actual = pagination.render if pagination.paginable?
|
69
69
|
expected = "<div><ul class=\"pagination pagination\"><li class=\"prev disabled\"><span>← Previous</span></li> <li class=\"active\"><span>1</span></li> <li><a rel=\"next\" href=\"/users?direction=asc&page=2&per_page=2&search=Name+fr&sort=users.name_fr\">2</a></li> <li><a href=\"/users?direction=asc&page=3&per_page=2&search=Name+fr&sort=users.name_fr\">3</a></li> <li><a href=\"/users?direction=asc&page=4&per_page=2&search=Name+fr&sort=users.name_fr\">4</a></li> <li><a href=\"/users?direction=asc&page=5&per_page=2&search=Name+fr&sort=users.name_fr\">5</a></li> <li><a href=\"/users?direction=asc&page=6&per_page=2&search=Name+fr&sort=users.name_fr\">6</a></li> <li><a href=\"/users?direction=asc&page=7&per_page=2&search=Name+fr&sort=users.name_fr\">7</a></li> <li><a href=\"/users?direction=asc&page=8&per_page=2&search=Name+fr&sort=users.name_fr\">8</a></li> <li><a href=\"/users?direction=asc&page=9&per_page=2&search=Name+fr&sort=users.name_fr\">9</a></li> <li class=\"disabled\"><span>…</span></li> <li><a href=\"/users?direction=asc&page=12&per_page=2&search=Name+fr&sort=users.name_fr\">12</a></li> <li><a href=\"/users?direction=asc&page=13&per_page=2&search=Name+fr&sort=users.name_fr\">13</a></li> <li class=\"next\"><a rel=\"next\" href=\"/users?direction=asc&page=2&per_page=2&search=Name+fr&sort=users.name_fr\">Next →</a></li></ul><form action=\"/users\" accept-charset=\"UTF-8\" method=\"get\"><input name=\"utf8\" type=\"hidden\" value=\"✓\" /><div class=\"table-pagination-per-page\">Displaying User <b>1 - 2</b> of <b>25</b> in total | Per page: <input type=\"hidden\" name=\"controller\" value=\"users\" /><input type=\"hidden\" name=\"action\" value=\"index\" /><input type=\"hidden\" name=\"sort\" value=\"users.name_fr\" /><input type=\"hidden\" name=\"direction\" value=\"asc\" /><input type=\"hidden\" name=\"search\" value=\"Name fr\" /><input type=\"hidden\" name=\"per_page\" value=\"2\" /><input type=\"hidden\" name=\"page\" value=\"1\" /><select name=\"per_page\" id=\"per_page\" class=\"form-control\"><option value=\"5\">5</option>
|
70
70
|
<option value=\"10\">10</option>
|
@@ -80,7 +80,7 @@ class TableTest < ActionView::TestCase
|
|
80
80
|
|
81
81
|
test 'table non searchable' do
|
82
82
|
options = { searchable: false }
|
83
|
-
actual = UiBibz::Ui::Ux::Searchable.new(@store, options).render
|
83
|
+
actual = UiBibz::Ui::Ux::Tables::Searchable.new(@store, options).render
|
84
84
|
expected = "<div><div class=\"title\">Users list</div><br class=\"ui-bibz-clear\" /></div>"
|
85
85
|
|
86
86
|
assert_equal expected, actual
|
@@ -88,7 +88,7 @@ class TableTest < ActionView::TestCase
|
|
88
88
|
|
89
89
|
test 'table non searchable with a title and glyph' do
|
90
90
|
options = { searchable: false, glyph: 'state', title: 'Title list' }
|
91
|
-
actual = UiBibz::Ui::Ux::Searchable.new(@store, options).render
|
91
|
+
actual = UiBibz::Ui::Ux::Tables::Searchable.new(@store, options).render
|
92
92
|
expected = "<div><div class=\"title\"><i class=\"glyph fa fa-state\"></i>Title list</div><br class=\"ui-bibz-clear\" /></div>"
|
93
93
|
|
94
94
|
assert_equal expected, actual
|
@@ -96,7 +96,7 @@ class TableTest < ActionView::TestCase
|
|
96
96
|
|
97
97
|
test 'table searchable' do
|
98
98
|
options = { searchable: true }
|
99
|
-
actual = UiBibz::Ui::Ux::Searchable.new(@store, options).render
|
99
|
+
actual = UiBibz::Ui::Ux::Tables::Searchable.new(@store, options).render
|
100
100
|
expected = "<div><div class=\"title\">Users list</div><div class=\"input-group input-group-sm table-search-field\"><span class=\"input-group-addon\"><i class=\"glyph fa fa-search\"></i></span><input type=\"search\" value=\"Name fr\" name=\"search\" class=\"form-control\" placeholder=\"Search by Name fr and Name en...\" /><span class=\"clear-search-btn input-group-addon\"><i class=\"glyph fa fa-times-circle\"></i></span></div><br class=\"ui-bibz-clear\" /></div>"
|
101
101
|
|
102
102
|
assert_equal expected, actual
|
@@ -104,7 +104,7 @@ class TableTest < ActionView::TestCase
|
|
104
104
|
|
105
105
|
test 'table actionable header' do
|
106
106
|
options = { actionable: true }
|
107
|
-
action = UiBibz::Ui::Ux::Actionable.new(@store, options)
|
107
|
+
action = UiBibz::Ui::Ux::Tables::Actionable.new(@store, options)
|
108
108
|
actual = action.header []
|
109
109
|
expected = ["<th class=\"action\"></th>"]
|
110
110
|
|
@@ -113,7 +113,7 @@ class TableTest < ActionView::TestCase
|
|
113
113
|
|
114
114
|
test 'table actionable body' do
|
115
115
|
options = { actionable: true }
|
116
|
-
action = UiBibz::Ui::Ux::Actionable.new(@store, options)
|
116
|
+
action = UiBibz::Ui::Ux::Tables::Actionable.new(@store, options)
|
117
117
|
actual = action.body @store.records.first, []
|
118
118
|
expected = ["<td></td>"]
|
119
119
|
|
@@ -122,7 +122,7 @@ class TableTest < ActionView::TestCase
|
|
122
122
|
|
123
123
|
test 'table actionable inject_url' do
|
124
124
|
options = { actionable: true }
|
125
|
-
action = UiBibz::Ui::Ux::Actionable.new(@store, options)
|
125
|
+
action = UiBibz::Ui::Ux::Tables::Actionable.new(@store, options)
|
126
126
|
actual = action.inject_url 'http://localhost/users/id/test', @store.records.first
|
127
127
|
expected = "http://localhost/users/1/test"
|
128
128
|
|
@@ -131,7 +131,7 @@ class TableTest < ActionView::TestCase
|
|
131
131
|
|
132
132
|
test 'table non actionable header' do
|
133
133
|
options = { actionable: false }
|
134
|
-
action = UiBibz::Ui::Ux::Actionable.new(@store, options)
|
134
|
+
action = UiBibz::Ui::Ux::Tables::Actionable.new(@store, options)
|
135
135
|
actual = action.header []
|
136
136
|
expected = []
|
137
137
|
|
@@ -140,7 +140,7 @@ class TableTest < ActionView::TestCase
|
|
140
140
|
|
141
141
|
test 'table non actionable body' do
|
142
142
|
options = { actionable: false }
|
143
|
-
action = UiBibz::Ui::Ux::Actionable.new(@store, options)
|
143
|
+
action = UiBibz::Ui::Ux::Tables::Actionable.new(@store, options)
|
144
144
|
actual = action.body @store.records.first, []
|
145
145
|
expected = []
|
146
146
|
|
@@ -148,11 +148,11 @@ class TableTest < ActionView::TestCase
|
|
148
148
|
end
|
149
149
|
|
150
150
|
test 'simple table_card' do
|
151
|
-
actual = UiBibz::Ui::Ux::TableCard.new(store: @users, tap: true).render
|
151
|
+
actual = UiBibz::Ui::Ux::Tables::TableCard.new(store: @users, tap: true).render
|
152
152
|
end
|
153
153
|
|
154
154
|
test 'complex table_card' do
|
155
|
-
actual = UiBibz::Ui::Ux::TableCard.new({ store: @users, tap: true }, { class: 'state' }).tap do |pane|
|
155
|
+
actual = UiBibz::Ui::Ux::Tables::TableCard.new({ store: @users, tap: true }, { class: 'state' }).tap do |pane|
|
156
156
|
pane.header 'Test header'
|
157
157
|
pane.block class: 'ui' do
|
158
158
|
'Test body'
|
@@ -161,7 +161,7 @@ class TableTest < ActionView::TestCase
|
|
161
161
|
end
|
162
162
|
|
163
163
|
test 'complex table_card with custom actions' do
|
164
|
-
actual = UiBibz::Ui::Ux::TableCard.new({ store: @users, tap: true }, { class: 'state'}).tap do |pane|
|
164
|
+
actual = UiBibz::Ui::Ux::Tables::TableCard.new({ store: @users, tap: true }, { class: 'state'}).tap do |pane|
|
165
165
|
pane.header 'Test header'
|
166
166
|
pane.block cls: 'ui' do
|
167
167
|
'Test body'
|
@@ -181,7 +181,7 @@ class TableTest < ActionView::TestCase
|
|
181
181
|
end
|
182
182
|
|
183
183
|
test 'format action' do
|
184
|
-
actual = UiBibz::Ui::Ux::TableCard.new(store: @users, tap: true).tap do |pane|
|
184
|
+
actual = UiBibz::Ui::Ux::Tables::TableCard.new(store: @users, tap: true).tap do |pane|
|
185
185
|
pane.columns do |cls|
|
186
186
|
cls.column :id, name: '#'
|
187
187
|
end
|
@@ -195,7 +195,7 @@ class TableTest < ActionView::TestCase
|
|
195
195
|
end
|
196
196
|
|
197
197
|
test 'table visual options' do
|
198
|
-
table = UiBibz::Ui::Ux::Table.new(store: @users, striped: true, status: :inverse, responsive: true, bordered: true, size: :sm, hoverable: true, reflow: true).render
|
198
|
+
table = UiBibz::Ui::Ux::Tables::Table.new(store: @users, striped: true, status: :inverse, responsive: true, bordered: true, size: :sm, hoverable: true, reflow: true).render
|
199
199
|
actual = Nokogiri::HTML(table).xpath("//table")[0].attributes["class"].value
|
200
200
|
expected = "table-inverse table table-striped table-bordered table-hoverable table-sm table-responsive table-reflow"
|
201
201
|
|
@@ -203,7 +203,7 @@ class TableTest < ActionView::TestCase
|
|
203
203
|
end
|
204
204
|
|
205
205
|
test 'table thead visual options' do
|
206
|
-
table = UiBibz::Ui::Ux::Table.new(store: @users, thead: { status: :default }).render
|
206
|
+
table = UiBibz::Ui::Ux::Tables::Table.new(store: @users, thead: { status: :default }).render
|
207
207
|
actual = Nokogiri::HTML(table).xpath("//thead")[0].attributes["class"].value
|
208
208
|
expected = "thead-default"
|
209
209
|
|