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,16 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require_relative "theme_spec_helper"
|
3
|
+
|
4
|
+
describe SexyForm::Themes::BaseTheme do
|
5
|
+
|
6
|
+
describe ".theme_name" do
|
7
|
+
it "works by default" do
|
8
|
+
SexyForm::Themes::BaseTheme.theme_name.should eq("base_theme")
|
9
|
+
end
|
10
|
+
|
11
|
+
it "works with custom" do
|
12
|
+
SexyForm::Themes::Bootstrap4Inline.theme_name.should eq("bootstrap_4_inline")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
require_relative "../../spec_helper"
|
2
|
+
require_relative "./theme_spec_helper"
|
3
|
+
|
4
|
+
theme_klass = SexyForm::Themes::Bootstrap2Horizontal
|
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_2_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 class="form-horizontal" method="post">)
|
25
|
+
str << %Q(<div class="control-group">)
|
26
|
+
str << %Q(<label class="control-label" for="inputEmail">Email</label>)
|
27
|
+
str << %Q(<div class="controls">)
|
28
|
+
str << %Q(<input type="text" id="inputEmail" placeholder="Email">)
|
29
|
+
str << %Q(</div>)
|
30
|
+
str << %Q(</div>)
|
31
|
+
str << %Q(<div class="control-group">)
|
32
|
+
str << %Q(<label class="control-label" for="inputPassword">Password</label>)
|
33
|
+
str << %Q(<div class="controls">)
|
34
|
+
str << %Q(<input type="password" id="inputPassword" placeholder="Password">)
|
35
|
+
str << %Q(</div>)
|
36
|
+
str << %Q(</div>)
|
37
|
+
str << %Q(<div class="control-group">)
|
38
|
+
str << %Q(<div class="controls">)
|
39
|
+
str << %Q(<label class="checkbox">)
|
40
|
+
str << %Q(<input type="checkbox"> Remember me)
|
41
|
+
str << %Q(</label>)
|
42
|
+
str << %Q(</div>)
|
43
|
+
str << %Q(</div>)
|
44
|
+
str << %Q(<button type="submit" class="btn">Sign in</button>)
|
45
|
+
str << %Q(</form>)
|
46
|
+
end
|
47
|
+
|
48
|
+
actual = SexyForm.form(theme: theme_klass.theme_name) do |f|
|
49
|
+
f << f.field(type: :text, label: "Email", input_html: {id: "inputEmail", placeholder: "Email"})
|
50
|
+
f << f.field(type: :password, label: "Password", input_html: {id: "inputPassword", placeholder: "Password"})
|
51
|
+
f << f.field(type: :checkbox, label: "Remember me")
|
52
|
+
f << %Q(<button type="submit" class="btn">Sign in</button>)
|
53
|
+
end
|
54
|
+
|
55
|
+
actual.should eq(expected)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe ".form_html_attributes" do
|
60
|
+
it "returns correct attributes" do
|
61
|
+
attrs = {}
|
62
|
+
|
63
|
+
attrs["class"] = "form-horizontal"
|
64
|
+
|
65
|
+
theme.form_html_attributes(html_attrs: {}).should eq(attrs)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
SexyForm::Builder::FIELD_TYPES.each do |field_type|
|
70
|
+
describe ".input_html_attributes" do
|
71
|
+
it "returns correct #{field_type} attributes" do
|
72
|
+
attrs = {}
|
73
|
+
|
74
|
+
theme.input_html_attributes(html_attrs: {}, field_type: field_type, has_errors: false).should eq(attrs)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
describe ".label_html_attributes" do
|
79
|
+
it "returns correct #{field_type} attributes" do
|
80
|
+
attrs = {}
|
81
|
+
|
82
|
+
if ["checkbox", "radio"].include?(field_type)
|
83
|
+
attrs["class"] = field_type
|
84
|
+
else
|
85
|
+
attrs["class"] = "control-label"
|
86
|
+
end
|
87
|
+
|
88
|
+
theme.label_html_attributes(html_attrs: {}, field_type: field_type, has_errors: false).should eq(attrs)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
describe ".build_html_help_text" do
|
93
|
+
it "returns correct #{field_type} attributes" do
|
94
|
+
expected = "<span class=\"help-block\">foobar</span>"
|
95
|
+
|
96
|
+
attrs = {}
|
97
|
+
|
98
|
+
theme.build_html_help_text(html_attrs: attrs, field_type: field_type, help_text: "foobar").should eq(expected)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
describe ".build_html_error" do
|
103
|
+
it "returns correct #{field_type} attributes" do
|
104
|
+
expected = "<span class=\"help-block\">foobar</span>"
|
105
|
+
|
106
|
+
attrs = {}
|
107
|
+
|
108
|
+
theme.build_html_error(html_attrs: attrs, field_type: field_type, error: "foobar").should eq(expected)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
|
114
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
require_relative "../../spec_helper"
|
2
|
+
require_relative "./theme_spec_helper"
|
3
|
+
|
4
|
+
theme_klass = SexyForm::Themes::Bootstrap2Inline
|
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_2_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 with labels" do
|
23
|
+
expected = build_string do |str|
|
24
|
+
str << %Q(<form class="form-inline" method="post">)
|
25
|
+
str << "<div>"
|
26
|
+
str << %Q(<label for="email">Email</label>)
|
27
|
+
str << %Q(<input type="text" class="input-small" placeholder="Email" name="email" id="email">)
|
28
|
+
str << "</div>"
|
29
|
+
|
30
|
+
str << "<div>"
|
31
|
+
str << %Q(<label for="password">Password</label>)
|
32
|
+
str << %Q(<input type="password" class="input-small" placeholder="Password" name="password" id="password">)
|
33
|
+
str << "</div>"
|
34
|
+
|
35
|
+
str << "<div>"
|
36
|
+
str << %Q(<label class="checkbox" 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, input_html: {class: "input-small", placeholder: "Email"})
|
47
|
+
f << f.field(type: :password, name: :password, input_html: {class: "input-small", placeholder: "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
|
+
if ["checkbox", "radio"].include?(field_type)
|
80
|
+
attrs["class"] = field_type
|
81
|
+
end
|
82
|
+
|
83
|
+
theme.label_html_attributes(html_attrs: {}, field_type: field_type, has_errors: false).should eq(attrs)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
describe ".build_html_help_text" do
|
88
|
+
it "returns correct #{field_type} attributes" do
|
89
|
+
expected = "<span class=\"help-block\">foobar</span>"
|
90
|
+
|
91
|
+
attrs = {}
|
92
|
+
|
93
|
+
theme.build_html_help_text(html_attrs: attrs, field_type: field_type, help_text: "foobar").should eq(expected)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
describe ".build_html_error" do
|
98
|
+
it "returns correct #{field_type} attributes" do
|
99
|
+
expected = "<span class=\"help-block\">foobar</span>"
|
100
|
+
|
101
|
+
attrs = {}
|
102
|
+
|
103
|
+
theme.build_html_error(html_attrs: attrs, field_type: field_type, error: "foobar").should eq(expected)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
require_relative "../../spec_helper"
|
2
|
+
require_relative "./theme_spec_helper"
|
3
|
+
|
4
|
+
theme_klass = SexyForm::Themes::Bootstrap2Vertical
|
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_2_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="control-group">)
|
26
|
+
str << %Q(<label class="control-label" for="inputEmail">Email</label>)
|
27
|
+
str << %Q(<div class="controls">)
|
28
|
+
str << %Q(<input type="text" id="inputEmail" placeholder="Email">)
|
29
|
+
str << %Q(</div>)
|
30
|
+
str << %Q(</div>)
|
31
|
+
str << %Q(<div class="control-group">)
|
32
|
+
str << %Q(<label class="control-label" for="inputPassword">Password</label>)
|
33
|
+
str << %Q(<div class="controls">)
|
34
|
+
str << %Q(<input type="password" id="inputPassword" placeholder="Password">)
|
35
|
+
str << %Q(</div>)
|
36
|
+
str << %Q(</div>)
|
37
|
+
str << %Q(<div class="control-group">)
|
38
|
+
str << %Q(<div class="controls">)
|
39
|
+
str << %Q(<label class="checkbox">)
|
40
|
+
str << %Q(<input type="checkbox"> Remember me)
|
41
|
+
str << %Q(</label>)
|
42
|
+
str << %Q(</div>)
|
43
|
+
str << %Q(</div>)
|
44
|
+
str << %Q(<button type="submit" class="btn">Sign in</button>)
|
45
|
+
str << %Q(</form>)
|
46
|
+
end
|
47
|
+
|
48
|
+
actual = SexyForm.form(theme: theme_klass.theme_name) do |f|
|
49
|
+
f << f.field(type: :text, label: "Email", input_html: {id: "inputEmail", placeholder: "Email"})
|
50
|
+
f << f.field(type: :password, label: "Password", input_html: {id: "inputPassword", placeholder: "Password"})
|
51
|
+
f << f.field(type: :checkbox, label: "Remember me")
|
52
|
+
f << %Q(<button type="submit" class="btn">Sign in</button>)
|
53
|
+
end
|
54
|
+
|
55
|
+
actual.should eq(expected)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe ".form_html_attributes" do
|
60
|
+
it "returns correct attributes" do
|
61
|
+
attrs = {}
|
62
|
+
|
63
|
+
theme.form_html_attributes(html_attrs: {}).should eq(attrs)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
SexyForm::Builder::FIELD_TYPES.each do |field_type|
|
68
|
+
describe ".input_html_attributes" do
|
69
|
+
it "returns correct #{field_type} attributes" do
|
70
|
+
attrs = {}
|
71
|
+
|
72
|
+
theme.input_html_attributes(html_attrs: {}, field_type: field_type, has_errors: false).should eq(attrs)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
describe ".label_html_attributes" do
|
77
|
+
it "returns correct #{field_type} attributes" do
|
78
|
+
attrs = {}
|
79
|
+
|
80
|
+
if ["checkbox", "radio"].include?(field_type)
|
81
|
+
attrs["class"] = field_type
|
82
|
+
else
|
83
|
+
attrs["class"] = "control-label"
|
84
|
+
end
|
85
|
+
|
86
|
+
theme.label_html_attributes(html_attrs: {}, field_type: field_type, has_errors: false).should eq(attrs)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
describe ".build_html_help_text" do
|
91
|
+
it "returns correct #{field_type} attributes" do
|
92
|
+
expected = "<span class=\"help-block\">foobar</span>"
|
93
|
+
|
94
|
+
attrs = {}
|
95
|
+
|
96
|
+
theme.build_html_help_text(html_attrs: attrs, field_type: field_type, help_text: "foobar").should eq(expected)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
describe ".build_html_error" do
|
101
|
+
it "returns correct #{field_type} attributes" do
|
102
|
+
expected = "<span class=\"help-block\">foobar</span>"
|
103
|
+
|
104
|
+
attrs = {}
|
105
|
+
|
106
|
+
theme.build_html_error(html_attrs: attrs, field_type: field_type, error: "foobar").should eq(expected)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
require_relative "../../spec_helper"
|
2
|
+
require_relative "./theme_spec_helper"
|
3
|
+
|
4
|
+
theme_klass = SexyForm::Themes::Bootstrap3Horizontal
|
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_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 class="form-horizontal" method="post">)
|
25
|
+
str << %Q(<div class="form-group">)
|
26
|
+
str << %Q(<label class="col-sm-3 control-label" for="email">Email</label>)
|
27
|
+
str << %Q(<div class="col-sm-9">)
|
28
|
+
str << %Q(<input type="text" name="email" id="email">)
|
29
|
+
str << %Q(</div>)
|
30
|
+
str << %Q(</div>)
|
31
|
+
|
32
|
+
str << %Q(<div class="form-group">)
|
33
|
+
str << %Q(<label class="col-sm-3 control-label" for="password">Password</label>)
|
34
|
+
str << %Q(<div class="col-sm-9">)
|
35
|
+
str << %Q(<input type="password" name="password" id="password">)
|
36
|
+
str << %Q(</div>)
|
37
|
+
str << %Q(</div>)
|
38
|
+
|
39
|
+
str << %Q(<div class="form-group">)
|
40
|
+
str << %Q(<div class="col-sm-offset-3 col-sm-9">)
|
41
|
+
str << %Q(<div class="checkbox">)
|
42
|
+
str << %Q(<label for="remember_me">)
|
43
|
+
str << %Q(<input type="checkbox" name="remember_me" id="remember_me"> Remember Me)
|
44
|
+
str << %Q(</label>)
|
45
|
+
str << %Q(</div>)
|
46
|
+
str << %Q(</div>)
|
47
|
+
str << %Q(</div>)
|
48
|
+
|
49
|
+
str << %Q(<button type="submit" class="btn btn-default">Sign in</button>)
|
50
|
+
str << %Q(</form>)
|
51
|
+
end
|
52
|
+
|
53
|
+
actual = SexyForm.form(theme: theme_klass.new(column_classes: ["col-sm-3", "col-sm-9"])) do |f|
|
54
|
+
f << f.field(type: :text, name: :email)
|
55
|
+
f << f.field(type: :password, name: :password)
|
56
|
+
f << f.field(type: :checkbox, name: :remember_me)
|
57
|
+
f << %Q(<button type="submit" class="btn btn-default">Sign in</button>)
|
58
|
+
end
|
59
|
+
|
60
|
+
actual.should eq(expected)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe ".form_html_attributes" do
|
65
|
+
it "returns correct attributes" do
|
66
|
+
attrs = {}
|
67
|
+
|
68
|
+
attrs["class"] = "form-horizontal"
|
69
|
+
|
70
|
+
theme.form_html_attributes(html_attrs: {}).should eq(attrs)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
SexyForm::Builder::FIELD_TYPES.each do |field_type|
|
75
|
+
describe ".input_html_attributes" do
|
76
|
+
it "returns correct #{field_type} attributes" do
|
77
|
+
attrs = {}
|
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
|
+
unless ["checkbox", "radio"].include?(field_type)
|
88
|
+
attrs["class"] = "col-sm-3 control-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 = "<span class=\"help-block\">foobar</span>"
|
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 = "<span class=\"help-block\">foobar</span>"
|
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
|