watir 6.13.0 → 6.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (223) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +141 -0
  3. data/.travis.yml +6 -0
  4. data/CHANGES.md +12 -0
  5. data/Gemfile +4 -10
  6. data/README.md +64 -49
  7. data/Rakefile +28 -16
  8. data/lib/watir.rb +13 -15
  9. data/lib/watir/adjacent.rb +15 -13
  10. data/lib/watir/after_hooks.rb +8 -10
  11. data/lib/watir/alert.rb +7 -8
  12. data/lib/watir/aliases.rb +2 -2
  13. data/lib/watir/attribute_helper.rb +18 -20
  14. data/lib/watir/browser.rb +42 -75
  15. data/lib/watir/capabilities.rb +19 -10
  16. data/lib/watir/cell_container.rb +0 -2
  17. data/lib/watir/container.rb +4 -4
  18. data/lib/watir/cookies.rb +7 -8
  19. data/lib/watir/element_collection.rb +37 -22
  20. data/lib/watir/elements/area.rb +0 -2
  21. data/lib/watir/elements/button.rb +1 -3
  22. data/lib/watir/elements/cell.rb +0 -1
  23. data/lib/watir/elements/checkbox.rb +5 -7
  24. data/lib/watir/elements/date_field.rb +5 -9
  25. data/lib/watir/elements/date_time_field.rb +6 -10
  26. data/lib/watir/elements/dlist.rb +2 -4
  27. data/lib/watir/elements/element.rb +201 -99
  28. data/lib/watir/elements/file_field.rb +3 -4
  29. data/lib/watir/elements/font.rb +2 -4
  30. data/lib/watir/elements/form.rb +0 -2
  31. data/lib/watir/elements/hidden.rb +3 -4
  32. data/lib/watir/elements/html_elements.rb +24 -76
  33. data/lib/watir/elements/iframe.rb +57 -71
  34. data/lib/watir/elements/image.rb +3 -4
  35. data/lib/watir/elements/input.rb +0 -2
  36. data/lib/watir/elements/link.rb +2 -5
  37. data/lib/watir/elements/list.rb +4 -4
  38. data/lib/watir/elements/option.rb +3 -6
  39. data/lib/watir/elements/radio.rb +4 -6
  40. data/lib/watir/elements/row.rb +0 -1
  41. data/lib/watir/elements/select.rb +41 -43
  42. data/lib/watir/elements/svg_elements.rb +0 -116
  43. data/lib/watir/elements/table.rb +1 -2
  44. data/lib/watir/elements/table_cell.rb +2 -3
  45. data/lib/watir/elements/text_field.rb +4 -6
  46. data/lib/watir/exception.rb +0 -1
  47. data/lib/watir/extensions/nokogiri.rb +2 -4
  48. data/lib/watir/generator.rb +3 -3
  49. data/lib/watir/generator/base.rb +10 -10
  50. data/lib/watir/generator/base/generator.rb +26 -29
  51. data/lib/watir/generator/base/idl_sorter.rb +34 -32
  52. data/lib/watir/generator/base/spec_extractor.rb +132 -114
  53. data/lib/watir/generator/base/util.rb +1 -3
  54. data/lib/watir/generator/base/visitor.rb +140 -140
  55. data/lib/watir/generator/html.rb +4 -4
  56. data/lib/watir/generator/html/generator.rb +2 -4
  57. data/lib/watir/generator/html/spec_extractor.rb +33 -33
  58. data/lib/watir/generator/html/visitor.rb +14 -14
  59. data/lib/watir/generator/svg.rb +3 -3
  60. data/lib/watir/generator/svg/generator.rb +1 -3
  61. data/lib/watir/generator/svg/spec_extractor.rb +35 -35
  62. data/lib/watir/generator/svg/visitor.rb +14 -14
  63. data/lib/watir/has_window.rb +2 -4
  64. data/lib/watir/js_execution.rb +7 -9
  65. data/lib/watir/js_snippets.rb +3 -3
  66. data/lib/watir/js_snippets/attributeValues.js +11 -0
  67. data/lib/watir/legacy_wait.rb +7 -12
  68. data/lib/watir/locators.rb +9 -11
  69. data/lib/watir/locators/button/locator.rb +2 -3
  70. data/lib/watir/locators/button/selector_builder.rb +9 -9
  71. data/lib/watir/locators/button/selector_builder/xpath.rb +1 -1
  72. data/lib/watir/locators/button/validator.rb +2 -2
  73. data/lib/watir/locators/cell/locator.rb +0 -2
  74. data/lib/watir/locators/cell/selector_builder.rb +3 -5
  75. data/lib/watir/locators/element/locator.rb +85 -64
  76. data/lib/watir/locators/element/selector_builder.rb +40 -38
  77. data/lib/watir/locators/element/selector_builder/xpath.rb +20 -18
  78. data/lib/watir/locators/element/validator.rb +1 -1
  79. data/lib/watir/locators/row/locator.rb +0 -2
  80. data/lib/watir/locators/row/selector_builder.rb +6 -9
  81. data/lib/watir/locators/text_area/selector_builder.rb +1 -1
  82. data/lib/watir/locators/text_field/locator.rb +1 -3
  83. data/lib/watir/locators/text_field/selector_builder.rb +5 -5
  84. data/lib/watir/locators/text_field/selector_builder/xpath.rb +1 -1
  85. data/lib/watir/locators/text_field/validator.rb +3 -2
  86. data/lib/watir/logger.rb +11 -21
  87. data/lib/watir/navigation.rb +49 -0
  88. data/lib/watir/radio_set.rb +17 -18
  89. data/lib/watir/row_container.rb +3 -5
  90. data/lib/watir/screenshot.rb +2 -4
  91. data/lib/watir/user_editable.rb +13 -8
  92. data/lib/watir/version.rb +3 -0
  93. data/lib/watir/wait.rb +56 -55
  94. data/lib/watir/wait/timer.rb +1 -3
  95. data/lib/watir/window.rb +36 -45
  96. data/lib/watir/xpath_support.rb +1 -3
  97. data/lib/watirspec.rb +11 -11
  98. data/lib/watirspec/guards.rb +10 -7
  99. data/lib/watirspec/implementation.rb +3 -4
  100. data/lib/watirspec/rake_tasks.rb +30 -29
  101. data/lib/watirspec/remote_server.rb +3 -3
  102. data/lib/watirspec/runner.rb +1 -2
  103. data/lib/watirspec/server.rb +3 -0
  104. data/lib/watirspec/server/app.rb +14 -6
  105. data/spec/implementation_spec.rb +9 -9
  106. data/spec/locator_spec_helper.rb +3 -4
  107. data/spec/spec_helper.rb +3 -7
  108. data/spec/unit/container_spec.rb +9 -10
  109. data/spec/unit/element_locator_spec.rb +224 -219
  110. data/spec/unit/logger_spec.rb +4 -4
  111. data/spec/unit/unit_helper.rb +0 -2
  112. data/spec/unit/wait_spec.rb +26 -28
  113. data/spec/watirspec/adjacent_spec.rb +130 -130
  114. data/spec/watirspec/after_hooks_spec.rb +63 -63
  115. data/spec/watirspec/alert_spec.rb +6 -6
  116. data/spec/watirspec/attributes_spec.rb +6 -6
  117. data/spec/watirspec/browser_spec.rb +161 -162
  118. data/spec/watirspec/click_spec.rb +9 -9
  119. data/spec/watirspec/cookies_spec.rb +15 -14
  120. data/spec/watirspec/drag_and_drop_spec.rb +15 -16
  121. data/spec/watirspec/element_hidden_spec.rb +19 -21
  122. data/spec/watirspec/elements/area_spec.rb +18 -21
  123. data/spec/watirspec/elements/areas_spec.rb +13 -15
  124. data/spec/watirspec/elements/button_spec.rb +96 -99
  125. data/spec/watirspec/elements/buttons_spec.rb +17 -19
  126. data/spec/watirspec/elements/checkbox_spec.rb +102 -100
  127. data/spec/watirspec/elements/checkboxes_spec.rb +13 -15
  128. data/spec/watirspec/elements/collections_spec.rb +35 -37
  129. data/spec/watirspec/elements/date_field_spec.rb +46 -47
  130. data/spec/watirspec/elements/date_fields_spec.rb +13 -15
  131. data/spec/watirspec/elements/date_time_field_spec.rb +62 -57
  132. data/spec/watirspec/elements/date_time_fields_spec.rb +14 -15
  133. data/spec/watirspec/elements/dd_spec.rb +46 -48
  134. data/spec/watirspec/elements/dds_spec.rb +13 -15
  135. data/spec/watirspec/elements/del_spec.rb +27 -28
  136. data/spec/watirspec/elements/dels_spec.rb +13 -15
  137. data/spec/watirspec/elements/div_spec.rb +89 -91
  138. data/spec/watirspec/elements/divs_spec.rb +17 -19
  139. data/spec/watirspec/elements/dl_spec.rb +52 -54
  140. data/spec/watirspec/elements/dls_spec.rb +13 -15
  141. data/spec/watirspec/elements/dt_spec.rb +46 -48
  142. data/spec/watirspec/elements/dts_spec.rb +13 -15
  143. data/spec/watirspec/elements/element_spec.rb +240 -189
  144. data/spec/watirspec/elements/elements_spec.rb +16 -16
  145. data/spec/watirspec/elements/em_spec.rb +38 -40
  146. data/spec/watirspec/elements/ems_spec.rb +13 -15
  147. data/spec/watirspec/elements/filefield_spec.rb +45 -46
  148. data/spec/watirspec/elements/filefields_spec.rb +13 -15
  149. data/spec/watirspec/elements/font_spec.rb +11 -13
  150. data/spec/watirspec/elements/form_spec.rb +13 -15
  151. data/spec/watirspec/elements/forms_spec.rb +13 -15
  152. data/spec/watirspec/elements/frame_spec.rb +48 -50
  153. data/spec/watirspec/elements/frames_spec.rb +13 -15
  154. data/spec/watirspec/elements/hidden_spec.rb +23 -25
  155. data/spec/watirspec/elements/hiddens_spec.rb +13 -15
  156. data/spec/watirspec/elements/hn_spec.rb +22 -24
  157. data/spec/watirspec/elements/hns_spec.rb +13 -13
  158. data/spec/watirspec/elements/iframe_spec.rb +106 -74
  159. data/spec/watirspec/elements/iframes_spec.rb +16 -18
  160. data/spec/watirspec/elements/image_spec.rb +30 -32
  161. data/spec/watirspec/elements/images_spec.rb +13 -15
  162. data/spec/watirspec/elements/input_spec.rb +4 -5
  163. data/spec/watirspec/elements/ins_spec.rb +27 -29
  164. data/spec/watirspec/elements/inses_spec.rb +13 -15
  165. data/spec/watirspec/elements/label_spec.rb +17 -19
  166. data/spec/watirspec/elements/labels_spec.rb +13 -15
  167. data/spec/watirspec/elements/li_spec.rb +23 -25
  168. data/spec/watirspec/elements/link_spec.rb +45 -48
  169. data/spec/watirspec/elements/links_spec.rb +14 -16
  170. data/spec/watirspec/elements/lis_spec.rb +13 -15
  171. data/spec/watirspec/elements/list_spec.rb +14 -15
  172. data/spec/watirspec/elements/map_spec.rb +19 -20
  173. data/spec/watirspec/elements/maps_spec.rb +13 -15
  174. data/spec/watirspec/elements/meta_spec.rb +10 -10
  175. data/spec/watirspec/elements/metas_spec.rb +13 -15
  176. data/spec/watirspec/elements/ol_spec.rb +20 -21
  177. data/spec/watirspec/elements/ols_spec.rb +13 -15
  178. data/spec/watirspec/elements/option_spec.rb +63 -63
  179. data/spec/watirspec/elements/p_spec.rb +27 -26
  180. data/spec/watirspec/elements/pre_spec.rb +24 -25
  181. data/spec/watirspec/elements/pres_spec.rb +13 -15
  182. data/spec/watirspec/elements/ps_spec.rb +13 -15
  183. data/spec/watirspec/elements/radio_spec.rb +96 -97
  184. data/spec/watirspec/elements/radios_spec.rb +13 -15
  185. data/spec/watirspec/elements/select_list_spec.rb +244 -237
  186. data/spec/watirspec/elements/select_lists_spec.rb +15 -16
  187. data/spec/watirspec/elements/span_spec.rb +32 -31
  188. data/spec/watirspec/elements/spans_spec.rb +13 -15
  189. data/spec/watirspec/elements/strong_spec.rb +23 -24
  190. data/spec/watirspec/elements/strongs_spec.rb +13 -15
  191. data/spec/watirspec/elements/table_nesting_spec.rb +15 -14
  192. data/spec/watirspec/elements/table_spec.rb +61 -62
  193. data/spec/watirspec/elements/tables_spec.rb +15 -17
  194. data/spec/watirspec/elements/tbody_spec.rb +25 -26
  195. data/spec/watirspec/elements/tbodys_spec.rb +17 -19
  196. data/spec/watirspec/elements/td_spec.rb +20 -22
  197. data/spec/watirspec/elements/tds_spec.rb +9 -11
  198. data/spec/watirspec/elements/text_field_spec.rb +55 -56
  199. data/spec/watirspec/elements/text_fields_spec.rb +15 -16
  200. data/spec/watirspec/elements/textarea_spec.rb +2 -2
  201. data/spec/watirspec/elements/textareas_spec.rb +1 -1
  202. data/spec/watirspec/elements/tfoot_spec.rb +22 -23
  203. data/spec/watirspec/elements/tfoots_spec.rb +19 -19
  204. data/spec/watirspec/elements/thead_spec.rb +21 -23
  205. data/spec/watirspec/elements/theads_spec.rb +19 -19
  206. data/spec/watirspec/elements/tr_spec.rb +20 -22
  207. data/spec/watirspec/elements/trs_spec.rb +17 -19
  208. data/spec/watirspec/elements/ul_spec.rb +17 -19
  209. data/spec/watirspec/elements/uls_spec.rb +13 -14
  210. data/spec/watirspec/html/data_attributes.html +1 -0
  211. data/spec/watirspec/radio_set_spec.rb +100 -99
  212. data/spec/watirspec/relaxed_locate_spec.rb +19 -43
  213. data/spec/watirspec/screenshot_spec.rb +4 -4
  214. data/spec/watirspec/special_chars_spec.rb +2 -4
  215. data/spec/watirspec/support/rspec_matchers.rb +85 -22
  216. data/spec/watirspec/user_editable_spec.rb +84 -85
  217. data/spec/watirspec/wait_spec.rb +74 -95
  218. data/spec/watirspec/window_switching_spec.rb +131 -132
  219. data/spec/watirspec_helper.rb +12 -9
  220. data/support/travis.sh +4 -0
  221. data/support/version_differ.rb +12 -13
  222. data/watir.gemspec +29 -22
  223. metadata +76 -50
@@ -1,14 +1,13 @@
1
- require "watirspec_helper"
2
-
3
- describe "SelectList" do
1
+ require 'watirspec_helper'
4
2
 
3
+ describe 'SelectList' do
5
4
  before :each do
6
- browser.goto(WatirSpec.url_for("forms_with_input_elements.html"))
5
+ browser.goto(WatirSpec.url_for('forms_with_input_elements.html'))
7
6
  end
8
7
 
9
8
  # Exists method
10
- describe "#exists?" do
11
- it "returns true if the select list exists" do
9
+ describe '#exists?' do
10
+ it 'returns true if the select list exists' do
12
11
  expect(browser.select_list(id: 'new_user_country')).to exist
13
12
  expect(browser.select_list(id: /new_user_country/)).to exist
14
13
  expect(browser.select_list(name: 'new_user_country')).to exist
@@ -19,7 +18,7 @@ describe "SelectList" do
19
18
  expect(browser.select_list(xpath: "//select[@id='new_user_country']")).to exist
20
19
  end
21
20
 
22
- it "returns the first select if given no args" do
21
+ it 'returns the first select if given no args' do
23
22
  expect(browser.select_list).to exist
24
23
  end
25
24
 
@@ -44,8 +43,8 @@ describe "SelectList" do
44
43
  end
45
44
 
46
45
  # Attribute methods
47
- describe "#class_name" do
48
- it "returns the class name of the select list" do
46
+ describe '#class_name' do
47
+ it 'returns the class name of the select list' do
49
48
  expect(browser.select_list(name: 'new_user_country').class_name).to eq 'country'
50
49
  end
51
50
 
@@ -54,9 +53,9 @@ describe "SelectList" do
54
53
  end
55
54
  end
56
55
 
57
- describe "#id" do
58
- it "returns the id of the element" do
59
- expect(browser.select_list(index: 0).id).to eq "new_user_country"
56
+ describe '#id' do
57
+ it 'returns the id of the element' do
58
+ expect(browser.select_list(index: 0).id).to eq 'new_user_country'
60
59
  end
61
60
 
62
61
  it "raises UnknownObjectException if the select list doesn't exist" do
@@ -64,9 +63,9 @@ describe "SelectList" do
64
63
  end
65
64
  end
66
65
 
67
- describe "#name" do
68
- it "returns the name of the element" do
69
- expect(browser.select_list(index: 0).name).to eq "new_user_country"
66
+ describe '#name' do
67
+ it 'returns the name of the element' do
68
+ expect(browser.select_list(index: 0).name).to eq 'new_user_country'
70
69
  end
71
70
 
72
71
  it "raises UnknownObjectException if the select list doesn't exist" do
@@ -74,8 +73,8 @@ describe "SelectList" do
74
73
  end
75
74
  end
76
75
 
77
- describe "#multiple?" do
78
- it "knows whether the select list allows multiple selections" do
76
+ describe '#multiple?' do
77
+ it 'knows whether the select list allows multiple selections' do
79
78
  expect(browser.select_list(index: 0)).to_not be_multiple
80
79
  expect(browser.select_list(index: 1)).to be_multiple
81
80
  end
@@ -85,12 +84,12 @@ describe "SelectList" do
85
84
  end
86
85
  end
87
86
 
88
- describe "#value" do
87
+ describe '#value' do
89
88
  not_compliant_on :safari do
90
- it "returns the value of the selected option" do
91
- expect(browser.select_list(index: 0).value).to eq "2"
89
+ it 'returns the value of the selected option' do
90
+ expect(browser.select_list(index: 0).value).to eq '2'
92
91
  browser.select_list(index: 0).select(/Sweden/)
93
- expect(browser.select_list(index: 0).value).to eq "3"
92
+ expect(browser.select_list(index: 0).value).to eq '3'
94
93
  end
95
94
  end
96
95
 
@@ -99,12 +98,12 @@ describe "SelectList" do
99
98
  end
100
99
  end
101
100
 
102
- describe "#text" do
101
+ describe '#text' do
103
102
  not_compliant_on :safari do
104
- it "returns the text of the selected option" do
105
- expect(browser.select_list(index: 0).text).to eq "Norway"
103
+ it 'returns the text of the selected option' do
104
+ expect(browser.select_list(index: 0).text).to eq 'Norway'
106
105
  browser.select_list(index: 0).select(/Sweden/)
107
- expect(browser.select_list(index: 0).text).to eq "Sweden"
106
+ expect(browser.select_list(index: 0).text).to eq 'Sweden'
108
107
  end
109
108
 
110
109
  it "raises UnknownObjectException if the select list doesn't exist" do
@@ -113,8 +112,8 @@ describe "SelectList" do
113
112
  end
114
113
  end
115
114
 
116
- describe "#respond_to?" do
117
- it "returns true for all attribute methods" do
115
+ describe '#respond_to?' do
116
+ it 'returns true for all attribute methods' do
118
117
  expect(browser.select_list(index: 0)).to respond_to(:class_name)
119
118
  expect(browser.select_list(index: 0)).to respond_to(:id)
120
119
  expect(browser.select_list(index: 0)).to respond_to(:name)
@@ -123,12 +122,12 @@ describe "SelectList" do
123
122
  end
124
123
 
125
124
  # Access methods
126
- describe "#enabled?" do
127
- it "returns true if the select list is enabled" do
125
+ describe '#enabled?' do
126
+ it 'returns true if the select list is enabled' do
128
127
  expect(browser.select_list(name: 'new_user_country')).to be_enabled
129
128
  end
130
129
 
131
- it "returns false if the select list is disabled" do
130
+ it 'returns false if the select list is disabled' do
132
131
  expect(browser.select_list(name: 'new_user_role')).to_not be_enabled
133
132
  end
134
133
 
@@ -137,61 +136,61 @@ describe "SelectList" do
137
136
  end
138
137
  end
139
138
 
140
- describe "#disabled?" do
141
- it "returns true if the select list is disabled" do
139
+ describe '#disabled?' do
140
+ it 'returns true if the select list is disabled' do
142
141
  expect(browser.select_list(index: 2)).to be_disabled
143
142
  end
144
143
 
145
- it "returns false if the select list is enabled" do
144
+ it 'returns false if the select list is enabled' do
146
145
  expect(browser.select_list(index: 0)).to_not be_disabled
147
146
  end
148
147
 
149
- it "should raise UnknownObjectException when the select list does not exist" do
148
+ it 'should raise UnknownObjectException when the select list does not exist' do
150
149
  expect { browser.select_list(index: 1337).disabled? }.to raise_unknown_object_exception
151
150
  end
152
151
  end
153
152
 
154
153
  # Other
155
- describe "#option" do
156
- it "returns an instance of Option" do
157
- option = browser.select_list(name: "new_user_country").option(text: "Denmark")
154
+ describe '#option' do
155
+ it 'returns an instance of Option' do
156
+ option = browser.select_list(name: 'new_user_country').option(text: 'Denmark')
158
157
  expect(option).to be_instance_of(Watir::Option)
159
- expect(option.value).to eq "1"
158
+ expect(option.value).to eq '1'
160
159
  end
161
160
  end
162
161
 
163
- describe "#options" do
164
- it "returns all the options" do
165
- options = browser.select_list(name: "new_user_country").options
166
- expect(options.map(&:text)).to eq ["Denmark", "Norway", "Sweden", "United Kingdom", "USA", "Germany"]
162
+ describe '#options' do
163
+ it 'returns all the options' do
164
+ options = browser.select_list(name: 'new_user_country').options
165
+ expect(options.map(&:text)).to eq ['Denmark', 'Norway', 'Sweden', 'United Kingdom', 'USA', 'Germany']
167
166
  end
168
167
  end
169
168
 
170
- describe "#selected_options" do
169
+ describe '#selected_options' do
171
170
  it "should raise UnknownObjectException if the select list doesn't exist" do
172
171
  expect { browser.select_list(name: 'no_such_name').selected_options }.to raise_unknown_object_exception
173
172
  end
174
173
 
175
- it "gets the currently selected item(s)" do
176
- expect(browser.select_list(name: "new_user_country").selected_options.map(&:text)).to eq ["Norway"]
177
- expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["EN", "NO"]
174
+ it 'gets the currently selected item(s)' do
175
+ expect(browser.select_list(name: 'new_user_country').selected_options.map(&:text)).to eq ['Norway']
176
+ expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq %w[EN NO]
178
177
  end
179
178
  end
180
179
 
181
- describe "#clear" do
180
+ describe '#clear' do
182
181
  not_compliant_on :safari do
183
- it "clears the selection when possible" do
184
- browser.select_list(name: "new_user_languages").clear
185
- expect(browser.select_list(name: "new_user_languages").selected_options).to be_empty
182
+ it 'clears the selection when possible' do
183
+ browser.select_list(name: 'new_user_languages').clear
184
+ expect(browser.select_list(name: 'new_user_languages').selected_options).to be_empty
186
185
  end
187
186
  end
188
187
 
189
- it "does not clear selections if the select list does not allow multiple selections" do
188
+ it 'does not clear selections if the select list does not allow multiple selections' do
190
189
  expect {
191
- browser.select_list(name: "new_user_country").clear
190
+ browser.select_list(name: 'new_user_country').clear
192
191
  }.to raise_error(/you can only clear multi-selects/)
193
192
 
194
- expect(browser.select_list(name: "new_user_country").selected_options.map(&:text)).to eq ["Norway"]
193
+ expect(browser.select_list(name: 'new_user_country').selected_options.map(&:text)).to eq ['Norway']
195
194
  end
196
195
 
197
196
  it "raises UnknownObjectException if the select list doesn't exist" do
@@ -199,24 +198,24 @@ describe "SelectList" do
199
198
  end
200
199
 
201
200
  not_compliant_on :safari do
202
- it "fires onchange event" do
203
- browser.select_list(name: "new_user_languages").clear
201
+ it 'fires onchange event' do
202
+ browser.select_list(name: 'new_user_languages').clear
204
203
  expect(messages.size).to eq 2
205
204
  end
206
205
 
207
206
  it "doesn't fire onchange event for already cleared option" do
208
- browser.select_list(name: "new_user_languages").option.clear
207
+ browser.select_list(name: 'new_user_languages').option.clear
209
208
  expect(messages.size).to eq 0
210
209
  end
211
210
  end
212
211
  end
213
212
 
214
- describe "#include?" do
215
- it "returns true if the given option exists by text" do
213
+ describe '#include?' do
214
+ it 'returns true if the given option exists by text' do
216
215
  expect(browser.select_list(name: 'new_user_country')).to include('Denmark')
217
216
  end
218
217
 
219
- it "returns true if the given option exists by label" do
218
+ it 'returns true if the given option exists by label' do
220
219
  expect(browser.select_list(name: 'new_user_country')).to include('Germany')
221
220
  end
222
221
 
@@ -226,326 +225,334 @@ describe "SelectList" do
226
225
  end
227
226
 
228
227
  not_compliant_on :safari do
229
- describe "#selected?" do
230
- it "returns true if the given option is selected by text" do
228
+ describe '#selected?' do
229
+ it 'returns true if the given option is selected by text' do
231
230
  browser.select_list(name: 'new_user_country').select('Denmark')
232
231
  expect(browser.select_list(name: 'new_user_country')).to be_selected('Denmark')
233
232
  end
234
233
 
235
- it "returns false if the given option is not selected by text" do
234
+ it 'returns false if the given option is not selected by text' do
236
235
  expect(browser.select_list(name: 'new_user_country')).to_not be_selected('Sweden')
237
236
  end
238
237
 
239
- it "returns true if the given option is selected by label" do
238
+ it 'returns true if the given option is selected by label' do
240
239
  browser.select_list(name: 'new_user_country').select('Germany')
241
240
  expect(browser.select_list(name: 'new_user_country')).to be_selected('Germany')
242
241
  end
243
242
 
244
- it "returns false if the given option is not selected by label" do
243
+ it 'returns false if the given option is not selected by label' do
245
244
  expect(browser.select_list(name: 'new_user_country')).to_not be_selected('Germany')
246
245
  end
247
246
 
248
247
  it "raises UnknownObjectException if the option doesn't exist" do
249
- expect { browser.select_list(name: 'new_user_country').selected?('missing_option') }.to raise_unknown_object_exception
248
+ expect { browser.select_list(name: 'new_user_country').selected?('missing_option') }
249
+ .to raise_unknown_object_exception
250
250
  end
251
251
  end
252
252
  end
253
253
 
254
- describe "#select" do
255
- context "when finding by value" do
256
- it "selects an option with a String" do
257
- browser.select_list(name: "new_user_languages").clear
258
- browser.select_list(name: "new_user_languages").select("2")
259
- expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq %w[EN]
254
+ describe '#select' do
255
+ context 'when finding by value' do
256
+ it 'selects an option with a String' do
257
+ browser.select_list(name: 'new_user_languages').clear
258
+ browser.select_list(name: 'new_user_languages').select('2')
259
+ expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq %w[EN]
260
260
  end
261
261
 
262
- it "selects an option with a Regexp" do
263
- browser.select_list(name: "new_user_languages").clear
264
- expect { browser.select_list(name: "new_user_languages").select(/1|3/) }.to have_deprecated_select_by
265
- expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq %w[Danish NO]
262
+ it 'selects an option with a Regexp' do
263
+ browser.select_list(name: 'new_user_languages').clear
264
+ expect { browser.select_list(name: 'new_user_languages').select(/1|3/) }.to have_deprecated_select_by
265
+ expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq %w[Danish NO]
266
266
  end
267
267
  end
268
268
 
269
- context "when finding by text" do
270
- it "selects an option with a String" do
271
- browser.select_list(name: "new_user_country").select("Denmark")
272
- expect(browser.select_list(name: "new_user_country").selected_options.map(&:text)).to eq ["Denmark"]
269
+ context 'when finding by text' do
270
+ it 'selects an option with a String' do
271
+ browser.select_list(name: 'new_user_country').select('Denmark')
272
+ expect(browser.select_list(name: 'new_user_country').selected_options.map(&:text)).to eq ['Denmark']
273
273
  end
274
274
 
275
- it "selects an option with a Regexp" do
276
- browser.select_list(name: "new_user_country").select(/Denmark/)
277
- expect(browser.select_list(name: "new_user_country").selected_options.map(&:text)).to eq ["Denmark"]
275
+ it 'selects an option with a Regexp' do
276
+ browser.select_list(name: 'new_user_country').select(/Denmark/)
277
+ expect(browser.select_list(name: 'new_user_country').selected_options.map(&:text)).to eq ['Denmark']
278
278
  end
279
279
  end
280
280
 
281
- context "when finding by label" do
282
- it "selects an option with a String" do
283
- browser.select_list(name: "new_user_languages").clear
284
- browser.select_list(name: "new_user_languages").select("NO")
285
- expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["NO"]
281
+ context 'when finding by label' do
282
+ it 'selects an option with a String' do
283
+ browser.select_list(name: 'new_user_languages').clear
284
+ browser.select_list(name: 'new_user_languages').select('NO')
285
+ expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq ['NO']
286
286
  end
287
287
 
288
- it "selects an option with a Regexp" do
289
- browser.select_list(name: "new_user_languages").clear
290
- browser.select_list(name: "new_user_languages").select(/^N/)
291
- expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["NO"]
288
+ it 'selects an option with a Regexp' do
289
+ browser.select_list(name: 'new_user_languages').clear
290
+ browser.select_list(name: 'new_user_languages').select(/^N/)
291
+ expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq ['NO']
292
292
  end
293
293
  end
294
294
 
295
- it "selects multiple options successiveley" do
296
- browser.select_list(name: "new_user_languages").clear
297
- browser.select_list(name: "new_user_languages").select("Danish")
298
- browser.select_list(name: "new_user_languages").select("Swedish")
299
- expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["Danish", "Swedish"]
295
+ it 'selects multiple options successiveley' do
296
+ browser.select_list(name: 'new_user_languages').clear
297
+ browser.select_list(name: 'new_user_languages').select('Danish')
298
+ browser.select_list(name: 'new_user_languages').select('Swedish')
299
+ expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq %w[Danish Swedish]
300
300
  end
301
301
 
302
- it "selects each item in an Array" do
303
- browser.select_list(name: "new_user_languages").clear
304
- browser.select_list(name: "new_user_languages").select(["Danish", "Swedish"])
305
- expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["Danish", "Swedish"]
302
+ it 'selects each item in an Array' do
303
+ browser.select_list(name: 'new_user_languages').clear
304
+ browser.select_list(name: 'new_user_languages').select(%w[Danish Swedish])
305
+ expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq %w[Danish Swedish]
306
306
  end
307
307
 
308
- it "selects each item in a parameter list" do
309
- browser.select_list(name: "new_user_languages").clear
310
- browser.select_list(name: "new_user_languages").select("Danish", "Swedish")
311
- expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["Danish", "Swedish"]
308
+ it 'selects each item in a parameter list' do
309
+ browser.select_list(name: 'new_user_languages').clear
310
+ browser.select_list(name: 'new_user_languages').select('Danish', 'Swedish')
311
+ expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq %w[Danish Swedish]
312
312
  end
313
313
 
314
- bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1255957", :firefox do
315
- it "selects empty options" do
316
- browser.select_list(id: "delete_user_username").select("")
317
- expect(browser.select_list(id: "delete_user_username").selected_options.map(&:text)).to eq [""]
314
+ bug 'https://bugzilla.mozilla.org/show_bug.cgi?id=1255957', :firefox do
315
+ it 'selects empty options' do
316
+ browser.select_list(id: 'delete_user_username').select('')
317
+ expect(browser.select_list(id: 'delete_user_username').selected_options.map(&:text)).to eq ['']
318
318
  end
319
319
  end
320
320
 
321
- it "returns the value selected" do
322
- expect(browser.select_list(name: "new_user_languages").select("Danish")).to eq "Danish"
321
+ it 'returns the value selected' do
322
+ expect(browser.select_list(name: 'new_user_languages').select('Danish')).to eq 'Danish'
323
323
  end
324
324
 
325
325
  not_compliant_on :safari do
326
- it "fires onchange event when selecting an item" do
327
- browser.select_list(id: "new_user_languages").select("Danish")
326
+ it 'fires onchange event when selecting an item' do
327
+ browser.select_list(id: 'new_user_languages').select('Danish')
328
328
  expect(messages).to eq ['changed language']
329
329
  end
330
330
 
331
331
  it "doesn't fire onchange event when selecting an already selected item" do
332
- browser.select_list(id: "new_user_languages").clear # removes the two pre-selected options
333
- browser.select_list(id: "new_user_languages").select("English")
332
+ browser.select_list(id: 'new_user_languages').clear # removes the two pre-selected options
333
+ browser.select_list(id: 'new_user_languages').select('English')
334
334
  expect(messages.size).to eq 3
335
335
 
336
- browser.select_list(id: "new_user_languages").select("English")
336
+ browser.select_list(id: 'new_user_languages').select('English')
337
337
  expect(messages.size).to eq 3
338
338
  end
339
339
 
340
- it "returns an empty string when selecting an option that disappears when selected" do
340
+ it 'returns an empty string when selecting an option that disappears when selected' do
341
341
  expect(browser.select_list(id: 'obsolete').select('sweden')).to eq ''
342
342
  end
343
343
  end
344
344
 
345
- it "selects options with a single-quoted value" do
345
+ it 'selects options with a single-quoted value' do
346
346
  browser.select_list(id: 'single-quote').select("'foo'")
347
347
  end
348
348
 
349
349
  compliant_on :relaxed_locate do
350
350
  it 'waits to select an option' do
351
- browser.goto WatirSpec.url_for("wait.html")
351
+ browser.goto WatirSpec.url_for('wait.html')
352
352
  browser.a(id: 'add_select').click
353
353
  select_list = browser.select_list(id: 'languages')
354
- Watir.default_timeout = 2
355
- begin
356
- start_time = ::Time.now
357
- expect { select_list.select('No') }.to raise_error Watir::Exception::NoValueFoundException
358
- expect(::Time.now - start_time).to be > 2
359
- ensure
360
- Watir.default_timeout = 30
361
- end
354
+ expect { select_list.select('No') }.to wait_and_raise_no_value_found_exception
362
355
  end
363
356
  end
364
357
 
365
358
  it "raises NoValueFoundException if the option doesn't exist" do
366
- expect { browser.select_list(name: "new_user_country").select("missing_option") }.to raise_no_value_found_exception
367
- expect { browser.select_list(name: "new_user_country").select(/missing_option/) }.to raise_no_value_found_exception
359
+ expect { browser.select_list(name: 'new_user_country').select('missing_option') }
360
+ .to raise_no_value_found_exception
361
+ expect { browser.select_list(name: 'new_user_country').select(/missing_option/) }
362
+ .to raise_no_value_found_exception
368
363
  end
369
364
 
370
- it "raises ObjectDisabledException if the option is disabled" do
371
- expect { browser.select_list(name: "new_user_languages").select("Russian") }.to raise_object_disabled_exception
365
+ it 'raises ObjectDisabledException if the option is disabled' do
366
+ expect { browser.select_list(name: 'new_user_languages').select('Russian') }
367
+ .to raise_object_disabled_exception
372
368
  end
373
369
 
374
- it "raises a TypeError if argument is not a String, Regexp or Numeric" do
375
- expect { browser.select_list(id: "new_user_languages").select({}) }.to raise_error(TypeError)
370
+ it 'raises a TypeError if argument is not a String, Regexp or Numeric' do
371
+ expect { browser.select_list(id: 'new_user_languages').select({}) }.to raise_error(TypeError)
376
372
  end
377
373
  end
378
374
 
379
- describe "#select!" do
380
- context "when finding by value" do
381
- it "selects an option with a String" do
382
- browser.select_list(name: "new_user_languages").clear
383
- browser.select_list(name: "new_user_languages").select!("2")
384
- expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq %w[EN]
375
+ describe '#select!' do
376
+ context 'when finding by value' do
377
+ it 'selects an option with a String' do
378
+ browser.select_list(name: 'new_user_languages').clear
379
+ browser.select_list(name: 'new_user_languages').select!('2')
380
+ expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq %w[EN]
385
381
  end
386
382
 
387
- it "selects an option with a Regex" do
388
- browser.select_list(name: "new_user_languages").clear
389
- browser.select_list(name: "new_user_languages").select!(/2/)
390
- expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq %w[EN]
383
+ it 'selects an option with a Regex' do
384
+ browser.select_list(name: 'new_user_languages').clear
385
+ browser.select_list(name: 'new_user_languages').select!(/2/)
386
+ expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq %w[EN]
391
387
  end
392
388
  end
393
389
 
394
- context "when finding by text" do
395
- it "selects an option with a String" do
396
- browser.select_list(name: "new_user_country").select!("Denmark")
397
- expect(browser.select_list(name: "new_user_country").selected_options.map(&:text)).to eq ["Denmark"]
390
+ context 'when finding by text' do
391
+ it 'selects an option with a String' do
392
+ browser.select_list(name: 'new_user_country').select!('Denmark')
393
+ expect(browser.select_list(name: 'new_user_country').selected_options.map(&:text)).to eq ['Denmark']
398
394
  end
399
395
 
400
- it "selects an option with a Regexp" do
401
- browser.select_list(name: "new_user_country").select!(/Denmark/)
402
- expect(browser.select_list(name: "new_user_country").selected_options.map(&:text)).to eq ["Denmark"]
396
+ it 'selects an option with a Regexp' do
397
+ browser.select_list(name: 'new_user_country').select!(/Denmark/)
398
+ expect(browser.select_list(name: 'new_user_country').selected_options.map(&:text)).to eq ['Denmark']
403
399
  end
404
400
  end
405
401
 
406
- context "when finding by label" do
407
- it "selects an option with a String" do
408
- browser.select_list(name: "new_user_languages").clear
409
- browser.select_list(name: "new_user_languages").select!("NO")
410
- expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["NO"]
402
+ context 'when finding by label' do
403
+ it 'selects an option with a String' do
404
+ browser.select_list(name: 'new_user_languages').clear
405
+ browser.select_list(name: 'new_user_languages').select!('NO')
406
+ expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq ['NO']
411
407
  end
412
408
 
413
- it "selects an option with a Regexp" do
414
- browser.select_list(name: "new_user_languages").clear
415
- browser.select_list(name: "new_user_languages").select!(/NO/)
416
- expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["NO"]
409
+ it 'selects an option with a Regexp' do
410
+ browser.select_list(name: 'new_user_languages').clear
411
+ browser.select_list(name: 'new_user_languages').select!(/NO/)
412
+ expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq ['NO']
417
413
  end
418
414
  end
419
415
 
420
- it "selects multiple items successively" do
421
- browser.select_list(name: "new_user_languages").clear
422
- browser.select_list(name: "new_user_languages").select!("Danish")
423
- browser.select_list(name: "new_user_languages").select!("Swedish")
424
- expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["Danish", "Swedish"]
416
+ it 'selects multiple items successively' do
417
+ browser.select_list(name: 'new_user_languages').clear
418
+ browser.select_list(name: 'new_user_languages').select!('Danish')
419
+ browser.select_list(name: 'new_user_languages').select!('Swedish')
420
+ expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq %w[Danish Swedish]
425
421
  end
426
422
 
427
- it "selects each item in an Array" do
428
- browser.select_list(name: "new_user_languages").clear
429
- browser.select_list(name: "new_user_languages").select!(["Danish", "Swedish"])
430
- expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["Danish", "Swedish"]
423
+ it 'selects each item in an Array' do
424
+ browser.select_list(name: 'new_user_languages').clear
425
+ browser.select_list(name: 'new_user_languages').select!(%w[Danish Swedish])
426
+ expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq %w[Danish Swedish]
431
427
  end
432
428
 
433
- it "selects each item in a parameter list" do
434
- browser.select_list(name: "new_user_languages").clear
435
- browser.select_list(name: "new_user_languages").select!("Danish", "Swedish")
436
- expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["Danish", "Swedish"]
429
+ it 'selects each item in a parameter list' do
430
+ browser.select_list(name: 'new_user_languages').clear
431
+ browser.select_list(name: 'new_user_languages').select!('Danish', 'Swedish')
432
+ expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq %w[Danish Swedish]
437
433
  end
438
434
 
439
- bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1255957", :firefox do
440
- it "selects empty options" do
441
- browser.select_list(id: "delete_user_username").select!("")
442
- expect(browser.select_list(id: "delete_user_username").selected_options.map(&:text)).to eq [""]
435
+ bug 'https://bugzilla.mozilla.org/show_bug.cgi?id=1255957', :firefox do
436
+ it 'selects empty options' do
437
+ browser.select_list(id: 'delete_user_username').select!('')
438
+ expect(browser.select_list(id: 'delete_user_username').selected_options.map(&:text)).to eq ['']
443
439
  end
444
440
  end
445
441
 
446
- it "returns the value selected" do
447
- browser.select_list(name: "new_user_languages").clear
448
- expect(browser.select_list(name: "new_user_languages").select!("Danish")).to eq "Danish"
442
+ it 'returns the value selected' do
443
+ browser.select_list(name: 'new_user_languages').clear
444
+ expect(browser.select_list(name: 'new_user_languages').select!('Danish')).to eq 'Danish'
449
445
  end
450
446
 
451
- it "selects options with a single-quoted value" do
447
+ it 'selects options with a single-quoted value' do
452
448
  browser.select_list(id: 'single-quote').select!("'foo'")
453
449
  end
454
450
 
455
- it "selects exact matches when using String" do
456
- browser.select_list(name: "new_user_languages").clear
457
- browser.select_list(name: "new_user_languages").select!("Latin")
458
- selected_options = browser.select_list(name: "new_user_languages").selected_options.map(&:text)
459
- expect(selected_options).not_to include("Azeri - Latin")
460
- expect(selected_options).to include("Latin")
451
+ it 'selects exact matches when using String' do
452
+ browser.select_list(name: 'new_user_languages').clear
453
+ browser.select_list(name: 'new_user_languages').select!('Latin')
454
+ selected_options = browser.select_list(name: 'new_user_languages').selected_options.map(&:text)
455
+ expect(selected_options).not_to include('Azeri - Latin')
456
+ expect(selected_options).to include('Latin')
461
457
  end
462
458
 
463
459
  it "raises NoValueFoundException if the option doesn't exist" do
464
- expect { browser.select_list(id: "new_user_country").select!("missing_option") }.to raise_no_value_found_exception
465
- expect { browser.select_list(id: "new_user_country").select!(/missing_option/) }.to raise_no_value_found_exception
460
+ expect { browser.select_list(id: 'new_user_country').select!('missing_option') }
461
+ .to raise_no_value_found_exception
462
+ expect { browser.select_list(id: 'new_user_country').select!(/missing_option/) }
463
+ .to raise_no_value_found_exception
466
464
  end
467
465
 
468
- it "raises ObjectDisabledException if the option is disabled" do
469
- browser.select_list(id: "new_user_languages").clear
470
- expect { browser.select_list(id: "new_user_languages").select!("Russian") }.to raise_object_disabled_exception
466
+ it 'raises ObjectDisabledException if the option is disabled' do
467
+ browser.select_list(id: 'new_user_languages').clear
468
+ expect { browser.select_list(id: 'new_user_languages').select!('Russian') }
469
+ .to raise_object_disabled_exception
471
470
  end
472
471
 
473
- it "raises a TypeError if argument is not a String, Regexp or Numeric" do
474
- browser.select_list(id: "new_user_languages").clear
475
- expect { browser.select_list(id: "new_user_languages").select!({}) }.to raise_error(TypeError)
472
+ it 'raises a TypeError if argument is not a String, Regexp or Numeric' do
473
+ browser.select_list(id: 'new_user_languages').clear
474
+ expect { browser.select_list(id: 'new_user_languages').select!({}) }.to raise_error(TypeError)
476
475
  end
477
476
  end
478
477
 
479
- describe "#select_all" do
480
- it "selects multiple options based on text" do
481
- browser.select_list(name: "new_user_languages").clear
482
- browser.select_list(name: "new_user_languages").select_all(/ish/)
483
- expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["Danish", "EN", "Swedish"]
478
+ describe '#select_all' do
479
+ it 'selects multiple options based on text' do
480
+ browser.select_list(name: 'new_user_languages').clear
481
+ browser.select_list(name: 'new_user_languages').select_all(/ish/)
482
+ list = %w[Danish EN Swedish]
483
+ expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq list
484
484
  end
485
485
 
486
- it "selects multiple options based on labels" do
487
- browser.select_list(name: "new_user_languages").clear
488
- browser.select_list(name: "new_user_languages").select_all(/NO|EN/)
489
- expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["EN", "NO"]
486
+ it 'selects multiple options based on labels' do
487
+ browser.select_list(name: 'new_user_languages').clear
488
+ browser.select_list(name: 'new_user_languages').select_all(/NO|EN/)
489
+ list = %w[EN NO]
490
+ expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq list
490
491
  end
491
492
 
492
- it "selects all options in an Array" do
493
- browser.select_list(name: "new_user_languages").clear
494
- browser.select_list(name: "new_user_languages").select_all([/ish/, /Latin/])
495
- expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["Danish", "EN", "Swedish", "Azeri - Latin", "Latin"]
493
+ it 'selects all options in an Array' do
494
+ browser.select_list(name: 'new_user_languages').clear
495
+ browser.select_list(name: 'new_user_languages').select_all([/ish/, /Latin/])
496
+ list = ['Danish', 'EN', 'Swedish', 'Azeri - Latin', 'Latin']
497
+ expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq list
496
498
  end
497
499
 
498
- it "selects all options in a parameter list" do
499
- browser.select_list(name: "new_user_languages").clear
500
- browser.select_list(name: "new_user_languages").select_all(/ish/, /Latin/)
501
- expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["Danish", "EN", "Swedish", "Azeri - Latin", "Latin"]
500
+ it 'selects all options in a parameter list' do
501
+ browser.select_list(name: 'new_user_languages').clear
502
+ browser.select_list(name: 'new_user_languages').select_all(/ish/, /Latin/)
503
+ list = ['Danish', 'EN', 'Swedish', 'Azeri - Latin', 'Latin']
504
+ expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq list
502
505
  end
503
506
 
504
- it "returns the first matching value if there are multiple matches" do
505
- expect(browser.select_list(name: "new_user_languages").select_all(/ish/)).to eq "Danish"
507
+ it 'returns the first matching value if there are multiple matches' do
508
+ expect(browser.select_list(name: 'new_user_languages').select_all(/ish/)).to eq 'Danish'
506
509
  end
507
510
  end
508
511
 
509
- describe "#select_all!" do
510
- it "selects multiple options based on value" do
511
- browser.select_list(name: "new_user_languages").clear
512
- browser.select_list(name: "new_user_languages").select_all!(/\d+/)
513
- expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["Danish", "EN", "NO", "Russian"]
512
+ describe '#select_all!' do
513
+ it 'selects multiple options based on value' do
514
+ browser.select_list(name: 'new_user_languages').clear
515
+ browser.select_list(name: 'new_user_languages').select_all!(/\d+/)
516
+ list = %w[Danish EN NO Russian]
517
+ expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq list
514
518
  end
515
519
 
516
- it "selects multiple options based on text" do
517
- browser.select_list(name: "new_user_languages").clear
518
- browser.select_list(name: "new_user_languages").select_all!(/ish/)
519
- expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["Danish", "EN", "Swedish"]
520
+ it 'selects multiple options based on text' do
521
+ browser.select_list(name: 'new_user_languages').clear
522
+ browser.select_list(name: 'new_user_languages').select_all!(/ish/)
523
+ list = %w[Danish EN Swedish]
524
+ expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq list
520
525
  end
521
526
 
522
- it "selects multiple options based on labels" do
523
- browser.select_list(name: "new_user_languages").clear
524
- browser.select_list(name: "new_user_languages").select_all!(/NO|EN/)
525
- expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["EN", "NO"]
527
+ it 'selects multiple options based on labels' do
528
+ browser.select_list(name: 'new_user_languages').clear
529
+ browser.select_list(name: 'new_user_languages').select_all!(/NO|EN/)
530
+ list = %w[EN NO]
531
+ expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq list
526
532
  end
527
533
 
528
- it "selects all options in an Array" do
529
- browser.select_list(name: "new_user_languages").clear
530
- browser.select_list(name: "new_user_languages").select_all!([/ish/, /Latin/])
531
- expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["Danish", "EN", "Swedish", "Azeri - Latin", "Latin"]
534
+ it 'selects all options in an Array' do
535
+ browser.select_list(name: 'new_user_languages').clear
536
+ browser.select_list(name: 'new_user_languages').select_all!([/ish/, /Latin/])
537
+ list = ['Danish', 'EN', 'Swedish', 'Azeri - Latin', 'Latin']
538
+ expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq list
532
539
  end
533
540
 
534
- it "selects all options in a parameter list" do
535
- browser.select_list(name: "new_user_languages").clear
536
- browser.select_list(name: "new_user_languages").select_all!(/ish/, /Latin/)
537
- expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["Danish", "EN", "Swedish", "Azeri - Latin", "Latin"]
541
+ it 'selects all options in a parameter list' do
542
+ browser.select_list(name: 'new_user_languages').clear
543
+ browser.select_list(name: 'new_user_languages').select_all!(/ish/, /Latin/)
544
+ list = ['Danish', 'EN', 'Swedish', 'Azeri - Latin', 'Latin']
545
+ expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq list
538
546
  end
539
547
 
540
- it "returns the first matching value if there are multiple matches" do
541
- expect(browser.select_list(name: "new_user_languages").select_all!(/ish/)).to eq "Danish"
548
+ it 'returns the first matching value if there are multiple matches' do
549
+ expect(browser.select_list(name: 'new_user_languages').select_all!(/ish/)).to eq 'Danish'
542
550
  end
543
551
  end
544
552
 
545
553
  # deprecate?
546
554
  not_compliant_on :safari do
547
- describe "#select_value" do
555
+ describe '#select_value' do
548
556
  end
549
557
  end
550
-
551
558
  end