Skip to content

Commit dd2639a

Browse files
committed
fixed input_error_class and fixed spec for checking textarea rows and cols
1 parent c39625f commit dd2639a

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

lib/matestack/ui/bootstrap/form/textarea.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class Matestack::Ui::Bootstrap::Form::Textarea < Matestack::Ui::VueJs::Component
77
optional :form_text
88
optional :disabled
99
optional :placeholder
10-
optional :show_value
10+
optional :show_value # todo: check if this is relevant
1111
optional :rows
1212
optional :cols
1313

@@ -38,7 +38,7 @@ def render_errors
3838
end
3939
end
4040

41-
def textarea_error_class
41+
def input_error_class
4242
'is-invalid'
4343
end
4444

spec/test/form/textarea_spec.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
Rails.application.routes.append do
99
scope "form_text_input_spec" do
1010
post '/textarea_success_form_test', to: 'form_test#success_submit', as: 'textarea_success_form_test'
11-
post '/textarea_failure_form_test', to: 'form_test#failure_submit', as: 'itextareafailure_form_test'
11+
post '/textarea_failure_form_test', to: 'form_test#failure_submit', as: 'textarea_failure_form_test'
1212
end
1313
end
1414
Rails.application.reload_routes!
@@ -27,7 +27,7 @@
2727
end
2828
end
2929
visit example_path
30-
expect(page).to have_selector('form > div.matestack-ui-bootstrap-texetarea > input.form-control#foo[type="text"]')
30+
expect(page).to have_selector('form > div.matestack-ui-bootstrap-textarea > textarea.form-control#foo')
3131

3232
fill_in "foo", with: "bar"
3333

@@ -113,8 +113,10 @@
113113
end
114114
end
115115
visit example_path
116-
expect(page.find(:foo1).height).to be < page.find(:foo2).height
117-
expect(page.find(:foo1).width).to be < page.find(:foo2).width
116+
expect(page.find('textarea#foo1')['rows']).to eq '3'
117+
expect(page.find('textarea#foo1')['cols']).to eq '10'
118+
expect(page.find('textarea#foo2')['rows']).to eq '10'
119+
expect(page.find('textarea#foo2')['cols']).to eq '30'
118120
end
119121

120122

0 commit comments

Comments
 (0)