dill 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c4f5e5b01a5a401e099e5bb0ed40f7112a9c2b9
4
- data.tar.gz: a4c14342f65ff0442f4bbb0243386f5cf7e8854e
3
+ metadata.gz: 14cc24cbf9c3bf17b0c28cb0b79f2478ee23ca84
4
+ data.tar.gz: 02ec3456de6a2b0b39788fe39d95676d90507bb7
5
5
  SHA512:
6
- metadata.gz: 2ab277b0ac806f5feb0dea17401bbeb207bbf7c913c11efb2fa59d73585421197eedc1ef72ee55b750ffe46f0aefe47ffcf9b150cb1ce61360a6b93a98efc241
7
- data.tar.gz: bf9dd094534adf9888becad2b13080be9f4dc3657991a01daab2acfd6977b23ded8edbed8c6f5fff40e5141239415745a9ae1ba4d7806b9e0b3738f5790e7bf8
6
+ metadata.gz: 9fc8dfb00b1031f177cc34c32b973b72386bd29cb06c3aaf104001bb720b648fc02a65b1a7021ee637aee489ba09374ba063618836fe24f4902903ee6b475a39
7
+ data.tar.gz: a1595c25983178de326f53b3c37be841741242a36dcfee677103251e0bc20102784c83592791db4e050ff7053de4cc85581a35b8b26cdbc16907ae5ed509c28b
@@ -1,3 +1,3 @@
1
1
  module Dill
2
- VERSION = '0.8.0'
2
+ VERSION = '0.8.1'
3
3
  end
@@ -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. Returns the label of the
112
- # selected option, or +nil+, if no option is selected.
113
- # <name>=:: Selects an option on the current select. Pass the label of
114
- # the option you want to select.
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>Another option</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="deselected">
129
- # # <select id="deselected">
130
- # # <option>Deselected option</option>
131
- # # <option>Another option</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 :deselected, 'deselected'
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.deselected #=> nil
147
+ # form.selected_value #=> "1s"
146
148
  #
147
- # form.deselected = "Deselected option"
148
- # form.unchecked_box #=> "Deselected option"
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.
@@ -1,7 +1,9 @@
1
1
  module Dill
2
2
  # A select.
3
3
  class Select < Field
4
- widget :selected, '[selected]'
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
- visible?(:selected) ? widget(:selected).text : nil
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.0
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-09-29 00:00:00.000000000 Z
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.6
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