jarib-celerity 0.0.5.5 → 0.0.5.6

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.
@@ -1,5 +1,6 @@
1
1
  module Celerity
2
-
2
+
3
+ #
3
4
  # This class contains methods for accessing elements inside a container,
4
5
  # usually the Browser object, meaning the current page.
5
6
  # The most common syntax is
@@ -22,21 +23,24 @@ module Celerity
22
23
  #
23
24
  # browser.check_box(:name, 'a_name', '1234').set
24
25
  #
25
- # You can also get all the elements of a certain type by using the plural form (@see Celerity::ElementCollections):
26
+ # You can also get all the elements of a certain type by using the plural form (@see Celerity::ElementCollection):
26
27
  #
27
28
  # browser.links # => #<Celerity::Links:0x7a1c2da2 ...>
28
29
  #
30
+
29
31
  module Container
30
32
  include Celerity::Exception
31
33
 
32
34
  # Points back to the Browser instance that contains this element
33
35
  attr_reader :browser
34
36
 
35
-
37
+ #
36
38
  # Check if the element contains the given text.
37
39
  #
38
40
  # @param [String, Regexp] expected_text The text to look for.
39
41
  # @return [Fixnum, nil] The index of the matched text, or nil if it doesn't match.
42
+ #
43
+
40
44
  def contains_text(expected_text)
41
45
  assert_exists
42
46
  return nil unless respond_to? :text
@@ -50,66 +54,94 @@ module Celerity
50
54
  raise TypeError, "expected String or Regexp, got #{expected_text.inspect}:#{expected_text.class}"
51
55
  end
52
56
  end
53
-
57
+
58
+ #
54
59
  # Used internally to update the container object.
55
60
  # @api private
61
+ #
62
+
56
63
  def container=(container)
57
64
  @container = container
58
65
  @browser = container.browser
59
66
  container
60
67
  end
61
68
 
69
+ #
62
70
  # Used internally to update the page object.
63
71
  # @api private
72
+ #
73
+
64
74
  def update_page(page)
65
75
  @browser.page = page
66
76
  end
67
77
 
78
+ #
68
79
  # Used internally.
69
80
  #
70
81
  # @param [String] string The string to match against.
71
82
  # @param [Regexp, String, #to_s] what The match we're looking for.
72
- # @return [MatchData, true, false, nil]
83
+ # @return [Fixnum, true, false, nil]
73
84
  #
74
85
  # @api private
86
+ #
87
+
75
88
  def matches?(string, what)
76
89
  Regexp === what ? string =~ what : string == what.to_s
77
90
  end
78
91
 
79
- #
92
+ #--
80
93
  # below methods sorted alphabetically
81
- #
94
+ #++
82
95
 
96
+ #
83
97
  # @return [Celerity::Area]
98
+ #
99
+
84
100
  def area(*args)
85
101
  Area.new(self, *args)
86
102
  end
87
-
103
+
104
+ #
88
105
  # @return [Celerity::Areas]
106
+ #
107
+
89
108
  def areas
90
109
  Areas.new(self)
91
110
  end
92
111
 
112
+ #
93
113
  # @return [Celerity::Button]
114
+ #
115
+
94
116
  def button(*args)
95
117
  Button.new(self, *args)
96
118
  end
97
119
 
120
+ #
98
121
  # @return [Celerity::Buttons]
122
+ #
123
+
99
124
  def buttons
100
125
  Buttons.new(self)
101
126
  end
102
-
127
+
128
+ #
103
129
  # @return [Celerity::TableCell]
130
+ #
131
+
104
132
  def cell(*args)
105
133
  TableCell.new(self, *args)
106
134
  end
107
-
135
+
136
+ #
108
137
  # @return [Celerity::TableCells]
138
+ #
139
+
109
140
  def cells
110
141
  TableCells.new(self)
111
142
  end
112
143
 
144
+ #
113
145
  # Since finding checkboxes by value is very common, you can use this shorthand:
114
146
  #
115
147
  # browser.check_box(:name, 'a_name', '1234').set
@@ -119,248 +151,397 @@ module Celerity
119
151
  # browser.check_box(:name => 'a_name', :value => '1234').set
120
152
  #
121
153
  # @return [Celerity::CheckBox]
154
+ #
155
+
122
156
  def check_box(*args)
123
157
  CheckBox.new(self, *args)
124
158
  end
125
159
 
160
+ #
126
161
  # @return [Celerity::CheckBoxes]
162
+ #
163
+
127
164
  def checkboxes
128
165
  CheckBoxes.new(self)
129
166
  end
130
167
 
168
+ #
131
169
  # @return [Celerity::Dd]
170
+ #
171
+
132
172
  def dd(*args)
133
173
  Dd.new(self, *args)
134
174
  end
135
-
175
+
176
+ #
136
177
  # @return [Celerity::Dds]
178
+ #
179
+
137
180
  def dds
138
181
  Dds.new(self)
139
182
  end
140
-
183
+
184
+ #
141
185
  # @return [Celerity::Div]
186
+ #
187
+
142
188
  def div(*args)
143
189
  Div.new(self, *args)
144
190
  end
145
-
191
+
192
+ #
146
193
  # @return [Celerity::Divs]
194
+ #
195
+
147
196
  def divs
148
197
  Divs.new(self)
149
198
  end
150
-
199
+
200
+ #
151
201
  # @return [Celerity::Dl]
202
+ #
203
+
152
204
  def dl(*args)
153
205
  Dl.new(self, *args)
154
206
  end
155
207
 
208
+ #
156
209
  # @return [Celerity::Dls]
210
+ #
211
+
157
212
  def dls
158
213
  Dls.new(self)
159
214
  end
160
-
215
+
216
+ #
161
217
  # @return [Celerity::Dt]
218
+ #
219
+
162
220
  def dt(*args)
163
221
  Dt.new(self, *args)
164
222
  end
165
223
 
224
+ #
166
225
  # @return [Celerity::Dts]
226
+ #
227
+
167
228
  def dts
168
229
  Dts.new(self)
169
230
  end
170
231
 
232
+ #
171
233
  # @return [Celerity::FileField]
234
+ #
235
+
172
236
  def file_field(*args)
173
237
  FileField.new(self, *args)
174
238
  end
175
239
 
240
+ #
176
241
  # @return [Celerity::FileFields]
242
+ #
243
+
177
244
  def file_fields
178
245
  FileFields.new(self)
179
246
  end
180
247
 
248
+ #
181
249
  # @return [Celerity::Form]
250
+ #
251
+
182
252
  def form(*args)
183
253
  Form.new(self, *args)
184
254
  end
185
255
 
256
+ #
186
257
  # @return [Celerity::Forms]
258
+ #
259
+
187
260
  def forms
188
261
  Forms.new(self)
189
262
  end
190
263
 
264
+ #
191
265
  # @return [Celerity::Frame]
266
+ #
267
+
192
268
  def frame(*args)
193
269
  Frame.new(self, *args)
194
270
  end
195
-
271
+
272
+ #
196
273
  # @return [Celerity::Frames]
274
+ #
275
+
197
276
  def frames
198
277
  Frames.new(self)
199
278
  end
200
279
 
280
+ #
201
281
  # @return [Celerity::H1]
282
+ #
283
+
202
284
  def h1(*args)
203
285
  H1.new(self, *args)
204
286
  end
205
-
287
+
288
+ #
206
289
  # @return [Celerity::H1s]
290
+ #
291
+
207
292
  def h1s
208
293
  H1s.new(self)
209
294
  end
210
295
 
296
+ #
211
297
  # @return [Celerity::H2]
298
+ #
299
+
212
300
  def h2(*args)
213
301
  H2.new(self, *args)
214
302
  end
215
303
 
304
+ #
216
305
  # @return [Celerity::H2s]
306
+ #
307
+
217
308
  def h2s
218
309
  H2s.new(self)
219
310
  end
220
311
 
312
+ #
221
313
  # @return [Celerity::H3]
314
+ #
315
+
222
316
  def h3(*args)
223
317
  H3.new(self, *args)
224
318
  end
225
319
 
320
+ #
226
321
  # @return [Celerity::H3s]
322
+ #
323
+
227
324
  def h3s
228
325
  H3s.new(self)
229
326
  end
230
327
 
328
+ #
231
329
  # @return [Celerity::H4]
330
+ #
331
+
232
332
  def h4(*args)
233
333
  H4.new(self, *args)
234
334
  end
235
335
 
336
+ #
236
337
  # @return [Celerity::H4s]
338
+ #
339
+
237
340
  def h4s
238
341
  H4s.new(self)
239
342
  end
240
343
 
344
+ #
241
345
  # @return [Celerity::H5]
346
+ #
347
+
242
348
  def h5(*args)
243
349
  H5.new(self, *args)
244
350
  end
245
351
 
352
+ #
246
353
  # @return [Celerity::H5s]
354
+ #
355
+
247
356
  def h5s
248
357
  H5s.new(self)
249
358
  end
250
359
 
360
+ #
251
361
  # @return [Celerity::H6]
362
+ #
363
+
252
364
  def h6(*args)
253
365
  H6.new(self, *args)
254
366
  end
255
367
 
368
+ #
256
369
  # @return [Celerity::H6s]
370
+ #
371
+
257
372
  def h6s
258
373
  H6s.new(self)
259
374
  end
260
375
 
376
+ #
261
377
  # @return [Celerity::Hidden]
378
+ #
379
+
262
380
  def hidden(*args)
263
381
  Hidden.new(self, *args)
264
382
  end
265
383
 
384
+ #
266
385
  # @return [Celerity::Hiddens]
386
+ #
387
+
267
388
  def hiddens
268
389
  Hiddens.new(self)
269
390
  end
270
391
 
392
+ #
271
393
  # @return [Celerity::Image]
394
+ #
395
+
272
396
  def image(*args)
273
397
  Image.new(self, *args)
274
398
  end
275
399
 
400
+ #
276
401
  # @return [Celerity::Images]
402
+ #
403
+
277
404
  def images
278
405
  Images.new(self)
279
406
  end
280
407
 
408
+ #
281
409
  # @return [Celerity::Label]
410
+ #
411
+
282
412
  def label(*args)
283
413
  Label.new(self, *args)
284
414
  end
285
415
 
416
+ #
286
417
  # @return [Celerity::Labels]
418
+ #
419
+
287
420
  def labels
288
421
  Labels.new(self)
289
422
  end
290
423
 
424
+ #
291
425
  # @return [Celerity::Li]
426
+ #
427
+
292
428
  def li(*args)
293
429
  Li.new(self, *args)
294
430
  end
295
431
 
432
+ #
296
433
  # @return [Celerity::Lis]
434
+ #
435
+
297
436
  def lis
298
437
  Lis.new(self)
299
438
  end
300
439
 
440
+ #
301
441
  # @return [Celerity::Link]
442
+ #
443
+
302
444
  def link(*args)
303
445
  Link.new(self, *args)
304
446
  end
305
447
 
448
+ #
306
449
  # @return [Celerity::Links]
450
+ #
451
+
307
452
  def links
308
453
  Links.new(self)
309
454
  end
310
455
 
456
+ #
311
457
  # @return [Celerity::Map]
458
+ #
459
+
312
460
  def map(*args)
313
461
  Map.new(self, *args)
314
462
  end
315
463
 
464
+ #
316
465
  # @return [Celerity::Maps]
466
+ #
467
+
317
468
  def maps
318
469
  Maps.new(self)
319
470
  end
320
471
 
472
+ #
473
+ # @return [Celerity::Meta]
474
+ #
475
+
321
476
  def meta(*args)
322
477
  Meta.new(self, *args)
323
478
  end
324
479
 
480
+ #
481
+ # @return [Celerity::Metas]
482
+ #
483
+
325
484
  def metas(*args)
326
485
  Metas.new(self, *args)
327
486
  end
328
487
 
488
+ #
329
489
  # @return [Celerity::Ol]
490
+ #
491
+
330
492
  def ol(*args)
331
493
  Ol.new(self, *args)
332
494
  end
333
495
 
496
+ #
334
497
  # @return [Celerity::Ols]
498
+ #
499
+
335
500
  def ols
336
501
  Ols.new(self)
337
502
  end
338
503
 
504
+ #
339
505
  # @return [Celerity::Option]
506
+ #
507
+
340
508
  def option(*args)
341
509
  Option.new(self, *args)
342
510
  end
343
511
 
512
+ #
344
513
  # @return [Celerity::P]
514
+ #
515
+
345
516
  def p(*args)
346
517
  P.new(self, *args)
347
518
  end
348
519
 
520
+ #
349
521
  # @return [Celerity::Ps]
522
+ #
523
+
350
524
  def ps
351
525
  Ps.new(self)
352
526
  end
353
527
 
528
+ #
354
529
  # @return [Celerity::Pre]
530
+ #
531
+
355
532
  def pre(*args)
356
533
  Pre.new(self, *args)
357
534
  end
358
535
 
536
+ #
359
537
  # @return [Celerity::Pres]
538
+ #
539
+
360
540
  def pres
361
541
  Pres.new(self)
362
542
  end
363
-
543
+
544
+ #
364
545
  # Since finding radios by value is very common, you can use this shorthand:
365
546
  #
366
547
  # browser.radio(:name, 'a_name', '1234').set
@@ -370,126 +551,197 @@ module Celerity
370
551
  # browser.radio(:name => 'a_name', :value => '1234').set
371
552
  #
372
553
  # @return [Celerity::Radio]
554
+ #
555
+
373
556
  def radio(*args)
374
557
  Radio.new(self, *args)
375
558
  end
376
559
 
560
+ #
377
561
  # @return [Celerity::Radios]
562
+ #
563
+
378
564
  def radios
379
565
  Radios.new(self)
380
566
  end
381
567
 
568
+ #
382
569
  # @return [Celerity::TableRow]
570
+ #
571
+
383
572
  def row(*args)
384
573
  TableRow.new(self, *args)
385
574
  end
386
575
 
576
+ #
387
577
  # @return [Celerity::TableRows]
578
+ #
579
+
388
580
  def rows
389
581
  TableRows.new(self)
390
582
  end
391
583
 
584
+ #
392
585
  # @return [Celerity::SelectList]
586
+ #
587
+
393
588
  def select_list(*args)
394
589
  SelectList.new(self, *args)
395
590
  end
396
591
 
592
+ #
397
593
  # @return [Celerity::SelectLists]
594
+ #
595
+
398
596
  def select_lists
399
597
  SelectLists.new(self)
400
598
  end
401
599
 
600
+ #
402
601
  # @return [Celerity::Span]
602
+ #
603
+
403
604
  def span(*args)
404
605
  Span.new(self, *args)
405
606
  end
406
607
 
608
+ #
407
609
  # @return [Celerity::Spans]
610
+ #
611
+
408
612
  def spans
409
613
  Spans.new(self)
410
614
  end
411
615
 
616
+ #
412
617
  # @return [Celerity::Spans]
618
+ #
619
+
413
620
  def strong(*args)
414
621
  Strong.new(self, *args)
415
622
  end
416
623
 
624
+ #
417
625
  # @return [Celerity::Strongs]
626
+ #
627
+
418
628
  def strongs
419
629
  Strongs.new(self)
420
630
  end
421
631
 
632
+ #
422
633
  # @return [Celerity::Table]
634
+ #
635
+
423
636
  def table(*args)
424
637
  Table.new(self, *args)
425
638
  end
426
639
 
640
+ #
427
641
  # @return [Celerity::Tables]
642
+ #
643
+
428
644
  def tables
429
645
  Tables.new(self)
430
646
  end
431
647
 
648
+ #
432
649
  # @return [Celerity::TableBody]
650
+ #
651
+
433
652
  def tbody(*args)
434
653
  TableBody.new(self, *args)
435
654
  end
436
655
 
656
+ #
437
657
  # @return [Celerity::TableBodies]
658
+ #
659
+
438
660
  def tbodies
439
661
  TableBodies.new(self)
440
662
  end
441
663
 
664
+ #
442
665
  # @return [Celerity::TextField]
666
+ #
667
+
443
668
  def text_field(*args)
444
669
  TextField.new(self, *args)
445
670
  end
446
671
 
672
+ #
447
673
  # @return [Celerity::TextFields]
674
+ #
675
+
448
676
  def text_fields
449
677
  TextFields.new(self)
450
678
  end
451
679
 
680
+ #
452
681
  # @return [Celerity::TableFooter]
682
+ #
683
+
453
684
  def tfoot(*args)
454
685
  TableFooter.new(self, *args)
455
686
  end
456
687
 
688
+ #
457
689
  # @return [Celerity::TableFooters]
690
+ #
691
+
458
692
  def tfoots
459
693
  TableFooters.new(self)
460
694
  end
461
695
  alias_method :tfeet, :tfoots # :-)
462
696
 
463
- # Watir's cells() won't return <th> elements.
697
+ #
698
+ # Watir's cells() won't find <th> elements.
464
699
  # This is a workaround.
465
700
  #
466
701
  # @return [Celerity::Th]
702
+ #
703
+
467
704
  def th(*args)
468
705
  Th.new(self, *args)
469
706
  end
470
707
 
471
- # TODO: implement or change api,
708
+ #
709
+ # FIXME: implement or change api,
472
710
  # @see th
711
+ #
712
+
473
713
  def ths
474
714
  raise NotImplementedError
475
715
  end
476
716
 
717
+ #
477
718
  # @return [Celerity::TableHeader]
719
+ #
720
+
478
721
  def thead(*args)
479
722
  TableHeader.new(self, *args)
480
723
  end
481
724
 
725
+ #
482
726
  # @return [Celerity::TableHeaders]
727
+ #
728
+
483
729
  def theads
484
730
  TableHeaders.new(self)
485
731
  end
486
732
 
733
+ #
487
734
  # @return [Celerity::Ul]
735
+ #
736
+
488
737
  def ul(*args)
489
738
  Ul.new(self, *args)
490
739
  end
491
740
 
741
+ #
492
742
  # @return [Celerity::Uls]
743
+ #
744
+
493
745
  def uls
494
746
  Uls.new(self)
495
747
  end