celerity 0.0.4 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (158) hide show
  1. data/History.txt +33 -0
  2. data/README.txt +19 -9
  3. data/Rakefile +9 -3
  4. data/lib/celerity.rb +39 -39
  5. data/lib/celerity/browser.rb +538 -153
  6. data/lib/celerity/clickable_element.rb +48 -7
  7. data/lib/celerity/collections.rb +155 -131
  8. data/lib/celerity/container.rb +766 -385
  9. data/lib/celerity/default_viewer.rb +10 -0
  10. data/lib/celerity/disabled_element.rb +19 -2
  11. data/lib/celerity/element.rb +152 -83
  12. data/lib/celerity/element_collection.rb +106 -0
  13. data/lib/celerity/element_locator.rb +89 -66
  14. data/lib/celerity/elements/button.rb +23 -13
  15. data/lib/celerity/elements/file_field.rb +17 -5
  16. data/lib/celerity/elements/form.rb +21 -16
  17. data/lib/celerity/elements/frame.rb +75 -53
  18. data/lib/celerity/elements/image.rb +76 -63
  19. data/lib/celerity/elements/label.rb +4 -2
  20. data/lib/celerity/elements/link.rb +30 -18
  21. data/lib/celerity/elements/meta.rb +6 -0
  22. data/lib/celerity/{non_control_elements.rb → elements/non_control_elements.rb} +106 -76
  23. data/lib/celerity/elements/option.rb +16 -2
  24. data/lib/celerity/elements/radio_check.rb +55 -20
  25. data/lib/celerity/elements/select_list.rb +65 -29
  26. data/lib/celerity/elements/table.rb +141 -94
  27. data/lib/celerity/elements/table_cell.rb +13 -6
  28. data/lib/celerity/elements/{table_body.rb → table_elements.rb} +20 -8
  29. data/lib/celerity/elements/table_row.rb +23 -7
  30. data/lib/celerity/elements/text_field.rb +89 -33
  31. data/lib/celerity/exception.rb +77 -41
  32. data/lib/celerity/extra/method_generator.rb +42 -24
  33. data/lib/celerity/htmlunit.rb +49 -0
  34. data/lib/celerity/htmlunit/commons-collections-3.2.1.jar +0 -0
  35. data/lib/celerity/htmlunit/htmlunit-2.5-SNAPSHOT.jar +0 -0
  36. data/lib/celerity/htmlunit/htmlunit-core-js-2.5-SNAPSHOT.jar +0 -0
  37. data/lib/celerity/htmlunit/nekohtml-1.9.12-20090308.130127-11.jar +0 -0
  38. data/lib/celerity/htmlunit/serializer-2.7.1.jar +0 -0
  39. data/lib/celerity/htmlunit/xalan-2.7.1.jar +0 -0
  40. data/lib/celerity/htmlunit/xml-apis-1.3.04.jar +0 -0
  41. data/lib/celerity/identifier.rb +3 -2
  42. data/lib/celerity/input_element.rb +5 -5
  43. data/lib/celerity/listener.rb +135 -0
  44. data/lib/celerity/resources/no_viewer.png +0 -0
  45. data/lib/celerity/util.rb +88 -0
  46. data/lib/celerity/version.rb +4 -3
  47. data/lib/celerity/watir_compatibility.rb +35 -25
  48. data/tasks/jar.rake +57 -0
  49. metadata +35 -142
  50. data.tar.gz.sig +0 -0
  51. data/Manifest.txt +0 -150
  52. data/lib/celerity/element_collections.rb +0 -54
  53. data/lib/celerity/element_map.rb +0 -51
  54. data/lib/celerity/elements/table_footer.rb +0 -30
  55. data/lib/celerity/elements/table_header.rb +0 -30
  56. data/lib/celerity/htmlunit/commons-collections-3.2.jar +0 -0
  57. data/lib/celerity/htmlunit/download.sh +0 -23
  58. data/lib/celerity/htmlunit/htmlunit-2.2.jar +0 -0
  59. data/lib/celerity/htmlunit/htmlunit-core-js-2.2.jar +0 -0
  60. data/lib/celerity/htmlunit/nekohtml-1.9.8.jar +0 -0
  61. data/lib/celerity/htmlunit/xalan-2.7.0.jar +0 -0
  62. data/lib/celerity/htmlunit/xml-apis-1.0.b2.jar +0 -0
  63. data/spec/area_spec.rb +0 -97
  64. data/spec/areas_spec.rb +0 -40
  65. data/spec/browser_spec.rb +0 -266
  66. data/spec/button_spec.rb +0 -227
  67. data/spec/buttons_spec.rb +0 -39
  68. data/spec/checkbox_spec.rb +0 -302
  69. data/spec/checkboxes_spec.rb +0 -38
  70. data/spec/div_spec.rb +0 -207
  71. data/spec/divs_spec.rb +0 -39
  72. data/spec/element_spec.rb +0 -79
  73. data/spec/filefield_spec.rb +0 -123
  74. data/spec/filefields_spec.rb +0 -40
  75. data/spec/form_spec.rb +0 -59
  76. data/spec/forms_spec.rb +0 -41
  77. data/spec/frame_spec.rb +0 -121
  78. data/spec/frames_spec.rb +0 -71
  79. data/spec/hidden_spec.rb +0 -127
  80. data/spec/hiddens_spec.rb +0 -39
  81. data/spec/hn_spec.rb +0 -104
  82. data/spec/hns_spec.rb +0 -45
  83. data/spec/html/2000_spans.html +0 -2009
  84. data/spec/html/bug_duplicate_attributes.html +0 -14
  85. data/spec/html/bug_javascript_001.html +0 -11
  86. data/spec/html/form_js_bug.html +0 -11
  87. data/spec/html/forms_with_input_elements.html +0 -114
  88. data/spec/html/frame_1.html +0 -17
  89. data/spec/html/frame_2.html +0 -16
  90. data/spec/html/frames.html +0 -11
  91. data/spec/html/iframes.html +0 -12
  92. data/spec/html/images.html +0 -27
  93. data/spec/html/images/1.gif +0 -0
  94. data/spec/html/images/2.gif +0 -0
  95. data/spec/html/images/3.gif +0 -0
  96. data/spec/html/images/button.jpg +0 -0
  97. data/spec/html/images/circle.jpg +0 -0
  98. data/spec/html/images/map.gif +0 -0
  99. data/spec/html/images/map2.gif +0 -0
  100. data/spec/html/images/minus.gif +0 -0
  101. data/spec/html/images/originaltriangle.jpg +0 -0
  102. data/spec/html/images/plus.gif +0 -0
  103. data/spec/html/images/square.jpg +0 -0
  104. data/spec/html/images/triangle.jpg +0 -0
  105. data/spec/html/invalid_js.html +0 -11
  106. data/spec/html/latin1_text.html +0 -17
  107. data/spec/html/non_control_elements.html +0 -115
  108. data/spec/html/simple_ajax.html +0 -22
  109. data/spec/html/tables.html +0 -119
  110. data/spec/html/utf8_text.html +0 -15
  111. data/spec/htmlunit_spec.rb +0 -26
  112. data/spec/image_spec.rb +0 -220
  113. data/spec/images_spec.rb +0 -39
  114. data/spec/label_spec.rb +0 -79
  115. data/spec/labels_spec.rb +0 -40
  116. data/spec/li_spec.rb +0 -139
  117. data/spec/link_spec.rb +0 -189
  118. data/spec/links_spec.rb +0 -43
  119. data/spec/lis_spec.rb +0 -40
  120. data/spec/map_spec.rb +0 -102
  121. data/spec/maps_spec.rb +0 -40
  122. data/spec/meta_spec.rb +0 -8
  123. data/spec/ol_spec.rb +0 -87
  124. data/spec/ols_spec.rb +0 -40
  125. data/spec/option_spec.rb +0 -154
  126. data/spec/p_spec.rb +0 -171
  127. data/spec/pre_spec.rb +0 -135
  128. data/spec/pres_spec.rb +0 -40
  129. data/spec/ps_spec.rb +0 -40
  130. data/spec/radio_spec.rb +0 -299
  131. data/spec/radios_spec.rb +0 -42
  132. data/spec/select_list_spec.rb +0 -299
  133. data/spec/select_lists_spec.rb +0 -47
  134. data/spec/span_spec.rb +0 -184
  135. data/spec/spans_spec.rb +0 -64
  136. data/spec/spec.opts +0 -1
  137. data/spec/spec_helper.rb +0 -55
  138. data/spec/table_bodies_spec.rb +0 -57
  139. data/spec/table_body_spec.rb +0 -111
  140. data/spec/table_cell_spec.rb +0 -74
  141. data/spec/table_cells_spec.rb +0 -59
  142. data/spec/table_footer_spec.rb +0 -101
  143. data/spec/table_footers_spec.rb +0 -55
  144. data/spec/table_header_spec.rb +0 -101
  145. data/spec/table_headers_spec.rb +0 -55
  146. data/spec/table_row_spec.rb +0 -104
  147. data/spec/table_rows_spec.rb +0 -58
  148. data/spec/table_spec.rb +0 -160
  149. data/spec/tables_spec.rb +0 -42
  150. data/spec/text_field_spec.rb +0 -323
  151. data/spec/text_fields_spec.rb +0 -44
  152. data/spec/ul_spec.rb +0 -88
  153. data/spec/uls_spec.rb +0 -40
  154. data/spec/watir_compatibility_spec.rb +0 -260
  155. data/support/spec_server.rb +0 -73
  156. data/tasks/rspec.rake +0 -30
  157. data/tasks/specserver.rake +0 -21
  158. metadata.gz.sig +0 -0
@@ -1,63 +1,76 @@
1
- module Celerity
2
-
3
- class Image < Element
4
- include ClickableElement
5
- include DisabledElement
6
-
7
- TAGS = [ Identifier.new('img') ]
8
- ATTRIBUTES = BASE_ATTRIBUTES | [:src, :alt, :longdesc, :name, :height, :width, :usemap, :ismap, :align, :border, :hspace, :vspace]
9
- DEFAULT_HOW = :src
10
-
11
- # returns the file created date of the image
12
- def file_created_date
13
- assert_exists
14
- web_response = @object.getWebResponse(true)
15
- Time.parse(web_response.getResponseHeaderValue("Last-Modified").to_s)
16
- end
17
-
18
- # returns the filesize of the image
19
- def file_size
20
- assert_exists
21
- web_response = @object.getWebResponse(true)
22
- web_response.getResponseBody.length
23
- end
24
-
25
- # returns the width in pixels of the image, as a string
26
- def width
27
- assert_exists
28
- @object.getWidth
29
- end
30
-
31
- # returns the height in pixels of the image, as a string
32
- def height
33
- assert_exists
34
- @object.getHeight
35
- end
36
-
37
- # returns true if the image is loaded
38
- def loaded?
39
- assert_exists
40
- begin
41
- @object.getImageReader
42
- true
43
- rescue
44
- false
45
- end
46
- end
47
-
48
- def click
49
- assert_exists
50
- @container.update_page(@object.click)
51
- end
52
-
53
- # Saves the image to the given file
54
- def save(filename)
55
- assert_exists
56
- image_reader = @object.getImageReader
57
- file = java.io.File.new(filename)
58
- buffered_image = image_reader.read(0);
59
- javax.imageio.ImageIO.write(buffered_image, image_reader.getFormatName(), file);
60
- end
61
- end
62
-
63
- end
1
+ module Celerity
2
+
3
+ class Image < Element
4
+ include ClickableElement
5
+
6
+ TAGS = [ Identifier.new('img') ]
7
+
8
+ ATTRIBUTES = BASE_ATTRIBUTES | [:src, :alt, :longdesc, :name, :height, :width, :usemap, :ismap, :align, :border, :hspace, :vspace]
9
+ DEFAULT_HOW = :src
10
+
11
+ #
12
+ # returns the file created date of the image
13
+ #
14
+
15
+ def file_created_date
16
+ assert_exists
17
+ web_response = @object.getWebResponse(true)
18
+ Time.parse(web_response.getResponseHeaderValue("Last-Modified").to_s)
19
+ end
20
+
21
+ #
22
+ # returns the filesize of the image
23
+ #
24
+
25
+ def file_size
26
+ assert_exists
27
+ web_response = @object.getWebResponse(true)
28
+ web_response.getResponseBody.length
29
+ end
30
+
31
+ #
32
+ # returns the width in pixels of the image, as a string
33
+ #
34
+
35
+ def width
36
+ assert_exists
37
+ @object.getWidth
38
+ end
39
+
40
+ #
41
+ # returns the height in pixels of the image, as a string
42
+ #
43
+
44
+ def height
45
+ assert_exists
46
+ @object.getHeight
47
+ end
48
+
49
+ #
50
+ # returns true if the image is loaded
51
+ #
52
+
53
+ def loaded?
54
+ assert_exists
55
+ begin
56
+ @object.getImageReader
57
+ true
58
+ rescue
59
+ false
60
+ end
61
+ end
62
+
63
+ #
64
+ # Saves the image to the given file
65
+ #
66
+
67
+ def save(filename)
68
+ assert_exists
69
+ image_reader = @object.getImageReader
70
+ file = java.io.File.new(filename)
71
+ buffered_image = image_reader.read(0);
72
+ javax.imageio.ImageIO.write(buffered_image, image_reader.getFormatName(), file);
73
+ end
74
+
75
+ end # Image
76
+ end # Celerity
@@ -1,9 +1,11 @@
1
1
  module Celerity
2
-
2
+
3
3
  class Label < Element
4
+ include ClickableElement
5
+
4
6
  TAGS = [ Identifier.new('label') ]
5
7
  ATTRIBUTES = BASE_ATTRIBUTES | [:for, :accesskey, :onfocus, :onblur]
6
8
  DEFAULT_HOW = :text
7
9
  end
8
-
10
+
9
11
  end
@@ -1,18 +1,30 @@
1
- module Celerity
2
- class Link < Element
3
-
4
- TAGS = [ Identifier.new('a') ]
5
- ATTRIBUTES = BASE_ATTRIBUTES | [:charset, :type, :name, :href, :hreflang,
6
- :target, :rel, :rev, :accesskey, :shape,
7
- :coords, :tabindex, :onfocus, :onblur]
8
- DEFAULT_HOW = :href
9
-
10
- # clicks the link
11
- def click
12
- assert_exists
13
- @container.update_page @object.click
14
- end
15
-
16
- end
17
-
18
- end
1
+ module Celerity
2
+ class Link < Element
3
+ include ClickableElement
4
+
5
+ TAGS = [ Identifier.new('a') ]
6
+ ATTRIBUTES = BASE_ATTRIBUTES | [:charset, :type, :name, :href, :hreflang,
7
+ :target, :rel, :rev, :accesskey, :shape,
8
+ :coords, :tabindex, :onfocus, :onblur]
9
+ DEFAULT_HOW = :href
10
+
11
+ #
12
+ # Returns the absolute URL for this link (Celerity-specific)
13
+ #
14
+ # (Watir/IE does this for href(), but we don't want that.)
15
+ #
16
+
17
+ def absolute_url
18
+ assert_exists
19
+ href = @object.getAttributeValue('href')
20
+
21
+ unless href.empty? || URI.parse(href).absolute?
22
+ href = URI.join(browser.url, href).to_s
23
+ end
24
+
25
+ href
26
+ end
27
+
28
+
29
+ end # Link
30
+ end # Celerity
@@ -0,0 +1,6 @@
1
+ module Celerity
2
+ class Meta < Element
3
+ ATTRIBUTES = [:name, :id, :'http-equiv', :content, :scheme] | HTML_401_TRANSITIONAL[:i18n]
4
+ TAGS = [ Identifier.new('meta') ]
5
+ end
6
+ end
@@ -1,76 +1,106 @@
1
- module Celerity
2
-
3
- # this class contains items that are common between the span, div, and pre objects
4
- # it would not normally be used directly
5
- #
6
- # many of the methods available to this object are inherited from the Element class
7
- #
8
- class NonControlElement < Element
9
- include Exception
10
- ATTRIBUTES = BASE_ATTRIBUTES
11
- DEFAULT_HOW = :id
12
-
13
- # Can't use ClickableElement as it does assert_enabled - maybe we don't need the module after all?
14
- def click
15
- assert_exists
16
- @container.update_page(@object.click)
17
- end
18
- end
19
-
20
- class Pre < NonControlElement
21
- TAGS = [ Identifier.new('pre')]
22
- end
23
-
24
- class P < NonControlElement
25
- TAGS = [ Identifier.new('p') ]
26
- end
27
-
28
- class Div < NonControlElement
29
- TAGS = [ Identifier.new('div')]
30
- end
31
-
32
- class Span < NonControlElement
33
- TAGS = [ Identifier.new('span') ]
34
- end
35
-
36
- class Ul < NonControlElement
37
- TAGS = [ Identifier.new('ul') ]
38
- end
39
-
40
- class Ol < NonControlElement
41
- TAGS = [ Identifier.new('ol') ]
42
- end
43
-
44
- class Li < NonControlElement
45
- TAGS = [ Identifier.new('li') ]
46
- end
47
-
48
- class Map < NonControlElement
49
- TAGS = [ Identifier.new('map') ]
50
- end
51
-
52
- class Area < NonControlElement
53
- ATTRIBUTES = ATTRIBUTES | [:shape, :coords, :href, :nohref, :alt, :tabindex, :accesskey, :onfocus, :onblur]
54
- TAGS = [ Identifier.new('area') ]
55
- end
56
-
57
- class H1 < NonControlElement
58
- TAGS = [ Identifier.new('h1') ]
59
- end
60
- class H2 < NonControlElement
61
- TAGS = [ Identifier.new('h2') ]
62
- end
63
- class H3 < NonControlElement
64
- TAGS = [ Identifier.new('h3') ]
65
- end
66
- class H4 < NonControlElement
67
- TAGS = [ Identifier.new('h4') ]
68
- end
69
- class H5 < NonControlElement
70
- TAGS = [ Identifier.new('h5') ]
71
- end
72
- class H6 < NonControlElement
73
- TAGS = [ Identifier.new('h6') ]
74
- end
75
-
76
- end
1
+ module Celerity
2
+
3
+ #
4
+ # Superclass for for Span, Pre, Div, H1, ...
5
+ #
6
+
7
+ class NonControlElement < Element
8
+ include Exception
9
+ include ClickableElement
10
+
11
+ ATTRIBUTES = BASE_ATTRIBUTES
12
+ DEFAULT_HOW = :id
13
+ end
14
+
15
+ #
16
+ #--
17
+ # classes ordered alphabetically
18
+ #++
19
+ #
20
+
21
+ class Area < NonControlElement
22
+ ATTRIBUTES = ATTRIBUTES | [:shape, :coords, :href, :nohref, :alt, :tabindex, :accesskey, :onfocus, :onblur]
23
+ TAGS = [ Identifier.new('area') ]
24
+ end
25
+
26
+ class Dd < NonControlElement
27
+ TAGS = [ Identifier.new('dd')]
28
+ end
29
+
30
+ class Div < NonControlElement
31
+ TAGS = [ Identifier.new('div')]
32
+ end
33
+
34
+ class Dl < NonControlElement
35
+ TAGS = [ Identifier.new('dl')]
36
+ end
37
+
38
+ class Dt < NonControlElement
39
+ TAGS = [ Identifier.new('dt')]
40
+ end
41
+
42
+ class Em < NonControlElement
43
+ TAGS = [ Identifier.new('em')]
44
+ end
45
+
46
+ class H1 < NonControlElement
47
+ TAGS = [ Identifier.new('h1') ]
48
+ end
49
+
50
+ class H2 < NonControlElement
51
+ TAGS = [ Identifier.new('h2') ]
52
+ end
53
+
54
+ class H3 < NonControlElement
55
+ TAGS = [ Identifier.new('h3') ]
56
+ end
57
+
58
+ class H4 < NonControlElement
59
+ TAGS = [ Identifier.new('h4') ]
60
+ end
61
+
62
+ class H5 < NonControlElement
63
+ TAGS = [ Identifier.new('h5') ]
64
+ end
65
+
66
+ class H6 < NonControlElement
67
+ TAGS = [ Identifier.new('h6') ]
68
+ end
69
+
70
+ class Li < NonControlElement
71
+ TAGS = [ Identifier.new('li') ]
72
+ end
73
+
74
+ class Map < NonControlElement
75
+ TAGS = [ Identifier.new('map') ]
76
+ end
77
+
78
+ class Ol < NonControlElement
79
+ TAGS = [ Identifier.new('ol') ]
80
+ end
81
+
82
+ class P < NonControlElement
83
+ TAGS = [ Identifier.new('p') ]
84
+ end
85
+
86
+ class Pre < NonControlElement
87
+ TAGS = [ Identifier.new('pre')]
88
+ end
89
+
90
+ class Span < NonControlElement
91
+ TAGS = [ Identifier.new('span') ]
92
+ end
93
+
94
+ class Strong < NonControlElement
95
+ TAGS = [ Identifier.new('strong') ]
96
+ end
97
+
98
+ # class Title < NonControlElement
99
+ # TAGS = [ Identifier.new('title') ]
100
+ # end
101
+
102
+ class Ul < NonControlElement
103
+ TAGS = [ Identifier.new('ul') ]
104
+ end
105
+
106
+ end
@@ -1,18 +1,32 @@
1
1
  module Celerity
2
- # Represents a select list option.
2
+
3
+ #
4
+ # Represents an option in a select list.
5
+ #
6
+
3
7
  class Option < Element
4
8
  include ClickableElement
5
9
  include DisabledElement
6
-
10
+
7
11
  TAGS = [ Identifier.new('option')]
8
12
  ATTRIBUTES = BASE_ATTRIBUTES | [:selected, :disabled, :label, :value]
9
13
  DEFAULT_HOW = :text
10
14
 
11
15
  alias_method :select, :click
12
16
 
17
+ #
18
+ # Is this option selected?
19
+ #
20
+
13
21
  def selected?
14
22
  assert_exists
15
23
  @object.isSelected
16
24
  end
25
+
26
+ def label
27
+ # overrides Container#label
28
+ assert_exists
29
+ @object.getAttribute("label")
30
+ end
17
31
  end
18
32
  end
@@ -1,10 +1,16 @@
1
1
  module Celerity
2
+
3
+ #
2
4
  # Common superclass for radios and check boxes.
5
+ #
6
+
3
7
  class RadioCheckCommon < InputElement
4
8
  DEFAULT_HOW = :name
5
-
6
- # these can optionally take a value parameter as a third arg, so needs
7
- # to be special-handled.
9
+
10
+ #
11
+ # Can optionally take a value parameter as a third arg, so we override initialize
12
+ #
13
+
8
14
  def initialize(container, type, *args)
9
15
  @type = type
10
16
  case args.size
@@ -17,33 +23,51 @@ module Celerity
17
23
  end
18
24
  end
19
25
 
26
+ #
20
27
  # returns true if the element is checked
28
+ # @return [true, false]
29
+ #
30
+
21
31
  def set?
22
32
  assert_exists
23
33
  @object.isChecked
24
34
  end
25
35
  alias_method :checked?, :set?
36
+
37
+ #
38
+ # Unset this element.
39
+ #
26
40
 
27
41
  def clear
28
42
  set(false)
29
43
  end
30
44
  end
45
+
46
+ #
47
+ # This class is the representation of a radio button.
48
+ #
31
49
 
32
- # This class is the celerity representation of a radio button.
33
50
  class Radio < RadioCheckCommon
34
- TAGS = [Identifier.new('input', :type => %w(radio))]
35
-
51
+ TAGS = [Identifier.new('input', :type => %w[radio])]
52
+
53
+ #
54
+ # @api private
55
+ #
56
+
36
57
  def initialize(container, *args)
37
- super(container, ['radio'], *args)
58
+ super(container, %w[radio], *args)
38
59
  end
39
60
 
40
- # Sets the radio button.
41
61
  #
42
- # radio.set? # => false
43
- # radio.set
44
- # radio.set? # => true
62
+ # Set the radio button to the given value.
63
+ #
64
+ # radio.set? #=> false
65
+ # radio.set
66
+ # radio.set? #=> true
45
67
  # radio.set(false)
46
- # radio.set? # => false
68
+ # radio.set? #=> false
69
+ #
70
+
47
71
  def set(value = true)
48
72
  assert_exists
49
73
  assert_enabled
@@ -52,24 +76,35 @@ module Celerity
52
76
 
53
77
  end
54
78
 
55
- # This class is the celerity representation of a check box.
79
+ #
80
+ # This class is the representation of a check box.
81
+ #
82
+
56
83
  class CheckBox < RadioCheckCommon
57
- TAGS = [Identifier.new('input', :type => %w(checkbox))]
84
+ TAGS = [Identifier.new('input', :type => %w[checkbox])]
58
85
 
86
+ #
87
+ # @api private
88
+ #
89
+
59
90
  def initialize(container, *args)
60
- super(container, ['checkbox'], *args)
91
+ super(container, %w[checkbox], *args)
61
92
  end
62
93
 
63
- # Sets the checkbox button.
64
94
  #
65
- # checkbox.set? # => false
66
- # checkbox.set
67
- # checkbox.set? # => true
95
+ # Set the checkbox to the given value.
96
+ #
97
+ # checkbox.set? #=> false
98
+ # checkbox.set
99
+ # checkbox.set? #=> true
68
100
  # checkbox.set(false)
69
- # checkbox.set? # => false
101
+ # checkbox.set? #=> false
102
+ #
103
+
70
104
  def set(value = true)
71
105
  assert_exists
72
106
  assert_enabled
107
+
73
108
  if (value && !set?) || (!value && set?)
74
109
  Log.debug(@object.inspect)
75
110
  @container.update_page(@object.click)