watir 2.0.0.rc2 → 2.0.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +0 -2
- data/VERSION +1 -1
- data/lib/watir/collections.rb +2 -2
- data/lib/watir/ie-class.rb +4 -0
- data/lib/watir/input_elements.rb +9 -3
- data/lib/watir/link.rb +2 -1
- data/lib/watir/locator.rb +5 -5
- data/unittests/checkbox_test.rb +2 -2
- data/unittests/checkbox_xpath_test.rb +2 -2
- metadata +7 -7
data/CHANGES
CHANGED
@@ -15,8 +15,6 @@
|
|
15
15
|
* all collection methods accept now specifiers too:
|
16
16
|
- browser.divs(:class => "someclass").each {|div| puts div.class_name} # => "someclass"
|
17
17
|
* removed FormElement class
|
18
|
-
* renamed CheckBox class to Checkbox
|
19
|
-
* renamed CheckBoxes class to Checkboxes
|
20
18
|
* added aliases:
|
21
19
|
- tr => row
|
22
20
|
- trs => rows
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.0.
|
1
|
+
2.0.0.rc3
|
data/lib/watir/collections.rb
CHANGED
@@ -25,8 +25,8 @@ module Watir
|
|
25
25
|
|
26
26
|
# this class accesses the check boxes in the document as a collection
|
27
27
|
# Normally a user would not need to create this object as it is returned by the Watir::Container#checkboxes method
|
28
|
-
class
|
29
|
-
def element_class;
|
28
|
+
class CheckBoxes < InputElementCollections
|
29
|
+
def element_class; CheckBox; end
|
30
30
|
end
|
31
31
|
|
32
32
|
# this class accesses the select boxes in the document as a collection
|
data/lib/watir/ie-class.rb
CHANGED
data/lib/watir/input_elements.rb
CHANGED
@@ -535,7 +535,7 @@ module Watir
|
|
535
535
|
|
536
536
|
# This class is the watir representation of a check box.
|
537
537
|
# Normally a user would not need to create this object as it is returned by the Watir::Container#checkbox method
|
538
|
-
class
|
538
|
+
class CheckBox < RadioCheckCommon
|
539
539
|
INPUT_TYPES = ["checkbox"]
|
540
540
|
# This method checks or unchecks the checkbox.
|
541
541
|
# With no arguments supplied it sets the checkbox.
|
@@ -561,10 +561,16 @@ module Watir
|
|
561
561
|
end
|
562
562
|
|
563
563
|
Watir::Container.module_eval do
|
564
|
-
remove_method :
|
564
|
+
remove_method :check_boxs
|
565
565
|
|
566
566
|
def checkboxes(how={}, what=nil)
|
567
|
-
|
567
|
+
CheckBoxes.new(self, how, what)
|
568
|
+
end
|
569
|
+
|
570
|
+
remove_method :check_box
|
571
|
+
|
572
|
+
def checkbox(how={}, what=nil)
|
573
|
+
CheckBox.new(self, how, what)
|
568
574
|
end
|
569
575
|
end
|
570
576
|
end
|
data/lib/watir/link.rb
CHANGED
data/lib/watir/locator.rb
CHANGED
@@ -30,7 +30,7 @@ module Watir
|
|
30
30
|
|
31
31
|
def set_specifier(how, what=nil)
|
32
32
|
specifiers = what ? {how => what} : how
|
33
|
-
@specifiers = {:index => Watir::
|
33
|
+
@specifiers = {:index => Watir::IE.base_index} # default if not specified
|
34
34
|
normalize_specifiers! specifiers
|
35
35
|
end
|
36
36
|
|
@@ -76,7 +76,7 @@ module Watir
|
|
76
76
|
def locate
|
77
77
|
return locate_by_xpath_css_ole if @specifiers[:xpath] || @specifiers[:css] || @specifiers[:ole_object]
|
78
78
|
|
79
|
-
count = Watir::
|
79
|
+
count = Watir::IE.base_index - 1
|
80
80
|
each do |element|
|
81
81
|
count += 1
|
82
82
|
return element.ole_object if count == @specifiers[:index]
|
@@ -136,7 +136,7 @@ module Watir
|
|
136
136
|
def locate
|
137
137
|
return locate_by_xpath_css_ole if @specifiers[:xpath] || @specifiers[:css] || @specifiers[:ole_object]
|
138
138
|
|
139
|
-
count = Watir::
|
139
|
+
count = Watir::IE.base_index - 1
|
140
140
|
each do |frame|
|
141
141
|
count += 1
|
142
142
|
return frame.ole_object, frame.document if count == @specifiers[:index]
|
@@ -187,7 +187,7 @@ module Watir
|
|
187
187
|
def locate
|
188
188
|
return locate_by_xpath_css_ole if @specifiers[:xpath] || @specifiers[:css] || @specifiers[:ole_object]
|
189
189
|
|
190
|
-
count = Watir::
|
190
|
+
count = Watir::IE.base_index - 1
|
191
191
|
each do |element|
|
192
192
|
count += 1
|
193
193
|
return element.ole_object if count == @specifiers[:index]
|
@@ -226,7 +226,7 @@ module Watir
|
|
226
226
|
|
227
227
|
the_id = @specifiers[:id]
|
228
228
|
if the_id && the_id.class == String &&
|
229
|
-
@specifiers[:index] == Watir::
|
229
|
+
@specifiers[:index] == Watir::IE.base_index && @specifiers.length == 2
|
230
230
|
@element = @document.getElementById(the_id) rescue nil
|
231
231
|
# Return if our fast match really HAS a matching :id
|
232
232
|
return true if @element && @element.invoke('id') == the_id && @types.include?(@element.getAttribute('type'))
|
data/unittests/checkbox_test.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
4
4
|
require 'unittests/setup'
|
5
5
|
|
6
|
-
class
|
6
|
+
class TC_CheckBox < Test::Unit::TestCase
|
7
7
|
include Watir::Exception
|
8
8
|
|
9
9
|
def setup
|
@@ -53,7 +53,7 @@ class TC_Checkbox < Test::Unit::TestCase
|
|
53
53
|
assert_false(browser.button(:value, "foo").enabled?)
|
54
54
|
end
|
55
55
|
|
56
|
-
def
|
56
|
+
def test_CheckBox_Exists
|
57
57
|
assert(browser.checkbox(:name, "box1").exists?)
|
58
58
|
assert_false(browser.checkbox(:name, "missing").exists?)
|
59
59
|
|
@@ -3,7 +3,7 @@
|
|
3
3
|
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
4
4
|
require 'unittests/setup'
|
5
5
|
|
6
|
-
class
|
6
|
+
class TC_CheckBox_XPath < Test::Unit::TestCase
|
7
7
|
include Watir::Exception
|
8
8
|
|
9
9
|
def setup
|
@@ -27,7 +27,7 @@ class TC_Checkbox_XPath < Test::Unit::TestCase
|
|
27
27
|
assert_equal("" , browser.checkbox(:xpath , "//input[@name='box4' and @value='4']/").title)
|
28
28
|
end
|
29
29
|
|
30
|
-
def
|
30
|
+
def test_CheckBox_Exists
|
31
31
|
assert(browser.checkbox(:xpath , "//input[@name='box4' and @value='1']/").exists?)
|
32
32
|
assert_false(browser.checkbox(:xpath , "//input[@name='box4' and @value='22']/").exists?)
|
33
33
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: watir
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15424083
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 0
|
9
9
|
- 0
|
10
10
|
- rc
|
11
|
-
-
|
12
|
-
version: 2.0.0.
|
11
|
+
- 3
|
12
|
+
version: 2.0.0.rc3
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Bret Pettichord
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2011-07-
|
20
|
+
date: 2011-07-25 00:00:00 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: win32-process
|
@@ -59,14 +59,14 @@ dependencies:
|
|
59
59
|
requirements:
|
60
60
|
- - "="
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
hash:
|
62
|
+
hash: 15424083
|
63
63
|
segments:
|
64
64
|
- 2
|
65
65
|
- 0
|
66
66
|
- 0
|
67
67
|
- rc
|
68
|
-
-
|
69
|
-
version: 2.0.0.
|
68
|
+
- 3
|
69
|
+
version: 2.0.0.rc3
|
70
70
|
type: :runtime
|
71
71
|
version_requirements: *id003
|
72
72
|
- !ruby/object:Gem::Dependency
|