operawatir 0.4.3.pre1-jruby → 0.5-jruby
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.
- data/.gitmodules +1 -1
- data/CHANGES +230 -0
- data/Gemfile +4 -0
- data/Rakefile +3 -2
- data/VERSION +1 -1
- data/bin/desktopwatir +1 -1
- data/bin/operawatir +16 -4
- data/lib/operadriver/guava-r09.jar +0 -0
- data/lib/operadriver/operadriver-v0.7.2.jar +0 -0
- data/lib/operadriver/selenium-nodeps-20100909.jar +0 -0
- data/lib/operawatir.rb +10 -3
- data/lib/operawatir/actions.rb +111 -0
- data/lib/operawatir/browser.rb +24 -20
- data/lib/operawatir/clickable_item.rb +68 -0
- data/lib/operawatir/compat.rb +4 -4
- data/lib/operawatir/compat/collection.rb +1 -1
- data/lib/operawatir/compat/element.rb +1 -1
- data/lib/operawatir/compat/window.rb +4 -3
- data/lib/operawatir/desktop_browser.rb +299 -95
- data/lib/operawatir/desktop_common.rb +88 -23
- data/lib/operawatir/desktop_container.rb +103 -34
- data/lib/operawatir/desktop_enums.rb +4 -4
- data/lib/operawatir/desktop_exceptions.rb +2 -2
- data/lib/operawatir/desktop_helper.rb +31 -8
- data/lib/operawatir/element.rb +6 -2
- data/lib/operawatir/exceptions.rb +4 -4
- data/lib/operawatir/helper.rb +6 -6
- data/lib/operawatir/keys.rb +4 -4
- data/lib/operawatir/preferences.rb +126 -155
- data/lib/operawatir/quickwidgets.rb +3 -3
- data/lib/operawatir/quickwidgets/quick_addressfield.rb +12 -5
- data/lib/operawatir/quickwidgets/quick_button.rb +39 -53
- data/lib/operawatir/quickwidgets/quick_checkbox.rb +6 -6
- data/lib/operawatir/quickwidgets/quick_dialogtab.rb +5 -5
- data/lib/operawatir/quickwidgets/quick_dropdown.rb +28 -4
- data/lib/operawatir/quickwidgets/quick_dropdownitem.rb +46 -0
- data/lib/operawatir/quickwidgets/quick_editfield.rb +16 -13
- data/lib/operawatir/quickwidgets/quick_label.rb +1 -1
- data/lib/operawatir/quickwidgets/quick_menu.rb +155 -0
- data/lib/operawatir/quickwidgets/quick_menuitem.rb +387 -0
- data/lib/operawatir/quickwidgets/quick_searchfield.rb +7 -4
- data/lib/operawatir/quickwidgets/quick_tab.rb +23 -12
- data/lib/operawatir/quickwidgets/quick_thumbnail.rb +4 -4
- data/lib/operawatir/quickwidgets/quick_toolbar.rb +1 -1
- data/lib/operawatir/quickwidgets/quick_treeitem.rb +45 -29
- data/lib/operawatir/quickwidgets/quick_treeview.rb +2 -2
- data/lib/operawatir/quickwidgets/quick_widget.rb +267 -77
- data/lib/operawatir/quickwidgets/quick_window.rb +64 -38
- data/lib/operawatir/screenshot.rb +1 -1
- data/lib/operawatir/utils.rb +31 -0
- data/lib/operawatir/window.rb +1 -1
- data/operawatir.gemspec +38 -132
- data/spec/operawatir/core/actions_spec.rb +202 -0
- data/spec/operawatir/core/browser_spec.rb +8 -8
- data/spec/operawatir/core/element_spec.rb +11 -2
- data/spec/operawatir/core/keys_spec.rb +50 -2
- data/spec/operawatir/core/preferences_spec.rb +44 -128
- data/spec/operawatir/core/spatnav_spec.rb +16 -16
- data/spec/operawatir/core/utils_spec.rb +47 -0
- data/spec/operawatir/core/window_spec.rb +1 -1
- data/spec/operawatir/desktop/desktopbrowser_spec.rb +191 -22
- data/spec/operawatir/desktop/quickbutton_spec.rb +197 -164
- data/spec/operawatir/desktop/quickcheckbox_spec.rb +12 -12
- data/spec/operawatir/desktop/quickdialogtab_spec.rb +11 -11
- data/spec/operawatir/desktop/quickdropdown_spec.rb +25 -25
- data/spec/operawatir/desktop/quickeditfield_spec.rb +31 -31
- data/spec/operawatir/desktop/quickmenu_spec.rb +57 -0
- data/spec/operawatir/desktop/quickmenuitem_spec.rb +168 -0
- data/spec/operawatir/desktop/quicktab_spec.rb +26 -15
- data/spec/operawatir/desktop/quickthumbnail_spec.rb +18 -4
- data/spec/operawatir/desktop/quicktreeitem_spec.rb +72 -72
- data/spec/operawatir/desktop/quicktreeview_spec.rb +13 -13
- data/spec/operawatir/desktop/quickwidget_spec.rb +51 -13
- data/spec/operawatir/desktop/quickwindow_spec.rb +4 -0
- data/spec/operawatir/desktop/shared/shared.rb +25 -9
- data/spec/operawatir/fixtures/draggableLists.html +67 -0
- data/spec/operawatir/fixtures/formSelectionPage.html +46 -0
- data/spec/operawatir/fixtures/js/jquery-1.4.4.min.js +167 -0
- data/spec/operawatir/fixtures/js/jquery-ui-1.8.10.custom.min.js +782 -0
- data/spec/operawatir/fixtures/keys.html +40 -0
- data/spec/operawatir/fixtures/label_submit.html +5 -0
- data/spec/operawatir/fixtures/mouse.html +59 -0
- data/spec/operawatir/fixtures/simple.html +10 -0
- data/spec/operawatir/matchers.rb +20 -19
- data/spec/operawatir/watirspec_desktophelper.rb +51 -3
- data/spec/operawatir/watirspec_helper.rb +0 -2
- metadata +91 -220
- data/lib/operadriver/client-combined-nodeps.jar +0 -0
- data/lib/operadriver/webdriver-opera.jar +0 -0
- data/spec/watir3/browser_spec.rb +0 -190
- data/spec/watir3/clipboard_spec.rb +0 -64
- data/spec/watir3/collection_spec.rb +0 -387
- data/spec/watir3/element_spec.rb +0 -474
- data/spec/watir3/guards.rb +0 -39
- data/spec/watir3/keys_spec.rb +0 -204
- data/spec/watir3/server.rb +0 -91
- data/spec/watir3/watirspec_helper.rb +0 -62
- data/spec/watir3/window_spec.rb +0 -295
data/spec/watir3/element_spec.rb
DELETED
@@ -1,474 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.expand_path('../watirspec_helper', __FILE__)
|
3
|
-
|
4
|
-
describe 'Element' do
|
5
|
-
# Direct attribute access
|
6
|
-
before :each do
|
7
|
-
browser.url = fixture('non_control_elements.html')
|
8
|
-
|
9
|
-
@element = window.find_by_id('descartes').first
|
10
|
-
@list = window.find_by_id('navbar').first
|
11
|
-
@leaf = window.find_by_id('link_2').first
|
12
|
-
end
|
13
|
-
|
14
|
-
# parent
|
15
|
-
describe '#parent' do
|
16
|
-
it 'is the parent element of an element' do
|
17
|
-
# Two .parent to get to an IDed element
|
18
|
-
@element.parent.parent.attr(:id).should == 'promo'
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'is nil for the root element' do
|
22
|
-
window.find_by_tag(:html).first.parent.should == nil
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
# attr(what, value=nil)
|
27
|
-
describe '#attr' do
|
28
|
-
it 'gets the value of the given attribute' do
|
29
|
-
@element.attr(:class).should == 'descartes'
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'uses underscores instead of dashes' do
|
33
|
-
@leaf.attr(:data_fixture).should == 'leaf'
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'is nil when the attribute does not exist' do
|
37
|
-
@element.attr(:hoobaflooba).should == nil
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe 'sugar' do
|
42
|
-
it 'provides direct access to the element\'s attributes' do
|
43
|
-
@element.id.should == @element.attr(:id)
|
44
|
-
@element.class_name.should == @element.attr(:class)
|
45
|
-
@element.title.should == @element.attr(:title)
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'uses underscores instead of dashes' do
|
49
|
-
@leaf.data_fixture.should == 'leaf'
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'is nil when the attribute does not exist' do
|
53
|
-
@element.hoobaflooba.should be_nil
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
# text
|
58
|
-
describe '#text' do
|
59
|
-
it 'is the text contained by the element' do
|
60
|
-
@element.text.should == 'Dubito, ergo cogito, ergo sum.'
|
61
|
-
end
|
62
|
-
|
63
|
-
it 'is an empty string when there is no text' do
|
64
|
-
window.find_by_tag(:div).first.text.should == ''
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
describe '#text=' do
|
69
|
-
it 'sets the text content of the element' do
|
70
|
-
window.find_by_tag(:em).first.text = 'test'
|
71
|
-
@element.text.should == 'Dubito, test, ergo sum.'
|
72
|
-
end
|
73
|
-
|
74
|
-
it 'overwrites child elements' do
|
75
|
-
@element.text = 'test'
|
76
|
-
window.find_by_tag(:em).should be_empty
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
# html
|
81
|
-
describe '#html' do
|
82
|
-
it 'is the outer HTML of the element' do
|
83
|
-
@element.html.should == "<strong id='descartes' class='descartes'>Dubito, <em class='important-class' id='important-id' title='ergo cogito'>ergo cogito</em>, ergo sum.</strong>"
|
84
|
-
end
|
85
|
-
|
86
|
-
it 'is an empty string if the element contains no text or html' do
|
87
|
-
window.find_by_tag(:body).div.first.html.should == ''
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
describe '#html=' do
|
92
|
-
it 'sets the outer HTML of the element' do
|
93
|
-
@element.em.first.html = '<b>test</b>'
|
94
|
-
@element.html.should == "<strong id='descartes' class='descartes'>Dubito, <b>test</b>, ergo sum.</strong>"
|
95
|
-
end
|
96
|
-
|
97
|
-
it 'creates child elements' do
|
98
|
-
@element.em.first.html = "<b>one</b> <b class='test'>two</b>"
|
99
|
-
@element.em.length.should == 2
|
100
|
-
@element.em[1].attr(:class).should == 'test'
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
# tag_name
|
105
|
-
describe '#tag_name' do
|
106
|
-
it 'is the tag name of an element' do
|
107
|
-
@element.tag_name.should match /strong/i
|
108
|
-
@list.tag_name.should match /ul/i
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
# states
|
113
|
-
# ------
|
114
|
-
|
115
|
-
# checked?
|
116
|
-
describe '#checked?' do
|
117
|
-
before :each do
|
118
|
-
browser.url = fixture('forms_with_input_elements.html')
|
119
|
-
|
120
|
-
@textbox = window.find_by_id('new_user_username').first
|
121
|
-
@checkbox_checked = window.find_by_id('new_user_interests_books').first
|
122
|
-
@checkbox_unchecked = window.find_by_id('new_user_interests_cars').first
|
123
|
-
@radio_checked = window.find_by_id('new_user_newsletter_yes').first
|
124
|
-
@radio_unchecked = window.find_by_id('new_user_newsletter_no').first
|
125
|
-
end
|
126
|
-
|
127
|
-
# TODO 'checked' is available for all <input> and <command>. Change this
|
128
|
-
# test?
|
129
|
-
it 'exists on radio button elements' do
|
130
|
-
@radio_checked.should respond_to :checked?
|
131
|
-
end
|
132
|
-
|
133
|
-
it 'exists on checkbox elements' do
|
134
|
-
@checkbox_checked.should respond_to :checked?
|
135
|
-
end
|
136
|
-
|
137
|
-
it 'does not exist on non-checkbox or radio button elements' do
|
138
|
-
@textbox.should_not respond_to :checked?
|
139
|
-
@element.should_not respond_to :checked?
|
140
|
-
end
|
141
|
-
|
142
|
-
it 'is true if a checkbox is checked' do
|
143
|
-
@checkbox_checked.checked?.should be_true
|
144
|
-
end
|
145
|
-
|
146
|
-
it 'is false if a checkbox is not checked' do
|
147
|
-
@checkbox_unchecked.checked?.should be_false
|
148
|
-
end
|
149
|
-
|
150
|
-
it 'is true if a radio button is checked' do
|
151
|
-
@radio_checked.checked?.should be_true
|
152
|
-
end
|
153
|
-
|
154
|
-
it 'is false if a radio button is not checked' do
|
155
|
-
@radio_unchecked.checked?.should be_false
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
describe '#selected?' do
|
160
|
-
before :each do
|
161
|
-
browser.url = fixture('forms_with_input_elements.html')
|
162
|
-
@options = window.find_by_id('new_user_country').option
|
163
|
-
end
|
164
|
-
|
165
|
-
it 'is true if an option is selected' do
|
166
|
-
@options[1].selected?.should be_true
|
167
|
-
end
|
168
|
-
|
169
|
-
it 'is false is an option is not selected' do
|
170
|
-
@options[5].selected?.should be_false
|
171
|
-
end
|
172
|
-
|
173
|
-
it 'is true for multiple selected options' do
|
174
|
-
multi = window.find_by_id('new_user_languages').option
|
175
|
-
multi[1].selected?.should be_true
|
176
|
-
multi[2].selected?.should be_true
|
177
|
-
end
|
178
|
-
|
179
|
-
it 'is false for unselected in a multiple select' do
|
180
|
-
multi = window.find_by_id('new_user_languages').option
|
181
|
-
multi[0].selected?.should be_false
|
182
|
-
multi[3].selected?.should be_false
|
183
|
-
end
|
184
|
-
|
185
|
-
it 'is nil on non-option elements' do
|
186
|
-
@element.selected?.should be_nil
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
# enabled?
|
191
|
-
describe '#enabled?' do
|
192
|
-
before :each do
|
193
|
-
browser.url = fixture('forms_with_input_elements.html')
|
194
|
-
@inputs = window.find_by_tag(:input)
|
195
|
-
end
|
196
|
-
|
197
|
-
# 'disabled' attribute is available on quite a few obscure
|
198
|
-
# elements. Toss up between limiting to common ones, all html5,
|
199
|
-
# all elements that have a .disabled property in Javascript, or
|
200
|
-
# all elements
|
201
|
-
it 'exists on input elements' do
|
202
|
-
@inputs.all? do |input|
|
203
|
-
input.respond_to? :enabled?
|
204
|
-
end.should be_true
|
205
|
-
end
|
206
|
-
end
|
207
|
-
|
208
|
-
# visible?
|
209
|
-
describe '#visible?' do
|
210
|
-
before :each do
|
211
|
-
browser.url = fixture('visible.html')
|
212
|
-
end
|
213
|
-
|
214
|
-
it 'is true for a visible element' do
|
215
|
-
window.find_by_tag(:h1).first.visible?.should be_true
|
216
|
-
end
|
217
|
-
|
218
|
-
it 'is false for an element with style attribute “display:none”' do
|
219
|
-
window.find_by_id('parent').first.visible?.should be_false
|
220
|
-
end
|
221
|
-
|
222
|
-
it 'is false a child of an element with style attribute “display:none”' do
|
223
|
-
window.find_by_id('child').first.visible?.should be_false
|
224
|
-
end
|
225
|
-
|
226
|
-
it 'is false for an element hidden by CSS' do
|
227
|
-
window.find_by_id('hidden_by_css').first.visible?.should be_false
|
228
|
-
end
|
229
|
-
|
230
|
-
it 'is true for an element with visibility:hidden' do
|
231
|
-
window.find_by_id('invisible').first.visible?.should be_true
|
232
|
-
end
|
233
|
-
|
234
|
-
end
|
235
|
-
|
236
|
-
# actions
|
237
|
-
# -------
|
238
|
-
|
239
|
-
# focus!
|
240
|
-
describe '#focus!' do
|
241
|
-
before :each do
|
242
|
-
browser.url = fixture('forms_with_input_elements.html')
|
243
|
-
end
|
244
|
-
|
245
|
-
it 'focuses the element' do
|
246
|
-
input = window.find_by_id('new_user_email').first
|
247
|
-
input.focus!
|
248
|
-
window.type('test')
|
249
|
-
input.attr(:value).should == 'test'
|
250
|
-
end
|
251
|
-
|
252
|
-
it 'returns false if the element is disabled' do
|
253
|
-
input = window.find_by_id('new_user_species').first
|
254
|
-
input.focus!.should be_false
|
255
|
-
end
|
256
|
-
end
|
257
|
-
|
258
|
-
# click([x, y]) , x,y relative to element top left
|
259
|
-
describe '#click' do
|
260
|
-
it 'follows links' do
|
261
|
-
window.find_by_id('link_3').first.click
|
262
|
-
window.url.should match /forms_with_input_elements\.html$/
|
263
|
-
end
|
264
|
-
|
265
|
-
it 'triggers onclick handlers' do
|
266
|
-
div = window.find_by_id('best_language').first
|
267
|
-
div.click
|
268
|
-
div.text.should == 'Ruby!'
|
269
|
-
end
|
270
|
-
|
271
|
-
it 'toggles checkboxes' do
|
272
|
-
browser.url = fixture('forms_with_input_elements.html')
|
273
|
-
checkbox = window.find_by_id('new_user_interests_cars').first
|
274
|
-
checkbox.checked?.should be_false
|
275
|
-
checkbox.click
|
276
|
-
checkbox.checked?.should be_true
|
277
|
-
checkbox.click
|
278
|
-
checkbox.checked?.should be_false
|
279
|
-
end
|
280
|
-
|
281
|
-
# TODO work out whether #selected? exists, and whether it replaces
|
282
|
-
# #checked?
|
283
|
-
it 'can click option elements' do
|
284
|
-
browser.url = fixture('forms_with_input_elements.html')
|
285
|
-
|
286
|
-
select = window.find_by_id('new_user_country')
|
287
|
-
select.click
|
288
|
-
select.option[0].click
|
289
|
-
select.option[0].selected?.should be_true
|
290
|
-
end
|
291
|
-
end
|
292
|
-
|
293
|
-
describe '#mouse_down!' do
|
294
|
-
it 'triggers a mousedown event' do
|
295
|
-
browser.url = fixture('mouse.html')
|
296
|
-
log = window.find_by_id('log').first
|
297
|
-
log.mouse_down! 0, 0
|
298
|
-
log.text.should include 'down'
|
299
|
-
log.mouse_up! 0, 0
|
300
|
-
end
|
301
|
-
end
|
302
|
-
|
303
|
-
describe '#mouse_up' do
|
304
|
-
it 'triggers a mouseup event' do
|
305
|
-
browser.url = fixture('mouse.html')
|
306
|
-
log = window.find_by_id('log').first
|
307
|
-
log.mouse_down! 0, 0
|
308
|
-
log.mouse_up! 0, 0
|
309
|
-
log.text.should include 'up'
|
310
|
-
end
|
311
|
-
end
|
312
|
-
|
313
|
-
describe '#mouse_move' do
|
314
|
-
it 'triggers a mousemove event' do
|
315
|
-
browser.url = fixture('mouse.html')
|
316
|
-
log = window.find_by_id('log').first
|
317
|
-
log.mouse_move! 0, 0
|
318
|
-
log.text.should include 'move'
|
319
|
-
end
|
320
|
-
|
321
|
-
it 'moves the mouse' do
|
322
|
-
browser.url = fixture('mouse.html')
|
323
|
-
log = window.find_by_id('log').first
|
324
|
-
h1 = window.find_by_tag('h1').first
|
325
|
-
|
326
|
-
h1.mouse_down! 0, 0
|
327
|
-
h1.mouse_move! 25, 25
|
328
|
-
h1.mouse_up! 50, 50
|
329
|
-
|
330
|
-
window.eval_js('!!document.getSelection()').should be_true
|
331
|
-
end
|
332
|
-
end
|
333
|
-
|
334
|
-
# check!
|
335
|
-
describe '#check!' do
|
336
|
-
before :each do
|
337
|
-
browser.url = fixture('forms_with_input_elements.html')
|
338
|
-
@checkbox_unchecked = window.find_by_id('new_user_interests_cars').first
|
339
|
-
@radio_unchecked = window.find_by_id('new_user_newsletter_no').first
|
340
|
-
end
|
341
|
-
|
342
|
-
it 'checks a checkbox' do
|
343
|
-
@checkbox_unchecked.check!
|
344
|
-
@checkbox_unchecked.checked?.should be_true
|
345
|
-
end
|
346
|
-
|
347
|
-
it 'checks a radio button' do
|
348
|
-
@radio_unchecked.check!
|
349
|
-
@radio_unchecked.checked?.should be_true
|
350
|
-
end
|
351
|
-
end
|
352
|
-
# uncheck!
|
353
|
-
describe '#uncheck!' do
|
354
|
-
before :each do
|
355
|
-
browser.url = fixture('forms_with_input_elements.html')
|
356
|
-
@checkbox_checked = window.find_by_id('new_user_interests_books').first
|
357
|
-
@radio_checked = window.find_by_id('new_user_newsletter_yes').first
|
358
|
-
end
|
359
|
-
|
360
|
-
it 'unchecks a checkbox' do
|
361
|
-
@checkbox_checked.uncheck!
|
362
|
-
@checkbox_checked.checked?.should be_false
|
363
|
-
end
|
364
|
-
|
365
|
-
it 'cannot uncheck a radio button' do
|
366
|
-
@radio_checked.uncheck!.should raise_error
|
367
|
-
end
|
368
|
-
end
|
369
|
-
|
370
|
-
# toggle_check!
|
371
|
-
describe '#toggle_check!' do
|
372
|
-
before :each do
|
373
|
-
browser.url = fixture('forms_with_input_elements.html')
|
374
|
-
@checkbox_checked = window.find_by_id('new_user_interests_books').first
|
375
|
-
@radio_checked = window.find_by_id('new_user_newsletter_yes').first
|
376
|
-
end
|
377
|
-
|
378
|
-
it 'toggles a checkbox' do
|
379
|
-
@checkbox_checked.toggle_check!
|
380
|
-
@checkbox_checked.checked?.should be_false
|
381
|
-
@checkbox_checked.toggle_check!
|
382
|
-
@checkbox_checked.checked?.should be_true
|
383
|
-
end
|
384
|
-
|
385
|
-
it 'does not appear on a radio button' do
|
386
|
-
@radio_checked.should_not respond_to :toggle_check!
|
387
|
-
end
|
388
|
-
end
|
389
|
-
|
390
|
-
# enable!
|
391
|
-
describe '#enable!' do
|
392
|
-
it 'enables a form element' do
|
393
|
-
window.url = fixture('forms_with_input_elements.html')
|
394
|
-
disabled = window.find_by_id('new_user_species').first
|
395
|
-
disabled.enabled?.should be_false
|
396
|
-
disabled.enable!
|
397
|
-
disabled.enabled?.should be_true
|
398
|
-
end
|
399
|
-
end
|
400
|
-
# disable!
|
401
|
-
describe '#disable!' do
|
402
|
-
it 'disables a form element' do
|
403
|
-
window.url = fixture('forms_with_input_elements.html')
|
404
|
-
disabled = window.find_by_id('new_user_email').first
|
405
|
-
disabled.enabled?.should be_true
|
406
|
-
disabled.disable!
|
407
|
-
disabled.enabled?.should be_false
|
408
|
-
end
|
409
|
-
end
|
410
|
-
|
411
|
-
# show!
|
412
|
-
describe '#show!' do
|
413
|
-
it 'makes the element visible' do
|
414
|
-
hidden = window.find_by_id('hidden').first
|
415
|
-
hidden.visible?.should be_false
|
416
|
-
hidden.show!
|
417
|
-
hidden.visible?.should be_true
|
418
|
-
end
|
419
|
-
end
|
420
|
-
|
421
|
-
# hide!
|
422
|
-
describe '#hide!' do
|
423
|
-
it 'sets the element to display:none' do
|
424
|
-
@element.visible?.should be_true
|
425
|
-
hidden.hide!
|
426
|
-
hidden.visible?.should be_false
|
427
|
-
end
|
428
|
-
end
|
429
|
-
|
430
|
-
describe '#fire_event' do
|
431
|
-
it 'fires the given event on the element' do
|
432
|
-
window.find_by_id('link_3').fire_event :click
|
433
|
-
browser.url.should include 'forms_with_input_elements.html'
|
434
|
-
end
|
435
|
-
|
436
|
-
it 'fires event handlers' do
|
437
|
-
window.find_by_id('html_test').first.fire_event :dblclick
|
438
|
-
window.find_by_id('messages').first.text.should include 'double clicked'
|
439
|
-
end
|
440
|
-
end
|
441
|
-
|
442
|
-
# attributes
|
443
|
-
# ----------
|
444
|
-
|
445
|
-
# style
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
# drag and drop
|
450
|
-
# -------------
|
451
|
-
|
452
|
-
describe '#drag_and_drop_by' do
|
453
|
-
it 'drags an element 100 pixels right and down' do
|
454
|
-
browser.url = fixture('draggable.html')
|
455
|
-
@draggable = window.find_by_id('draggable')
|
456
|
-
|
457
|
-
@draggable.location.to_s.should == 'x100y100'
|
458
|
-
@draggable.drag_and_drop_by(100,100)
|
459
|
-
@draggable.location.to_s.should == 'x200y200'
|
460
|
-
end
|
461
|
-
end
|
462
|
-
|
463
|
-
describe '#drag_and_drop_on' do
|
464
|
-
it 'drags one element onto another, triggering the correct events' do
|
465
|
-
browser.url = fixture('draggable.html')
|
466
|
-
@draggable = window.find_by_id('draggable')
|
467
|
-
@droppable = window.find_by_id('droppable')
|
468
|
-
|
469
|
-
@draggable.drag_and_drop_on(@droppable)
|
470
|
-
@droppable.text.should include 'Om nom nom!'
|
471
|
-
end
|
472
|
-
end
|
473
|
-
|
474
|
-
end
|