forme 2.2.0 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,31 +0,0 @@
1
- require_relative 'spec_helper'
2
-
3
- begin
4
- raise LoadError if defined?(JRUBY_VERSION) && /\A9\.2\./.match(JRUBY_VERSION)
5
- require_relative 'sequel_i18n_helper'
6
- rescue LoadError
7
- warn "unable to load i18n, skipping i18n Sequel plugin spec"
8
- else
9
- describe "Forme Sequel::Model forms" do
10
- before do
11
- @ab = Invoice[1]
12
- @b = Forme::Form.new(@ab)
13
- end
14
-
15
- it "should not change the usual label input if translation is not present" do
16
- @b.input(:name).must_equal '<label>Name: <input id="invoice_name" maxlength="255" name="invoice[name]" type="text" value="b"/></label>'
17
- end
18
-
19
- it "should use the translation for the label if present" do
20
- @b.input(:summary).must_equal '<label>Brief Description: <input id="invoice_summary" maxlength="255" name="invoice[summary]" type="text" value="a brief summary"/></label>'
21
- end
22
-
23
- it "should not change the usual legend for the subform if the translation is not present" do
24
- Forme.form(Firm[1]){|f| f.subform(:invoices){ f.input(:name) }}.must_equal '<form class="forme firm" method="post"><input id="firm_invoices_attributes_0_id" name="firm[invoices_attributes][0][id]" type="hidden" value="1"/><fieldset class="inputs"><legend>Invoice #1</legend><label>Name: <input id="firm_invoices_attributes_0_name" maxlength="255" name="firm[invoices_attributes][0][name]" type="text" value="b"/></label></fieldset></form>'
25
- end
26
-
27
- it "should use the translation for the legend on the subform if present" do
28
- Forme.form(Firm[1]){|f| f.subform(:clients){ f.input(:name) }}.must_equal '<form class="forme firm" method="post"><input id="firm_clients_attributes_0_id" name="firm[clients_attributes][0][id]" type="hidden" value="1"/><fieldset class="inputs"><legend>Clientes</legend><label>Name: <input id="firm_clients_attributes_0_name" maxlength="255" name="firm[clients_attributes][0][name]" type="text" value="a great client"/></label></fieldset></form>'
29
- end
30
- end
31
- end