dill 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dill/version.rb +1 -1
- data/lib/dill/widgets/field_group.rb +27 -14
- data/lib/dill/widgets/select.rb +9 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14cc24cbf9c3bf17b0c28cb0b79f2478ee23ca84
|
4
|
+
data.tar.gz: 02ec3456de6a2b0b39788fe39d95676d90507bb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fc8dfb00b1031f177cc34c32b973b72386bd29cb06c3aaf104001bb720b648fc02a65b1a7021ee637aee489ba09374ba063618836fe24f4902903ee6b475a39
|
7
|
+
data.tar.gz: a1595c25983178de326f53b3c37be841741242a36dcfee677103251e0bc20102784c83592791db4e050ff7053de4cc85581a35b8b26cdbc16907ae5ed509c28b
|
data/lib/dill/version.rb
CHANGED
@@ -108,10 +108,12 @@ module Dill
|
|
108
108
|
#
|
109
109
|
# Adds the following methods to the widget:
|
110
110
|
#
|
111
|
-
# <name>:: Gets the current selected option
|
112
|
-
#
|
113
|
-
# <name
|
114
|
-
#
|
111
|
+
# <name>:: Gets the text of the current selected option, or +nil+,
|
112
|
+
# if no option is selected.
|
113
|
+
# <name>_value:: Gets the value of the current selected option, or
|
114
|
+
# +nil+, if no option is selected.
|
115
|
+
# <name>=:: Selects an option on the current select. Pass the text or
|
116
|
+
# value of the option you want to select.
|
115
117
|
#
|
116
118
|
# @example
|
117
119
|
# # Given the following HTML:
|
@@ -120,15 +122,15 @@ module Dill
|
|
120
122
|
# # <p>
|
121
123
|
# # <label for="selected">
|
122
124
|
# # <select id="selected">
|
123
|
-
# # <option selected>Selected option</option>
|
124
|
-
# # <option>
|
125
|
+
# # <option value ="1s" selected>Selected option</option>
|
126
|
+
# # <option value ="2s">Selected option two</option>
|
125
127
|
# # </select>
|
126
128
|
# # </p>
|
127
129
|
# # <p>
|
128
|
-
# # <label for="
|
129
|
-
# # <select id="
|
130
|
-
# # <option>
|
131
|
-
# # <option>
|
130
|
+
# # <label for="unselected">
|
131
|
+
# # <select id="unselected">
|
132
|
+
# # <option value="1u">Unselected option</option>
|
133
|
+
# # <option value="2u">Unselected option two</option>
|
132
134
|
# # </select>
|
133
135
|
# # </p>
|
134
136
|
# # </form>
|
@@ -136,16 +138,23 @@ module Dill
|
|
136
138
|
# root 'form'
|
137
139
|
#
|
138
140
|
# select :selected, 'selected'
|
139
|
-
# select :
|
141
|
+
# select :unselected, 'unselected'
|
140
142
|
# end
|
141
143
|
#
|
142
144
|
# form = widget(:my_field_group)
|
143
145
|
#
|
144
146
|
# form.selected #=> "Selected option"
|
145
|
-
# form.
|
147
|
+
# form.selected_value #=> "1s"
|
146
148
|
#
|
147
|
-
#
|
148
|
-
# form.
|
149
|
+
# # Select by text
|
150
|
+
# form.unselected #=> nil
|
151
|
+
# form.unselected = "Unselected option"
|
152
|
+
# form.unselected #=> "Unselected option"
|
153
|
+
#
|
154
|
+
# # Select by value
|
155
|
+
# form.unselected = "2u"
|
156
|
+
# form.unselected #=> "Unselected option two"
|
157
|
+
# form.unselected_value #=> "2u"
|
149
158
|
#
|
150
159
|
# @param name the name of the select accessor.
|
151
160
|
# @param locator the locator for the select. If +nil+ the locator will
|
@@ -159,6 +168,10 @@ module Dill
|
|
159
168
|
# @todo What to do when +nil+ is passed to the writer?
|
160
169
|
def self.select(name, locator = nil)
|
161
170
|
field name, locator, Select
|
171
|
+
|
172
|
+
define_method "#{name}_value" do
|
173
|
+
widget(name).value
|
174
|
+
end
|
162
175
|
end
|
163
176
|
|
164
177
|
# Creates a new text field accessor.
|
data/lib/dill/widgets/select.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
module Dill
|
2
2
|
# A select.
|
3
3
|
class Select < Field
|
4
|
-
|
4
|
+
def selected
|
5
|
+
root.all(:xpath, ".//option", visible: true).select(&:selected?).first
|
6
|
+
end
|
5
7
|
|
6
8
|
module Selectable
|
7
9
|
def select
|
@@ -21,7 +23,12 @@ module Dill
|
|
21
23
|
|
22
24
|
# @return [String] The text of the selected option.
|
23
25
|
def get
|
24
|
-
|
26
|
+
selected.text unless selected.nil?
|
27
|
+
end
|
28
|
+
|
29
|
+
# @return [String] The value of the selected option.
|
30
|
+
def value
|
31
|
+
selected.value unless selected.nil?
|
25
32
|
end
|
26
33
|
|
27
34
|
# Selects the given +option+.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dill
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Leal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chronic
|
@@ -229,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
229
229
|
version: '0'
|
230
230
|
requirements: []
|
231
231
|
rubyforge_project: "[none]"
|
232
|
-
rubygems_version: 2.4.
|
232
|
+
rubygems_version: 2.4.8
|
233
233
|
signing_key:
|
234
234
|
specification_version: 4
|
235
235
|
summary: A set of helpers to ease integration testing
|