formulaic 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS.md +7 -0
- data/lib/formulaic/inputs/date_input.rb +1 -1
- data/lib/formulaic/version.rb +1 -1
- data/spec/features/fill_in_user_form_spec.rb +19 -0
- data/spec/fixtures/event_form.html +114 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 402a37df86e5dd8b34b2aa265b27ebf777ef2a15
|
4
|
+
data.tar.gz: 85085a9bbf8b9a4e575c0cc0cac2d880210f61a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbb668c73e63d172e8769f7a5f4e63db0cacb478d02f0210365cab04c872e3705f82e22b5713d295a36c77fca4ab756887a910f435b065f2a98876aacb5bbe8d
|
7
|
+
data.tar.gz: dc8a724475b8548eb3bf414c1f859558a67e63f809003156f1050fae839be484a1762130c1db066a39fb3995dcfb256800b2e16a7eac04cd8d61229ddc0691e8
|
data/NEWS.md
CHANGED
@@ -8,7 +8,7 @@ module Formulaic
|
|
8
8
|
private
|
9
9
|
|
10
10
|
def select_date(date, options)
|
11
|
-
field = find_field(options[:from].to_s)["id"].gsub(/
|
11
|
+
field = find_field(options[:from].to_s)["id"].gsub(/_\di/, "")
|
12
12
|
select date.year.to_s, from: "#{field}_1i"
|
13
13
|
select Date::MONTHNAMES[date.month], from: "#{field}_2i"
|
14
14
|
select date.day.to_s, from: "#{field}_3i"
|
data/lib/formulaic/version.rb
CHANGED
@@ -106,4 +106,23 @@ describe 'Fill in user form' do
|
|
106
106
|
|
107
107
|
expect(input(:user, :avatar).value).to eq file.path
|
108
108
|
end
|
109
|
+
|
110
|
+
it 'finds and fills a date field regardless of select box order' do
|
111
|
+
visit 'event_form'
|
112
|
+
|
113
|
+
form = Formulaic::Form.new :event, :new,
|
114
|
+
"Starts on" => Date.new(2014, 3, 4),
|
115
|
+
"Ends on" => Date.new(2015, 12, 31)
|
116
|
+
|
117
|
+
form.fill
|
118
|
+
|
119
|
+
expect(page.find('#event_starts_on_1i').value).to eq('2014')
|
120
|
+
expect(page.find('#event_starts_on_2i').value).to eq('3')
|
121
|
+
expect(page.find('#event_starts_on_3i').value).to eq('4')
|
122
|
+
|
123
|
+
expect(page.find('#event_ends_on_1i').value).to eq('2015')
|
124
|
+
expect(page.find('#event_ends_on_2i').value).to eq('12')
|
125
|
+
expect(page.find('#event_ends_on_3i').value).to eq('31')
|
126
|
+
end
|
127
|
+
|
109
128
|
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
<form accept-charset="UTF-8" action="/events" class="simple_form new_event" id="new_event" method="post" novalidate="novalidate">
|
2
|
+
<div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"><input name="authenticity_token" type="hidden" value="O6ORla31JvEaWroCuiA7bArM15ztDotMfPAbNW0v61g="></div>
|
3
|
+
<div class="input date required event_starts_on">
|
4
|
+
<label class="date required" for="event_starts_on_2i"><abbr title="required">*</abbr> Starts on</label>
|
5
|
+
<select class="date required" id="event_starts_on_2i" name="event[starts_on(2i)]">
|
6
|
+
<option value="1">January</option>
|
7
|
+
<option value="2">February</option>
|
8
|
+
<option value="3">March</option>
|
9
|
+
<option value="4">April</option>
|
10
|
+
<option value="5">May</option>
|
11
|
+
<option selected="selected" value="6">June</option>
|
12
|
+
<option value="7">July</option>
|
13
|
+
<option value="8">August</option>
|
14
|
+
<option value="9">September</option>
|
15
|
+
<option value="10">October</option>
|
16
|
+
<option value="11">November</option>
|
17
|
+
<option value="12">December</option>
|
18
|
+
</select>
|
19
|
+
<select class="date required" id="event_starts_on_3i" name="event[starts_on(3i)]">
|
20
|
+
<option value="1">1</option>
|
21
|
+
<option value="2">2</option>
|
22
|
+
<option value="3">3</option>
|
23
|
+
<option value="4">4</option>
|
24
|
+
<option value="5">5</option>
|
25
|
+
<option value="6">6</option>
|
26
|
+
<option selected="selected" value="7">7</option>
|
27
|
+
<option value="8">8</option>
|
28
|
+
<option value="9">9</option>
|
29
|
+
<option value="10">10</option>
|
30
|
+
<option value="11">11</option>
|
31
|
+
<option value="12">12</option>
|
32
|
+
<option value="13">13</option>
|
33
|
+
<option value="14">14</option>
|
34
|
+
<option value="15">15</option>
|
35
|
+
<option value="16">16</option>
|
36
|
+
<option value="17">17</option>
|
37
|
+
<option value="18">18</option>
|
38
|
+
<option value="19">19</option>
|
39
|
+
<option value="20">20</option>
|
40
|
+
<option value="21">21</option>
|
41
|
+
<option value="22">22</option>
|
42
|
+
<option value="23">23</option>
|
43
|
+
<option value="24">24</option>
|
44
|
+
<option value="25">25</option>
|
45
|
+
<option value="26">26</option>
|
46
|
+
<option value="27">27</option>
|
47
|
+
<option value="28">28</option>
|
48
|
+
<option value="29">29</option>
|
49
|
+
<option value="30">30</option>
|
50
|
+
<option value="31">31</option>
|
51
|
+
</select>
|
52
|
+
<select class="date required" id="event_starts_on_1i" name="event[starts_on(1i)]">
|
53
|
+
<option value="2016">2016</option>
|
54
|
+
<option value="2015">2015</option>
|
55
|
+
<option value="2014">2014</option>
|
56
|
+
</select>
|
57
|
+
</div>
|
58
|
+
<div class="input date required event_ends_on">
|
59
|
+
<label class="date required" for="event_ends_on_3i">Ends on</label>
|
60
|
+
<select class="date required" id="event_ends_on_3i" name="event[ends_on(3i)]">
|
61
|
+
<option value="1">1</option>
|
62
|
+
<option value="2">2</option>
|
63
|
+
<option value="3">3</option>
|
64
|
+
<option value="4">4</option>
|
65
|
+
<option value="5">5</option>
|
66
|
+
<option value="6">6</option>
|
67
|
+
<option selected="selected" value="7">7</option>
|
68
|
+
<option value="8">8</option>
|
69
|
+
<option value="9">9</option>
|
70
|
+
<option value="10">10</option>
|
71
|
+
<option value="11">11</option>
|
72
|
+
<option value="12">12</option>
|
73
|
+
<option value="13">13</option>
|
74
|
+
<option value="14">14</option>
|
75
|
+
<option value="15">15</option>
|
76
|
+
<option value="16">16</option>
|
77
|
+
<option value="17">17</option>
|
78
|
+
<option value="18">18</option>
|
79
|
+
<option value="19">19</option>
|
80
|
+
<option value="20">20</option>
|
81
|
+
<option value="21">21</option>
|
82
|
+
<option value="22">22</option>
|
83
|
+
<option value="23">23</option>
|
84
|
+
<option value="24">24</option>
|
85
|
+
<option value="25">25</option>
|
86
|
+
<option value="26">26</option>
|
87
|
+
<option value="27">27</option>
|
88
|
+
<option value="28">28</option>
|
89
|
+
<option value="29">29</option>
|
90
|
+
<option value="30">30</option>
|
91
|
+
<option value="31">31</option>
|
92
|
+
</select>
|
93
|
+
<select class="date required" id="event_ends_on_2i" name="event[ends_on(2i)]">
|
94
|
+
<option value="1">January</option>
|
95
|
+
<option value="2">February</option>
|
96
|
+
<option value="3">March</option>
|
97
|
+
<option value="4">April</option>
|
98
|
+
<option value="5">May</option>
|
99
|
+
<option selected="selected" value="6">June</option>
|
100
|
+
<option value="7">July</option>
|
101
|
+
<option value="8">August</option>
|
102
|
+
<option value="9">September</option>
|
103
|
+
<option value="10">October</option>
|
104
|
+
<option value="11">November</option>
|
105
|
+
<option value="12">December</option>
|
106
|
+
</select>
|
107
|
+
<select class="date required" id="event_ends_on_1i" name="event[ends_on(1i)]">
|
108
|
+
<option value="2016">2016</option>
|
109
|
+
<option value="2015">2015</option>
|
110
|
+
<option value="2014">2014</option>
|
111
|
+
</select>
|
112
|
+
</div>
|
113
|
+
<input name="commit" type="submit" value="Save">
|
114
|
+
</form>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: formulaic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Caleb Thompson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
@@ -143,6 +143,7 @@ files:
|
|
143
143
|
- lib/formulaic/label.rb
|
144
144
|
- lib/formulaic/version.rb
|
145
145
|
- spec/features/fill_in_user_form_spec.rb
|
146
|
+
- spec/fixtures/event_form.html
|
146
147
|
- spec/fixtures/file.txt
|
147
148
|
- spec/fixtures/user_form.html
|
148
149
|
- spec/formulaic/dsl_spec.rb
|
@@ -175,6 +176,7 @@ specification_version: 4
|
|
175
176
|
summary: Simplify form filling with Capybara
|
176
177
|
test_files:
|
177
178
|
- spec/features/fill_in_user_form_spec.rb
|
179
|
+
- spec/fixtures/event_form.html
|
178
180
|
- spec/fixtures/file.txt
|
179
181
|
- spec/fixtures/user_form.html
|
180
182
|
- spec/formulaic/dsl_spec.rb
|