jarib-celerity 0.0.6.9 → 0.0.6.10
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/celerity/element_collection.rb +8 -7
- data/lib/celerity/element_locator.rb +1 -1
- data/lib/celerity/elements/table.rb +6 -6
- data/lib/celerity/elements/table_elements.rb +1 -1
- data/lib/celerity/elements/table_row.rb +2 -2
- data/lib/celerity/version.rb +1 -1
- data/lib/celerity.rb +5 -1
- metadata +1 -1
@@ -48,19 +48,20 @@ module Celerity
|
|
48
48
|
|
49
49
|
#
|
50
50
|
# Get the element at the given index.
|
51
|
-
#
|
51
|
+
# By default, this is 1-indexed to keep compatibility with Watir.
|
52
|
+
#
|
52
53
|
# Also note that because of Watir's lazy loading, this will return an Element
|
53
54
|
# instance even if the index is out of bounds.
|
54
55
|
#
|
55
|
-
# @param [Fixnum] n Index of wanted element, 1-indexed.
|
56
|
+
# @param [Fixnum] n Index of wanted element, 1-indexed unless Celerity.index_offset is changed.
|
56
57
|
# @return [Celerity::Element] Returns a subclass of Celerity::Element
|
57
58
|
#
|
58
59
|
|
59
60
|
def [](n)
|
60
|
-
if @elements && @elements[n -
|
61
|
-
element_class.new(@container, :object, @elements[n -
|
61
|
+
if @elements && @elements[n - Celerity.index_offset]
|
62
|
+
element_class.new(@container, :object, @elements[n - Celerity.index_offset])
|
62
63
|
else
|
63
|
-
iterator_object(n -
|
64
|
+
iterator_object(n - Celerity.index_offset)
|
64
65
|
end
|
65
66
|
end
|
66
67
|
|
@@ -71,7 +72,7 @@ module Celerity
|
|
71
72
|
#
|
72
73
|
|
73
74
|
def first
|
74
|
-
self[
|
75
|
+
self[Celerity.index_offset]
|
75
76
|
end
|
76
77
|
|
77
78
|
#
|
@@ -81,7 +82,7 @@ module Celerity
|
|
81
82
|
#
|
82
83
|
|
83
84
|
def last
|
84
|
-
self[
|
85
|
+
self[Celerity.index_offset - 1]
|
85
86
|
end
|
86
87
|
|
87
88
|
#
|
@@ -67,11 +67,11 @@ module Celerity
|
|
67
67
|
def child_row(index)
|
68
68
|
assert_exists
|
69
69
|
|
70
|
-
if (index -
|
70
|
+
if (index - Celerity.index_offset) >= @rows.length
|
71
71
|
raise UnknownRowException, "Unable to locate a row at index #{index}"
|
72
72
|
end
|
73
73
|
|
74
|
-
TableRow.new(self, :object, @rows[index -
|
74
|
+
TableRow.new(self, :object, @rows[index - Celerity.index_offset])
|
75
75
|
end
|
76
76
|
alias_method :[], :child_row
|
77
77
|
|
@@ -88,11 +88,11 @@ module Celerity
|
|
88
88
|
def child_cell(index)
|
89
89
|
assert_exists
|
90
90
|
|
91
|
-
if (index -
|
91
|
+
if (index - Celerity.index_offset) >= @cells.length
|
92
92
|
raise UnknownCellException, "Unable to locate a cell at index #{index}"
|
93
93
|
end
|
94
94
|
|
95
|
-
TableCell.new(self, :object, @cells[index -
|
95
|
+
TableCell.new(self, :object, @cells[index - Celerity.index_offset])
|
96
96
|
end
|
97
97
|
|
98
98
|
#
|
@@ -112,9 +112,9 @@ module Celerity
|
|
112
112
|
# @return [Fixnum]
|
113
113
|
#
|
114
114
|
|
115
|
-
def column_count(index =
|
115
|
+
def column_count(index = Celerity.index_offset)
|
116
116
|
assert_exists
|
117
|
-
@object.getRow(index -
|
117
|
+
@object.getRow(index - Celerity.index_offset).getCells.length
|
118
118
|
end
|
119
119
|
|
120
120
|
#
|
@@ -27,11 +27,11 @@ module Celerity
|
|
27
27
|
def child_cell(index)
|
28
28
|
assert_exists
|
29
29
|
|
30
|
-
if (index -
|
30
|
+
if (index - Celerity.index_offset) >= @cells.length
|
31
31
|
raise UnknownCellException, "Unable to locate a cell at index #{index}"
|
32
32
|
end
|
33
33
|
|
34
|
-
TableCell.new(self, :object, @cells[index -
|
34
|
+
TableCell.new(self, :object, @cells[index - Celerity.index_offset])
|
35
35
|
end
|
36
36
|
alias_method :[], :child_cell
|
37
37
|
|
data/lib/celerity/version.rb
CHANGED
data/lib/celerity.rb
CHANGED
@@ -16,7 +16,11 @@ module Celerity
|
|
16
16
|
Log = Logger.new($DEBUG ? $stderr : nil)
|
17
17
|
Log.level = Logger::DEBUG
|
18
18
|
|
19
|
-
|
19
|
+
@index_offset = 1
|
20
|
+
class << self
|
21
|
+
attr_accessor :index_offset
|
22
|
+
end
|
23
|
+
|
20
24
|
DIR = File.expand_path(File.dirname(__FILE__) + "/celerity")
|
21
25
|
end
|
22
26
|
|