watir 2.0.0.rc2 → 2.0.0.rc3

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/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.rc2
1
+ 2.0.0.rc3
@@ -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 Checkboxes < InputElementCollections
29
- def element_class; Checkbox; end
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
@@ -58,6 +58,10 @@ module Watir
58
58
  @@zero_based_indexing
59
59
  end
60
60
 
61
+ def self.base_index
62
+ self.zero_based_indexing ? 0 : 1
63
+ end
64
+
61
65
  # Used internally to determine when IE has finished loading a page
62
66
  READYSTATES = {:complete => 4}
63
67
 
@@ -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 Checkbox < RadioCheckCommon
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 :checkboxs
564
+ remove_method :check_boxs
565
565
 
566
566
  def checkboxes(how={}, what=nil)
567
- Checkboxes.new(self, how, what)
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
@@ -54,7 +54,8 @@ module Watir
54
54
  Watir::Container.module_eval do
55
55
  alias_method :a, :link
56
56
  alias_method :as, :links
57
- end
57
+ end
58
+
58
59
  end
59
60
 
60
61
  end
@@ -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::Browser.base_index} # default if not specified
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::Browser.base_index - 1
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::Browser.base_index - 1
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::Browser.base_index - 1
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::Browser.base_index && @specifiers.length == 2
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'))
@@ -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 TC_Checkbox < Test::Unit::TestCase
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 test_Checkbox_Exists
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 TC_Checkbox_XPath < Test::Unit::TestCase
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 test_Checkbox_Exists
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: 15424081
4
+ hash: 15424083
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
9
  - 0
10
10
  - rc
11
- - 2
12
- version: 2.0.0.rc2
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-24 00:00:00 Z
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: 15424081
62
+ hash: 15424083
63
63
  segments:
64
64
  - 2
65
65
  - 0
66
66
  - 0
67
67
  - rc
68
- - 2
69
- version: 2.0.0.rc2
68
+ - 3
69
+ version: 2.0.0.rc3
70
70
  type: :runtime
71
71
  version_requirements: *id003
72
72
  - !ruby/object:Gem::Dependency