sexy_form 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +5 -0
- data/LICENSE +21 -0
- data/README.md +275 -0
- data/Rakefile +15 -0
- data/lib/sexy_form.rb +84 -0
- data/lib/sexy_form/builder.rb +306 -0
- data/lib/sexy_form/themes.rb +22 -0
- data/lib/sexy_form/themes/base_theme.rb +39 -0
- data/lib/sexy_form/themes/bootstrap_2_horizontal.rb +83 -0
- data/lib/sexy_form/themes/bootstrap_2_inline.rb +73 -0
- data/lib/sexy_form/themes/bootstrap_2_vertical.rb +80 -0
- data/lib/sexy_form/themes/bootstrap_3_horizontal.rb +95 -0
- data/lib/sexy_form/themes/bootstrap_3_inline.rb +71 -0
- data/lib/sexy_form/themes/bootstrap_3_vertical.rb +70 -0
- data/lib/sexy_form/themes/bootstrap_4_horizontal.rb +95 -0
- data/lib/sexy_form/themes/bootstrap_4_inline.rb +80 -0
- data/lib/sexy_form/themes/bootstrap_4_vertical.rb +79 -0
- data/lib/sexy_form/themes/bulma_horizontal.rb +81 -0
- data/lib/sexy_form/themes/bulma_vertical.rb +73 -0
- data/lib/sexy_form/themes/default.rb +55 -0
- data/lib/sexy_form/themes/foundation.rb +67 -0
- data/lib/sexy_form/themes/materialize.rb +65 -0
- data/lib/sexy_form/themes/milligram.rb +62 -0
- data/lib/sexy_form/themes/semantic_ui_inline.rb +63 -0
- data/lib/sexy_form/themes/semantic_ui_vertical.rb +63 -0
- data/lib/sexy_form/version.rb +3 -0
- data/spec/custom_assertions.rb +21 -0
- data/spec/sexy_form/builder_spec.rb +104 -0
- data/spec/sexy_form/themes/base_theme_spec.rb +16 -0
- data/spec/sexy_form/themes/bootstrap_2_horizontal_spec.rb +114 -0
- data/spec/sexy_form/themes/bootstrap_2_inline_spec.rb +108 -0
- data/spec/sexy_form/themes/bootstrap_2_vertical_spec.rb +111 -0
- data/spec/sexy_form/themes/bootstrap_3_horizontal_spec.rb +116 -0
- data/spec/sexy_form/themes/bootstrap_3_inline_spec.rb +104 -0
- data/spec/sexy_form/themes/bootstrap_3_vertical_spec.rb +122 -0
- data/spec/sexy_form/themes/bootstrap_4_horizontal_spec.rb +124 -0
- data/spec/sexy_form/themes/bootstrap_4_inline_spec.rb +116 -0
- data/spec/sexy_form/themes/bootstrap_4_vertical_spec.rb +114 -0
- data/spec/sexy_form/themes/bulma_horizontal_spec.rb +126 -0
- data/spec/sexy_form/themes/bulma_vertical_spec.rb +114 -0
- data/spec/sexy_form/themes/default_spec.rb +102 -0
- data/spec/sexy_form/themes/foundation_spec.rb +103 -0
- data/spec/sexy_form/themes/materialize_spec.rb +103 -0
- data/spec/sexy_form/themes/milligram_spec.rb +120 -0
- data/spec/sexy_form/themes/semantic_ui_inline_spec.rb +105 -0
- data/spec/sexy_form/themes/semantic_ui_vertical_spec.rb +105 -0
- data/spec/sexy_form/themes/theme_spec_helper.rb +0 -0
- data/spec/sexy_form/themes_spec.rb +52 -0
- data/spec/sexy_form_spec.rb +54 -0
- data/spec/spec_helper.rb +16 -0
- metadata +160 -0
@@ -0,0 +1,104 @@
|
|
1
|
+
require_relative "../../spec_helper"
|
2
|
+
require_relative "./theme_spec_helper"
|
3
|
+
|
4
|
+
theme_klass = SexyForm::Themes::Bootstrap3Inline
|
5
|
+
theme = theme_klass.new
|
6
|
+
|
7
|
+
describe theme_klass do
|
8
|
+
|
9
|
+
describe ".theme_name" do
|
10
|
+
it "is correct" do
|
11
|
+
theme_klass.theme_name.should eq("bootstrap_3_inline")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe ".wrap_field" do
|
16
|
+
it "works" do
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "SexyForm.form" do
|
22
|
+
it "matches docs example" do
|
23
|
+
expected = build_string do |str|
|
24
|
+
str << %Q(<form class="form-inline" method="post">)
|
25
|
+
str << %Q(<div class="form-group">)
|
26
|
+
str << %Q(<label for="email">Email</label>)
|
27
|
+
str << %Q(<input type="text" name="email" id="email">)
|
28
|
+
str << "</div>"
|
29
|
+
|
30
|
+
str << %Q(<div class="form-group">)
|
31
|
+
str << %Q(<label for="password">Password</label>)
|
32
|
+
str << %Q(<input type="password" name="password" id="password">)
|
33
|
+
str << "</div>"
|
34
|
+
|
35
|
+
str << %Q(<div class="form-group">)
|
36
|
+
str << %Q(<label for="remember_me">)
|
37
|
+
str << %Q(<input type="checkbox" name="remember_me" id="remember_me"> Remember Me)
|
38
|
+
str << %Q(</label>)
|
39
|
+
str << "</div>"
|
40
|
+
|
41
|
+
str << %Q(<button type="submit" class="btn">Sign in</button>)
|
42
|
+
str << "</form>"
|
43
|
+
end
|
44
|
+
|
45
|
+
actual = SexyForm.form(theme: theme_klass.theme_name) do |f|
|
46
|
+
f << f.field(type: :text, name: :email)
|
47
|
+
f << f.field(type: :password, name: :password)
|
48
|
+
f << f.field(type: :checkbox, name: :remember_me)
|
49
|
+
f << %Q(<button type="submit" class="btn">Sign in</button>)
|
50
|
+
end
|
51
|
+
|
52
|
+
actual.should eq(expected)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe ".form_html_attributes" do
|
57
|
+
it "returns correct attributes" do
|
58
|
+
attrs = {}
|
59
|
+
|
60
|
+
attrs["class"] = "form-inline"
|
61
|
+
|
62
|
+
theme.form_html_attributes(html_attrs: {}).should eq(attrs)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
SexyForm::Builder::FIELD_TYPES.each do |field_type|
|
67
|
+
describe ".input_html_attributes" do
|
68
|
+
it "returns correct #{field_type} attributes" do
|
69
|
+
attrs = {}
|
70
|
+
|
71
|
+
theme.input_html_attributes(html_attrs: {}, field_type: field_type, has_errors: false).should eq(attrs)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe ".label_html_attributes" do
|
76
|
+
it "returns correct #{field_type} attributes" do
|
77
|
+
attrs = {}
|
78
|
+
|
79
|
+
theme.label_html_attributes(html_attrs: {}, field_type: field_type, has_errors: false).should eq(attrs)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe ".build_html_help_text" do
|
84
|
+
it "returns correct #{field_type} attributes" do
|
85
|
+
expected = "<span class=\"help-block\">foobar</span>"
|
86
|
+
|
87
|
+
attrs = {}
|
88
|
+
|
89
|
+
theme.build_html_help_text(html_attrs: attrs, field_type: field_type, help_text: "foobar").should eq(expected)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
describe ".build_html_error" do
|
94
|
+
it "returns correct #{field_type} attributes" do
|
95
|
+
expected = "<span class=\"help-block\">foobar</span>"
|
96
|
+
|
97
|
+
attrs = {}
|
98
|
+
|
99
|
+
theme.build_html_error(html_attrs: attrs, field_type: field_type, error: "foobar").should eq(expected)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
require_relative "../../spec_helper"
|
2
|
+
require_relative "./theme_spec_helper"
|
3
|
+
|
4
|
+
theme_klass = SexyForm::Themes::Bootstrap3Vertical
|
5
|
+
theme = theme_klass.new
|
6
|
+
|
7
|
+
describe theme_klass do
|
8
|
+
|
9
|
+
describe ".theme_name" do
|
10
|
+
it "is correct" do
|
11
|
+
theme_klass.theme_name.should eq("bootstrap_3_vertical")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe ".wrap_field" do
|
16
|
+
it "works" do
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "SexyForm.form" do
|
22
|
+
it "matches docs example" do
|
23
|
+
expected = build_string do |str|
|
24
|
+
str << %Q(<form method="post">)
|
25
|
+
str << %Q(<div class="form-group">)
|
26
|
+
str << %Q(<label for="email">Email</label>)
|
27
|
+
str << %Q(<input type="text" name="email" id="email">)
|
28
|
+
str << "</div>"
|
29
|
+
|
30
|
+
str << %Q(<div class="form-group">)
|
31
|
+
str << %Q(<label for="password">Password</label>)
|
32
|
+
str << %Q(<input type="password" name="password" id="password">)
|
33
|
+
str << "</div>"
|
34
|
+
|
35
|
+
str << %Q(<div class="form-group">)
|
36
|
+
str << %Q(<label for="remember_me">)
|
37
|
+
str << %Q(<input type="checkbox" name="remember_me" id="remember_me"> Remember Me)
|
38
|
+
str << %Q(</label>)
|
39
|
+
str << "</div>"
|
40
|
+
|
41
|
+
str << %Q(<button type="submit" class="btn">Sign in</button>)
|
42
|
+
str << "</form>"
|
43
|
+
end
|
44
|
+
|
45
|
+
actual = SexyForm.form(theme: theme_klass.theme_name) do |f|
|
46
|
+
f << f.field(type: :text, name: :email)
|
47
|
+
f << f.field(type: :password, name: :password)
|
48
|
+
f << f.field(type: :checkbox, name: :remember_me)
|
49
|
+
f << %Q(<button type="submit" class="btn">Sign in</button>)
|
50
|
+
end
|
51
|
+
|
52
|
+
actual.should eq(expected)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe ".input_html_attributes" do
|
57
|
+
SexyForm::Builder::FIELD_TYPES.each do |field_type|
|
58
|
+
it "returns correct #{field_type} attributes" do
|
59
|
+
attrs = {}
|
60
|
+
|
61
|
+
theme.input_html_attributes(html_attrs: {}, field_type: field_type, has_errors: false).should eq(attrs)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
describe ".label_html_attributes" do
|
67
|
+
SexyForm::Builder::FIELD_TYPES.each do |field_type|
|
68
|
+
it "returns correct #{field_type} attributes" do
|
69
|
+
attrs = {}
|
70
|
+
|
71
|
+
theme.label_html_attributes(html_attrs: {}, field_type: field_type, has_errors: false).should eq(attrs)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
describe ".form_html_attributes" do
|
77
|
+
it "returns correct attributes" do
|
78
|
+
attrs = {}
|
79
|
+
|
80
|
+
theme.form_html_attributes(html_attrs: {}).should eq(attrs)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
SexyForm::Builder::FIELD_TYPES.each do |field_type|
|
85
|
+
describe ".input_html_attributes" do
|
86
|
+
it "returns correct #{field_type} attributes" do
|
87
|
+
attrs = {}
|
88
|
+
|
89
|
+
theme.input_html_attributes(html_attrs: {}, field_type: field_type, has_errors: false).should eq(attrs)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
describe ".label_html_attributes" do
|
94
|
+
it "returns correct #{field_type} attributes" do
|
95
|
+
attrs = {}
|
96
|
+
|
97
|
+
theme.label_html_attributes(html_attrs: {}, field_type: field_type, has_errors: false).should eq(attrs)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
describe ".build_html_help_text" do
|
102
|
+
it "returns correct #{field_type} attributes" do
|
103
|
+
expected = "<span class=\"help-block\">foobar</span>"
|
104
|
+
|
105
|
+
attrs = {}
|
106
|
+
|
107
|
+
theme.build_html_help_text(html_attrs: attrs, field_type: field_type, help_text: "foobar").should eq(expected)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
describe ".build_html_error" do
|
112
|
+
it "returns correct #{field_type} attributes" do
|
113
|
+
expected = "<span class=\"help-block\">foobar</span>"
|
114
|
+
|
115
|
+
attrs = {}
|
116
|
+
|
117
|
+
theme.build_html_error(html_attrs: attrs, field_type: field_type, error: "foobar").should eq(expected)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
@@ -0,0 +1,124 @@
|
|
1
|
+
require_relative "../../spec_helper"
|
2
|
+
require_relative "./theme_spec_helper"
|
3
|
+
|
4
|
+
theme_klass = SexyForm::Themes::Bootstrap4Horizontal
|
5
|
+
theme = theme_klass.new
|
6
|
+
|
7
|
+
describe theme_klass do
|
8
|
+
|
9
|
+
describe ".theme_name" do
|
10
|
+
it "is correct" do
|
11
|
+
theme_klass.theme_name.should eq("bootstrap_4_horizontal")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe ".wrap_field" do
|
16
|
+
it "works" do
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "SexyForm.form" do
|
22
|
+
it "matches docs example" do
|
23
|
+
expected = build_string do |str|
|
24
|
+
str << %Q(<form method="post">)
|
25
|
+
str << %Q(<div class="form-group row">)
|
26
|
+
str << %Q(<label class="col-sm-3 col-form-label" for="email">Email</label>)
|
27
|
+
str << %Q(<div class="col-sm-9">)
|
28
|
+
str << %Q(<input type="text" class="form-control" name="email" id="email">)
|
29
|
+
str << %Q(</div>)
|
30
|
+
str << %Q(</div>)
|
31
|
+
|
32
|
+
str << %Q(<div class="form-group row">)
|
33
|
+
str << %Q(<label class="col-sm-3 col-form-label" for="password">Password</label>)
|
34
|
+
str << %Q(<div class="col-sm-9">)
|
35
|
+
str << %Q(<input type="password" class="form-control" name="password" id="password">)
|
36
|
+
str << %Q(</div>)
|
37
|
+
str << %Q(</div>)
|
38
|
+
|
39
|
+
str << %Q(<div class="form-group row">)
|
40
|
+
str << %Q(<div class="col-sm-offset-3 col-sm-9">)
|
41
|
+
str << %Q(<div class="form-check">)
|
42
|
+
str << %Q(<input type="checkbox" class="form-check-input" name="remember_me" id="remember_me">)
|
43
|
+
str << %Q(<label class="form-check-label" for="remember_me">Remember Me</label>)
|
44
|
+
str << %Q(</div>)
|
45
|
+
str << %Q(</div>)
|
46
|
+
str << %Q(</div>)
|
47
|
+
|
48
|
+
str << %Q(<button type="submit" class="btn btn-default">Sign in</button>)
|
49
|
+
str << %Q(</form>)
|
50
|
+
end
|
51
|
+
|
52
|
+
actual = SexyForm.form(theme: theme_klass.new(column_classes: ["col-sm-3", "col-sm-9"])) do |f|
|
53
|
+
f << f.field(type: :text, name: :email)
|
54
|
+
f << f.field(type: :password, name: :password)
|
55
|
+
f << f.field(type: :checkbox, name: :remember_me)
|
56
|
+
f << %Q(<button type="submit" class="btn btn-default">Sign in</button>)
|
57
|
+
end
|
58
|
+
|
59
|
+
actual.should eq(expected)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe ".form_html_attributes" do
|
64
|
+
it "returns correct attributes" do
|
65
|
+
attrs = {}
|
66
|
+
|
67
|
+
theme.form_html_attributes(html_attrs: {}).should eq(attrs)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
SexyForm::Builder::FIELD_TYPES.each do |field_type|
|
72
|
+
describe ".input_html_attributes" do
|
73
|
+
it "returns correct #{field_type} attributes" do
|
74
|
+
attrs = {}
|
75
|
+
|
76
|
+
case field_type
|
77
|
+
when "checkbox", "radio"
|
78
|
+
attrs["class"] = "form-check-input"
|
79
|
+
when "file"
|
80
|
+
attrs["class"] = "form-control-file"
|
81
|
+
else
|
82
|
+
attrs["class"] = "form-control"
|
83
|
+
end
|
84
|
+
|
85
|
+
theme.input_html_attributes(html_attrs: {}, field_type: field_type, has_errors: false).should eq(attrs)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
describe ".label_html_attributes" do
|
90
|
+
it "returns correct #{field_type} attributes" do
|
91
|
+
attrs = {}
|
92
|
+
|
93
|
+
if ["checkbox", "radio"].include?(field_type)
|
94
|
+
attrs["class"] = "form-check-label"
|
95
|
+
else
|
96
|
+
attrs["class"] = "col-sm-3 col-form-label"
|
97
|
+
end
|
98
|
+
|
99
|
+
theme.label_html_attributes(html_attrs: {}, field_type: field_type, has_errors: false).should eq(attrs)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
describe ".build_html_help_text" do
|
104
|
+
it "returns correct #{field_type} attributes" do
|
105
|
+
expected = "<small class=\"form-text\">foobar</small>"
|
106
|
+
|
107
|
+
attrs = {}
|
108
|
+
|
109
|
+
theme.build_html_help_text(html_attrs: attrs, field_type: field_type, help_text: "foobar").should eq(expected)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
describe ".build_html_error" do
|
114
|
+
it "returns correct #{field_type} attributes" do
|
115
|
+
expected = "<div class=\"invalid-feedback\">foobar</div>"
|
116
|
+
|
117
|
+
attrs = {}
|
118
|
+
|
119
|
+
theme.build_html_error(html_attrs: attrs, field_type: field_type, error: "foobar").should eq(expected)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
require_relative "../../spec_helper"
|
2
|
+
require_relative "./theme_spec_helper"
|
3
|
+
|
4
|
+
theme_klass = SexyForm::Themes::Bootstrap4Inline
|
5
|
+
theme = theme_klass.new
|
6
|
+
|
7
|
+
describe theme_klass do
|
8
|
+
|
9
|
+
describe ".theme_name" do
|
10
|
+
it "is correct" do
|
11
|
+
theme_klass.theme_name.should eq("bootstrap_4_inline")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe ".wrap_field" do
|
16
|
+
it "works" do
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "SexyForm.form" do
|
22
|
+
it "matches docs example" do
|
23
|
+
expected = build_string do |str|
|
24
|
+
str << %Q(<form class="form-inline" method="post">)
|
25
|
+
str << %Q(<div class="form-group">)
|
26
|
+
str << %Q(<label for="email">Email</label>)
|
27
|
+
str << %Q(<input type="text" class="form-control" name="email" id="email">)
|
28
|
+
str << "</div>"
|
29
|
+
|
30
|
+
str << %Q(<div class="form-group">)
|
31
|
+
str << %Q(<label for="password">Password</label>)
|
32
|
+
str << %Q(<input type="password" class="form-control" name="password" id="password">)
|
33
|
+
str << "</div>"
|
34
|
+
|
35
|
+
str << %Q(<div class="form-group form-check">)
|
36
|
+
str << %Q(<input type="checkbox" class="form-check-input" name="remember_me" id="remember_me">)
|
37
|
+
str << %Q(<label class="form-check-label" for="remember_me">Remember Me</label>)
|
38
|
+
str << "</div>"
|
39
|
+
|
40
|
+
str << %Q(<button type="submit" class="btn btn-primary">Sign in</button>)
|
41
|
+
str << "</form>"
|
42
|
+
end
|
43
|
+
|
44
|
+
actual = SexyForm.form(theme: theme_klass.theme_name) do |f|
|
45
|
+
f << f.field(type: :text, name: :email)
|
46
|
+
f << f.field(type: :password, name: :password)
|
47
|
+
f << f.field(type: :checkbox, name: :remember_me)
|
48
|
+
f << %Q(<button type="submit" class="btn btn-primary">Sign in</button>)
|
49
|
+
end
|
50
|
+
|
51
|
+
actual.should eq(expected)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe ".form_html_attributes" do
|
56
|
+
it "returns correct attributes" do
|
57
|
+
attrs = {}
|
58
|
+
|
59
|
+
attrs["class"] = "form-inline"
|
60
|
+
|
61
|
+
theme.form_html_attributes(html_attrs: {}).should eq(attrs)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
SexyForm::Builder::FIELD_TYPES.each do |field_type|
|
66
|
+
describe ".input_html_attributes" do
|
67
|
+
it "returns correct #{field_type} attributes" do
|
68
|
+
attrs = {}
|
69
|
+
|
70
|
+
case field_type
|
71
|
+
when "checkbox", "radio"
|
72
|
+
attrs["class"] = "form-check-input"
|
73
|
+
when "file"
|
74
|
+
attrs["class"] = "form-control-file"
|
75
|
+
else
|
76
|
+
attrs["class"] = "form-control"
|
77
|
+
end
|
78
|
+
|
79
|
+
theme.input_html_attributes(html_attrs: {}, field_type: field_type, has_errors: false).should eq(attrs)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe ".label_html_attributes" do
|
84
|
+
it "returns correct #{field_type} attributes" do
|
85
|
+
attrs = {}
|
86
|
+
|
87
|
+
if ["checkbox", "radio"].include?(field_type)
|
88
|
+
attrs["class"] = "form-check-label"
|
89
|
+
end
|
90
|
+
|
91
|
+
theme.label_html_attributes(html_attrs: {}, field_type: field_type, has_errors: false).should eq(attrs)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
describe ".build_html_help_text" do
|
96
|
+
it "returns correct #{field_type} attributes" do
|
97
|
+
expected = "<small class=\"form-text\">foobar</small>"
|
98
|
+
|
99
|
+
attrs = {}
|
100
|
+
|
101
|
+
theme.build_html_help_text(html_attrs: attrs, field_type: field_type, help_text: "foobar").should eq(expected)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
describe ".build_html_error" do
|
106
|
+
it "returns correct #{field_type} attributes" do
|
107
|
+
expected = "<div class=\"invalid-feedback\">foobar</div>"
|
108
|
+
|
109
|
+
attrs = {}
|
110
|
+
|
111
|
+
theme.build_html_error(html_attrs: attrs, field_type: field_type, error: "foobar").should eq(expected)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|