safariwatir 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
data/safariwatir.rb CHANGED
@@ -148,10 +148,21 @@ module Watir
148
148
 
149
149
  class Checkbox < InputElement
150
150
  def_init :scripter, :how, :what, :value
151
+
151
152
  def by_value
152
153
  @value
153
154
  end
154
- alias :set :click
155
+
156
+ # Contributed by Kyle Campos
157
+ def checked?
158
+ @scripter.checkbox_is_checked?(self)
159
+ end
160
+
161
+ def set(check_it = true)
162
+ return if check_it && checked?
163
+ return if !check_it && !checked?
164
+ click
165
+ end
155
166
  end
156
167
 
157
168
  class Div < ContentElement
@@ -315,6 +315,11 @@ for (var i = 0; i < document.links.length; i++) {
315
315
  end
316
316
  private :handle_match
317
317
 
318
+ # Contributed by Kyle Campos
319
+ def checkbox_is_checked?(element = @element)
320
+ execute(element.operate { %|return element.checked;| }, element)
321
+ end
322
+
318
323
  def operate_by_input_value(element)
319
324
  js.operate(%|
320
325
  var elements = document.getElementsByTagName('INPUT');
@@ -338,6 +343,7 @@ for (var i = 0; i < elements.length; i++) {
338
343
  }|, yield)
339
344
  end
340
345
 
346
+ # Checkboxes/Radios have the same name, different values
341
347
  def handle_form_element_name_match(element)
342
348
  element_capture = %|element = elements[i];break;|
343
349
  if element.by_value
@@ -2,6 +2,9 @@ require 'rubygems'
2
2
  require 'safariwatir'
3
3
 
4
4
  # TODO
5
+ #
6
+ # Looking up textareas, or any input element for that matter, by index
7
+ #
5
8
  # Be more attached to the Safari window.
6
9
  # Currently, if a different window is selected, the AppleScript executes against it.
7
10
  # Verify onclick is working for buttons and links
metadata CHANGED
@@ -1,59 +1,66 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.2
3
- specification_version: 1
4
2
  name: safariwatir
5
3
  version: !ruby/object:Gem::Version
6
- version: 0.2.5
7
- date: 2007-07-03 00:00:00 -05:00
8
- summary: Automated testing tool for web applications.
9
- require_paths:
10
- - .
11
- email: dave@obtiva.com
12
- homepage: http://safariwatir.rubyforge.org/
13
- rubyforge_project: safariwatir
14
- description: WATIR stands for "Web Application Testing in Ruby". See WATIR project for more information. This is a Safari-version of the original IE-only WATIR.
15
- autorequire: safariwatir
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: false
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
4
+ version: 0.2.6
25
5
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
6
  authors:
30
7
  - Dave Hoover
8
+ autorequire: safariwatir
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-01-11 00:00:00 -06:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rb-appscript
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: "0"
23
+ version:
24
+ description: WATIR stands for "Web Application Testing in Ruby". See WATIR project for more information. This is a Safari-version of the original IE-only WATIR.
25
+ email: dave@obtiva.com
26
+ executables: []
27
+
28
+ extensions: []
29
+
30
+ extra_rdoc_files: []
31
+
31
32
  files:
32
33
  - safariwatir.rb
33
34
  - safariwatir_script.rb
34
35
  - safariwatir/core_ext.rb
35
36
  - safariwatir/scripter.rb
36
37
  - watir/exceptions.rb
37
- test_files: []
38
-
38
+ has_rdoc: false
39
+ homepage: http://safariwatir.rubyforge.org/
40
+ post_install_message:
39
41
  rdoc_options: []
40
42
 
41
- extra_rdoc_files: []
42
-
43
- executables: []
44
-
45
- extensions: []
46
-
43
+ require_paths:
44
+ - .
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: "0"
50
+ version:
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: "0"
56
+ version:
47
57
  requirements:
48
58
  - Mac OS X running Safari
49
59
  - Some features require you to turn on "Enable access for assistive devices" in System Preferences > Universal Access
50
- dependencies:
51
- - !ruby/object:Gem::Dependency
52
- name: rb-appscript
53
- version_requirement:
54
- version_requirements: !ruby/object:Gem::Version::Requirement
55
- requirements:
56
- - - ">"
57
- - !ruby/object:Gem::Version
58
- version: 0.0.0
59
- version:
60
+ rubyforge_project: safariwatir
61
+ rubygems_version: 1.0.0
62
+ signing_key:
63
+ specification_version: 2
64
+ summary: Automated testing tool for web applications.
65
+ test_files: []
66
+