watir-webdriver 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. data/Rakefile +53 -31
  2. data/VERSION +1 -1
  3. data/lib/watir-webdriver.rb +6 -8
  4. data/lib/watir-webdriver/attribute_helper.rb +121 -0
  5. data/lib/watir-webdriver/browser.rb +13 -6
  6. data/lib/watir-webdriver/collections/element_collection.rb +21 -15
  7. data/lib/watir-webdriver/collections/table_row_collection.rb +11 -0
  8. data/lib/watir-webdriver/container.rb +17 -11
  9. data/lib/watir-webdriver/element.rb +201 -0
  10. data/lib/watir-webdriver/elements/button.rb +19 -2
  11. data/lib/watir-webdriver/elements/checkbox.rb +24 -4
  12. data/lib/watir-webdriver/elements/file_field.rb +24 -4
  13. data/lib/watir-webdriver/elements/font.rb +10 -11
  14. data/lib/watir-webdriver/elements/frame.rb +11 -3
  15. data/lib/watir-webdriver/elements/generated.rb +2491 -1313
  16. data/lib/watir-webdriver/elements/hidden.rb +16 -5
  17. data/lib/watir-webdriver/elements/input.rb +44 -5
  18. data/lib/watir-webdriver/elements/link.rb +6 -8
  19. data/lib/watir-webdriver/elements/radio.rb +25 -6
  20. data/lib/watir-webdriver/elements/{select_list.rb → select.rb} +8 -9
  21. data/lib/watir-webdriver/elements/text_field.rb +32 -3
  22. data/lib/watir-webdriver/html.rb +18 -0
  23. data/lib/watir-webdriver/html/generator.rb +112 -0
  24. data/lib/watir-webdriver/html/idl_sorter.rb +49 -0
  25. data/lib/watir-webdriver/html/spec_extractor.rb +111 -0
  26. data/lib/watir-webdriver/html/util.rb +31 -0
  27. data/lib/watir-webdriver/html/visitor.rb +186 -0
  28. data/lib/watir-webdriver/locators/element_locator.rb +4 -0
  29. data/lib/watir-webdriver/locators/text_field_locator.rb +2 -2
  30. data/lib/watir-webdriver/xpath_support.rb +3 -5
  31. data/lib/yard/handlers/watir.rb +57 -0
  32. data/spec/{base_element_spec.rb → element_spec.rb} +3 -2
  33. data/spec/input_spec.rb +65 -0
  34. data/spec/spec_helper.rb +9 -2
  35. data/spec/watirspec/area_spec.rb +9 -13
  36. data/spec/watirspec/areas_spec.rb +7 -1
  37. data/spec/watirspec/browser_spec.rb +68 -72
  38. data/spec/watirspec/button_spec.rb +16 -9
  39. data/spec/watirspec/buttons_spec.rb +11 -9
  40. data/spec/watirspec/checkbox_spec.rb +1 -1
  41. data/spec/watirspec/checkboxes_spec.rb +7 -1
  42. data/spec/watirspec/collections_spec.rb +18 -0
  43. data/spec/watirspec/dd_spec.rb +1 -1
  44. data/spec/watirspec/dds_spec.rb +7 -1
  45. data/spec/watirspec/del_spec.rb +141 -0
  46. data/spec/watirspec/dels_spec.rb +37 -0
  47. data/spec/watirspec/div_spec.rb +6 -22
  48. data/spec/watirspec/divs_spec.rb +8 -2
  49. data/spec/watirspec/dl_spec.rb +1 -1
  50. data/spec/watirspec/dls_spec.rb +7 -1
  51. data/spec/watirspec/dt_spec.rb +1 -1
  52. data/spec/watirspec/dts_spec.rb +7 -1
  53. data/spec/watirspec/element_spec.rb +11 -20
  54. data/spec/watirspec/em_spec.rb +1 -1
  55. data/spec/watirspec/ems_spec.rb +7 -1
  56. data/spec/watirspec/filefield_spec.rb +8 -11
  57. data/spec/watirspec/filefields_spec.rb +7 -1
  58. data/spec/watirspec/font_spec.rb +2 -2
  59. data/spec/watirspec/form_spec.rb +10 -18
  60. data/spec/watirspec/forms_spec.rb +7 -1
  61. data/spec/watirspec/frame_spec.rb +69 -73
  62. data/spec/watirspec/frames_spec.rb +15 -2
  63. data/spec/watirspec/hidden_spec.rb +1 -1
  64. data/spec/watirspec/hiddens_spec.rb +7 -1
  65. data/spec/watirspec/hn_spec.rb +1 -1
  66. data/spec/watirspec/hns_spec.rb +23 -27
  67. data/spec/watirspec/image_spec.rb +9 -15
  68. data/spec/watirspec/images_spec.rb +7 -1
  69. data/spec/watirspec/ins_spec.rb +142 -0
  70. data/spec/watirspec/inses_spec.rb +37 -0
  71. data/spec/watirspec/label_spec.rb +1 -1
  72. data/spec/watirspec/labels_spec.rb +7 -1
  73. data/spec/watirspec/li_spec.rb +1 -1
  74. data/spec/watirspec/lib/guards.rb +12 -12
  75. data/spec/watirspec/lib/implementation.rb +48 -0
  76. data/spec/watirspec/lib/watirspec.rb +17 -12
  77. data/spec/watirspec/link_spec.rb +6 -11
  78. data/spec/watirspec/links_spec.rb +1 -1
  79. data/spec/watirspec/lis_spec.rb +7 -1
  80. data/spec/watirspec/map_spec.rb +1 -1
  81. data/spec/watirspec/maps_spec.rb +7 -1
  82. data/spec/watirspec/meta_spec.rb +13 -15
  83. data/spec/watirspec/metas_spec.rb +6 -1
  84. data/spec/watirspec/ol_spec.rb +57 -59
  85. data/spec/watirspec/ols_spec.rb +10 -4
  86. data/spec/watirspec/option_spec.rb +50 -83
  87. data/spec/watirspec/p_spec.rb +1 -1
  88. data/spec/watirspec/pre_spec.rb +1 -1
  89. data/spec/watirspec/pres_spec.rb +7 -1
  90. data/spec/watirspec/ps_spec.rb +7 -1
  91. data/spec/watirspec/radio_spec.rb +9 -11
  92. data/spec/watirspec/radios_spec.rb +1 -1
  93. data/spec/watirspec/select_list_spec.rb +27 -40
  94. data/spec/watirspec/select_lists_spec.rb +1 -1
  95. data/spec/watirspec/span_spec.rb +1 -1
  96. data/spec/watirspec/spans_spec.rb +7 -1
  97. data/spec/watirspec/spec_helper.rb +1 -0
  98. data/spec/watirspec/strong_spec.rb +1 -1
  99. data/spec/watirspec/strongs_spec.rb +7 -1
  100. data/spec/watirspec/table_bodies_spec.rb +22 -10
  101. data/spec/watirspec/table_body_spec.rb +33 -40
  102. data/spec/watirspec/table_cell_spec.rb +1 -1
  103. data/spec/watirspec/table_cells_spec.rb +36 -15
  104. data/spec/watirspec/table_footer_spec.rb +43 -40
  105. data/spec/watirspec/table_footers_spec.rb +35 -19
  106. data/spec/watirspec/table_header_spec.rb +44 -39
  107. data/spec/watirspec/table_headers_spec.rb +37 -19
  108. data/spec/watirspec/table_row_spec.rb +13 -9
  109. data/spec/watirspec/table_rows_spec.rb +16 -6
  110. data/spec/watirspec/table_spec.rb +83 -62
  111. data/spec/watirspec/tables_spec.rb +7 -1
  112. data/spec/watirspec/text_field_spec.rb +4 -6
  113. data/spec/watirspec/text_fields_spec.rb +1 -1
  114. data/spec/watirspec/ul_spec.rb +1 -1
  115. data/spec/watirspec/uls_spec.rb +25 -22
  116. data/support/html5.html +89235 -0
  117. data/watir-webdriver.gemspec +31 -21
  118. metadata +52 -23
  119. data/TODO +0 -15
  120. data/lib/watir-webdriver/base_element.rb +0 -361
  121. data/lib/watir-webdriver/collections/buttons_collection.rb +0 -15
  122. data/lib/watir-webdriver/collections/table_rows_collection.rb +0 -16
  123. data/lib/watir-webdriver/collections/text_fields_collection.rb +0 -15
  124. data/lib/watir-webdriver/elements/headings.rb +0 -48
  125. data/support/html5/html5.idl +0 -1274
  126. data/support/html5/old/html5.idl +0 -962
  127. data/support/html5/old/html5_extras.idl +0 -145
  128. data/support/html5/watir_visitor.rb +0 -173
  129. data/support/yard_handlers.rb +0 -87
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
2
+ require File.expand_path('spec_helper', File.dirname(__FILE__))
3
3
 
4
4
  describe "TableCell" do
5
5
 
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
2
+ require File.expand_path('spec_helper', File.dirname(__FILE__))
3
3
 
4
4
  describe "TableCells" do
5
5
 
@@ -7,40 +7,61 @@ describe "TableCells" do
7
7
  browser.goto(WatirSpec.files + "/tables.html")
8
8
  end
9
9
 
10
- # describe "#length" do
11
- # it "returns the number of cells" do
12
- # browser.table(:id, 'outer').cells.length.should == 6
13
- # browser.table(:id, 'inner').cells.length.should == 2
14
- # end
15
- # end
16
- #
17
- # describe "#[]" do
18
- # it "returns the row at the given index" do
19
- # browser.table(:id, 'outer').cells[0].text.should == "Table 1, Row 1, Cell 1"
20
- # browser.table(:id, 'inner').cells[0].text.should == "Table 2, Row 1, Cell 1"
21
- # browser.table(:id, 'outer').cells[6].text.should == "Table 1, Row 3, Cell 2"
22
- # end
23
- # end
10
+ # describe "#length" do
11
+ # it "returns the number of cells" do
12
+ # browser.table(:id, 'outer').cells.length.should == 6
13
+ # browser.table(:id, 'inner').cells.length.should == 2
14
+ # end
15
+ # end
16
+ #
17
+ # describe "#[]" do
18
+ # it "returns the row at the given index" do
19
+ # browser.table(:id, 'outer').cells[0].text.should == "Table 1, Row 1, Cell 1"
20
+ # browser.table(:id, 'inner').cells[0].text.should == "Table 2, Row 1, Cell 1"
21
+ # browser.table(:id, 'outer').cells[6].text.should == "Table 1, Row 3, Cell 2"
22
+ # end
23
+ # end
24
24
 
25
25
  describe "#each" do
26
26
  it "iterates through cells correctly" do
27
27
  # All cells on the page
28
+ count = 0
29
+
28
30
  browser.cells.each_with_index do |c, index|
29
31
  c.id.should == browser.cell(:index, index).id
30
32
  c.value.should == browser.cell(:index, index).value
33
+
34
+ count += 1
31
35
  end
36
+
37
+ count.should > 0
38
+
32
39
  # Cells inside a table
40
+ count = 0
41
+
33
42
  inner_table = browser.table(:id, 'inner')
34
43
  inner_table.cells.each_with_index do |c, index|
35
44
  c.id.should == inner_table.cell(:index, index).id
36
45
  c.value.should == inner_table.cell(:index, index).value
46
+
47
+ count += 1
37
48
  end
49
+
50
+ count.should > 0
51
+
52
+
38
53
  # Cells inside a table (should not include cells inside a table inside a table)
39
54
  outer_table = browser.table(:id, 'outer')
55
+ count = 0
56
+
40
57
  outer_table.cells.each_with_index do |c, index|
41
58
  c.id.should == outer_table.cell(:index, index).id
42
59
  c.value.should == outer_table.cell(:index, index).value
60
+
61
+ count += 1
43
62
  end
63
+
64
+ count.should > 0
44
65
  end
45
66
  end
46
67
 
@@ -1,53 +1,52 @@
1
1
  # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
2
+ require File.expand_path('spec_helper', File.dirname(__FILE__))
3
3
 
4
- bug "WTR-358", :watir do
4
+ describe "TableFooter" do
5
+ before :each do
6
+ browser.goto(WatirSpec.files + "/tables.html")
7
+ end
5
8
 
6
- describe "TableFooter" do
7
- before :each do
8
- browser.goto(WatirSpec.files + "/tables.html")
9
+ describe "#exists?" do
10
+ it "returns true if the table tfoot exists (page context)" do
11
+ browser.tfoot(:id, 'tax_totals').should exist
12
+ browser.tfoot(:id, /tax_totals/).should exist
13
+ browser.tfoot(:index, 0).should exist
14
+ browser.tfoot(:xpath, "//tfoot[@id='tax_totals']").should exist
9
15
  end
10
16
 
11
- describe "#exists?" do
12
- it "returns true if the table tfoot exists (page context)" do
13
- browser.tfoot(:id, 'tax_totals').should exist
14
- browser.tfoot(:id, /tax_totals/).should exist
15
- browser.tfoot(:index, 0).should exist
16
- browser.tfoot(:xpath, "//tfoot[@id='tax_totals']").should exist
17
- end
18
-
19
- it "returns true if the table tfoot exists (table context)" do
20
- browser.table(:index, 0).tfoot(:id, 'tax_totals').should exist
21
- browser.table(:index, 0).tfoot(:id, /tax_totals/).should exist
22
- browser.table(:index, 0).tfoot(:index, 0).should exist
23
- browser.table(:index, 0).tfoot(:xpath, "//tfoot[@id='tax_totals']").should exist
24
- end
17
+ it "returns true if the table tfoot exists (table context)" do
18
+ browser.table(:index, 0).tfoot(:id, 'tax_totals').should exist
19
+ browser.table(:index, 0).tfoot(:id, /tax_totals/).should exist
20
+ browser.table(:index, 0).tfoot(:index, 0).should exist
21
+ browser.table(:index, 0).tfoot(:xpath, "//tfoot[@id='tax_totals']").should exist
22
+ end
25
23
 
26
- it "returns false if the table tfoot doesn't exist (page context)" do
27
- browser.tfoot(:id, 'no_such_id').should_not exist
28
- browser.tfoot(:id, /no_such_id/).should_not exist
29
- browser.tfoot(:index, 1337).should_not exist
30
- browser.tfoot(:xpath, "//tfoot[@id='no_such_id']").should_not exist
31
- end
24
+ it "returns false if the table tfoot doesn't exist (page context)" do
25
+ browser.tfoot(:id, 'no_such_id').should_not exist
26
+ browser.tfoot(:id, /no_such_id/).should_not exist
27
+ browser.tfoot(:index, 1337).should_not exist
28
+ browser.tfoot(:xpath, "//tfoot[@id='no_such_id']").should_not exist
29
+ end
32
30
 
33
- it "returns false if the table tfoot doesn't exist (table context)" do
34
- browser.table(:index, 0).tfoot(:id, 'no_such_id').should_not exist
35
- browser.table(:index, 0).tfoot(:id, /no_such_id/).should_not exist
36
- browser.table(:index, 0).tfoot(:index, 1337).should_not exist
37
- browser.table(:index, 0).tfoot(:xpath, "//tfoot[@id='no_such_id']").should_not exist
38
- end
31
+ it "returns false if the table tfoot doesn't exist (table context)" do
32
+ browser.table(:index, 0).tfoot(:id, 'no_such_id').should_not exist
33
+ browser.table(:index, 0).tfoot(:id, /no_such_id/).should_not exist
34
+ browser.table(:index, 0).tfoot(:index, 1337).should_not exist
35
+ browser.table(:index, 0).tfoot(:xpath, "//tfoot[@id='no_such_id']").should_not exist
36
+ end
39
37
 
40
- it "raises TypeError when 'what' argument is invalid" do
41
- lambda { browser.tfoot(:id, 3.14).exists? }.should raise_error(TypeError)
42
- lambda { browser.table(:index, 0).tfoot(:id, 3.14).exists? }.should raise_error(TypeError)
43
- end
38
+ it "raises TypeError when 'what' argument is invalid" do
39
+ lambda { browser.tfoot(:id, 3.14).exists? }.should raise_error(TypeError)
40
+ lambda { browser.table(:index, 0).tfoot(:id, 3.14).exists? }.should raise_error(TypeError)
41
+ end
44
42
 
45
- it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
46
- lambda { browser.tfoot(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
47
- lambda { browser.table(:index, 0).tfoot(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
48
- end
43
+ it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
44
+ lambda { browser.tfoot(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
45
+ lambda { browser.table(:index, 0).tfoot(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
49
46
  end
47
+ end
50
48
 
49
+ bug "http://github.com/jarib/watir-webdriver/issues/#issue/2", :webdriver do
51
50
  describe "#length" do
52
51
  it "returns the correct number of table footers (page context)" do
53
52
  browser.tfoot(:id, 'tax_totals').length.should == 1
@@ -57,7 +56,9 @@ bug "WTR-358", :watir do
57
56
  browser.table(:index, 0).tfoot(:id, 'tax_totals').length.should == 1
58
57
  end
59
58
  end
59
+ end
60
60
 
61
+ bug "http://github.com/jarib/watir-webdriver/issues/#issue/2", :webdriver do
61
62
  describe "#[]" do
62
63
  it "returns the row at the given index (page context)" do
63
64
  browser.tfoot(:id, 'tax_totals')[0].id.should == 'tfoot_row_1'
@@ -71,7 +72,9 @@ bug "WTR-358", :watir do
71
72
  browser.table(:index, 0).tfoot(:id, 'tax_totals')[0][2].text.should == '5 577'
72
73
  end
73
74
  end
75
+ end
74
76
 
77
+ bug "http://github.com/jarib/watir-webdriver/issues/#issue/2", :webdriver do
75
78
  describe "#each" do
76
79
  it "iterates through rows correctly" do
77
80
  tfoot = browser.table(:index, 0).tfoot(:id, 'tax_totals')
@@ -82,4 +85,4 @@ bug "WTR-358", :watir do
82
85
  end
83
86
  end
84
87
 
85
- end
88
+ end
@@ -1,47 +1,63 @@
1
1
  # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
2
+ require File.expand_path('spec_helper', File.dirname(__FILE__))
3
3
 
4
- bug "WTR-358", :watir do
4
+ describe "TableFooters" do
5
+ before :each do
6
+ browser.goto(WatirSpec.files + "/tables.html")
7
+ end
5
8
 
6
- describe "TableFooters" do
7
- before :each do
8
- browser.goto(WatirSpec.files + "/tables.html")
9
+ describe "#length" do
10
+ it "returns the correct number of table tfoots (page context)" do
11
+ browser.tfoots.length.should == 1
9
12
  end
10
13
 
11
- describe "#length" do
12
- it "returns the correct number of table tfoots (page context)" do
13
- browser.tfoots.length.should == 1
14
- end
14
+ it "returns the correct number of table tfoots (table context)" do
15
+ browser.table(:index, 0).tfoots.length.should == 1
16
+ end
17
+ end
15
18
 
16
- it "returns the correct number of table tfoots (table context)" do
17
- browser.table(:index, 0).tfoots.length.should == 1
18
- end
19
+ describe "#[]" do
20
+ it "returns the row at the given index (page context)" do
21
+ browser.tfoots[0].id.should == "tax_totals"
19
22
  end
20
23
 
21
- describe "#[]" do
22
- it "returns the row at the given index (page context)" do
23
- browser.tfoots[0].id.should == "tax_totals"
24
- end
24
+ it "returns the row at the given index (table context)" do
25
+ browser.table(:index, 0).tfoots[0].id.should == "tax_totals"
26
+ end
27
+ end
25
28
 
26
- it "returns the row at the given index (table context)" do
27
- browser.table(:index, 0).tfoots[0].id.should == "tax_totals"
29
+ describe "#each" do
30
+ it "iterates through table tfoots correctly (page context)" do
31
+ browser.tfoots.each_with_index do |tfoot, index|
32
+ tfoot.id.should == browser.tfoot(:index, index).id
28
33
  end
29
34
  end
30
35
 
31
36
  describe "#each" do
32
37
  it "iterates through table tfoots correctly (page context)" do
38
+ count = 0
39
+
33
40
  browser.tfoots.each_with_index do |tfoot, index|
34
41
  tfoot.id.should == browser.tfoot(:index, index).id
42
+
43
+ count += 1
35
44
  end
45
+
46
+ count.should > 0
36
47
  end
37
48
 
38
49
  it "iterates through table tfoots correctly (table context)" do
39
50
  table = browser.table(:index, 0)
51
+ count = 0
52
+
40
53
  table.tfoots.each_with_index do |tfoot, index|
41
54
  tfoot.id.should == table.tfoot(:index, index).id
55
+
56
+ count += 1
42
57
  end
58
+
59
+ count.should > 0
43
60
  end
44
61
  end
45
62
  end
46
-
47
63
  end
@@ -1,53 +1,53 @@
1
1
  # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
2
+ require File.expand_path('spec_helper', File.dirname(__FILE__))
3
3
 
4
- bug "WTR-357", :watir do
5
- describe "TableHeader" do
4
+ describe "TableHeader" do
6
5
 
7
- before :each do
8
- browser.goto(WatirSpec.files + "/tables.html")
9
- end
6
+ before :each do
7
+ browser.goto(WatirSpec.files + "/tables.html")
8
+ end
10
9
 
11
- describe "#exists?" do
12
- it "returns true if the table theader exists (page context)" do
13
- browser.thead(:id, 'tax_headers').should exist
14
- browser.thead(:id, /tax_headers/).should exist
15
- browser.thead(:index, 0).should exist
16
- browser.thead(:xpath, "//thead[@id='tax_headers']").should exist
17
- end
10
+ describe "#exists?" do
11
+ it "returns true if the table theader exists (page context)" do
12
+ browser.thead(:id, 'tax_headers').should exist
13
+ browser.thead(:id, /tax_headers/).should exist
14
+ browser.thead(:index, 0).should exist
15
+ browser.thead(:xpath, "//thead[@id='tax_headers']").should exist
16
+ end
18
17
 
19
- it "returns true if the table theader exists (table context)" do
20
- browser.table(:index, 0).thead(:id, 'tax_headers').should exist
21
- browser.table(:index, 0).thead(:id, /tax_headers/).should exist
22
- browser.table(:index, 0).thead(:index, 0).should exist
23
- browser.table(:index, 0).thead(:xpath, "//thead[@id='tax_headers']").should exist
24
- end
18
+ it "returns true if the table theader exists (table context)" do
19
+ browser.table(:index, 0).thead(:id, 'tax_headers').should exist
20
+ browser.table(:index, 0).thead(:id, /tax_headers/).should exist
21
+ browser.table(:index, 0).thead(:index, 0).should exist
22
+ browser.table(:index, 0).thead(:xpath, "//thead[@id='tax_headers']").should exist
23
+ end
25
24
 
26
- it "returns false if the table theader doesn't exist (page context)" do
27
- browser.thead(:id, 'no_such_id').should_not exist
28
- browser.thead(:id, /no_such_id/).should_not exist
29
- browser.thead(:index, 1337).should_not exist
30
- browser.thead(:xpath, "//thead[@id='no_such_id']").should_not exist
31
- end
25
+ it "returns false if the table theader doesn't exist (page context)" do
26
+ browser.thead(:id, 'no_such_id').should_not exist
27
+ browser.thead(:id, /no_such_id/).should_not exist
28
+ browser.thead(:index, 1337).should_not exist
29
+ browser.thead(:xpath, "//thead[@id='no_such_id']").should_not exist
30
+ end
32
31
 
33
- it "returns false if the table theader doesn't exist (table context)" do
34
- browser.table(:index, 0).thead(:id, 'no_such_id').should_not exist
35
- browser.table(:index, 0).thead(:id, /no_such_id/).should_not exist
36
- browser.table(:index, 0).thead(:index, 1337).should_not exist
37
- browser.table(:index, 0).thead(:xpath, "//thead[@id='no_such_id']").should_not exist
38
- end
32
+ it "returns false if the table theader doesn't exist (table context)" do
33
+ browser.table(:index, 0).thead(:id, 'no_such_id').should_not exist
34
+ browser.table(:index, 0).thead(:id, /no_such_id/).should_not exist
35
+ browser.table(:index, 0).thead(:index, 1337).should_not exist
36
+ browser.table(:index, 0).thead(:xpath, "//thead[@id='no_such_id']").should_not exist
37
+ end
39
38
 
40
- it "raises TypeError when 'what' argument is invalid" do
41
- lambda { browser.thead(:id, 3.14).exists? }.should raise_error(TypeError)
42
- lambda { browser.table(:index, 0).thead(:id, 3.14).exists? }.should raise_error(TypeError)
43
- end
39
+ it "raises TypeError when 'what' argument is invalid" do
40
+ lambda { browser.thead(:id, 3.14).exists? }.should raise_error(TypeError)
41
+ lambda { browser.table(:index, 0).thead(:id, 3.14).exists? }.should raise_error(TypeError)
42
+ end
44
43
 
45
- it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
46
- lambda { browser.thead(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
47
- lambda { browser.table(:index, 0).thead(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
48
- end
44
+ it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
45
+ lambda { browser.thead(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
46
+ lambda { browser.table(:index, 0).thead(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
49
47
  end
48
+ end
50
49
 
50
+ bug "http://github.com/jarib/watir-webdriver/issues/#issue/2", :webdriver do
51
51
  describe "#length" do
52
52
  it "returns the correct number of table bodies (page context)" do
53
53
  browser.thead(:id, 'tax_headers').length.should == 1
@@ -57,7 +57,9 @@ bug "WTR-357", :watir do
57
57
  browser.table(:index, 0).thead(:id, 'tax_headers').length.should == 1
58
58
  end
59
59
  end
60
+ end
60
61
 
62
+ bug "http://github.com/jarib/watir-webdriver/issues/#issue/2", :webdriver do
61
63
  describe "#[]" do
62
64
  it "returns the row at the given index (page context)" do
63
65
  browser.thead(:id, 'tax_headers')[0].id.should == 'thead_row_1'
@@ -71,7 +73,9 @@ bug "WTR-357", :watir do
71
73
  browser.table(:index, 0).thead(:id, 'tax_headers')[0][2].text.should == 'Income tax'
72
74
  end
73
75
  end
76
+ end
74
77
 
78
+ bug "http://github.com/jarib/watir-webdriver/issues/#issue/2", :webdriver do
75
79
  describe "#each" do
76
80
  it "iterates through rows correctly" do
77
81
  theader = browser.table(:index, 0).thead(:id, 'tax_headers')
@@ -82,4 +86,5 @@ bug "WTR-357", :watir do
82
86
  end
83
87
  end
84
88
  end
89
+
85
90
  end
@@ -1,45 +1,63 @@
1
1
  # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
2
+ require File.expand_path('spec_helper', File.dirname(__FILE__))
3
3
 
4
- bug "WTR-357", :watir do
5
- describe "TableHeaders" do
6
- before :each do
7
- browser.goto(WatirSpec.files + "/tables.html")
4
+ describe "TableHeaders" do
5
+ before :each do
6
+ browser.goto(WatirSpec.files + "/tables.html")
7
+ end
8
+
9
+ describe "#length" do
10
+ it "returns the correct number of table theads (page context)" do
11
+ browser.theads.length.should == 1
8
12
  end
9
13
 
10
- describe "#length" do
11
- it "returns the correct number of table theads (page context)" do
12
- browser.theads.length.should == 1
13
- end
14
+ it "returns the correct number of table theads (table context)" do
15
+ browser.table(:index, 0).theads.length.should == 1
16
+ end
17
+ end
14
18
 
15
- it "returns the correct number of table theads (table context)" do
16
- browser.table(:index, 0).theads.length.should == 1
17
- end
19
+ describe "#[]" do
20
+ it "returns the row at the given index (page context)" do
21
+ browser.theads[0].id.should == "tax_headers"
18
22
  end
19
23
 
20
- describe "#[]" do
21
- it "returns the row at the given index (page context)" do
22
- browser.theads[0].id.should == "tax_headers"
23
- end
24
+ it "returns the row at the given index (table context)" do
25
+ browser.table(:index, 0).theads[0].id.should == "tax_headers"
26
+ end
27
+ end
24
28
 
25
- it "returns the row at the given index (table context)" do
26
- browser.table(:index, 0).theads[0].id.should == "tax_headers"
29
+ describe "#each" do
30
+ it "iterates through table theads correctly (page context)" do
31
+ browser.theads.each_with_index do |thead, index|
32
+ thead.id.should == browser.thead(:index, index).id
27
33
  end
28
34
  end
29
35
 
30
36
  describe "#each" do
31
37
  it "iterates through table theads correctly (page context)" do
38
+ count = 0
39
+
32
40
  browser.theads.each_with_index do |thead, index|
33
41
  thead.id.should == browser.thead(:index, index).id
42
+
43
+ count += 1
34
44
  end
45
+
46
+ count.should > 0
35
47
  end
36
48
 
37
49
  it "iterates through table theads correctly (table context)" do
38
50
  table = browser.table(:index, 0)
51
+ count = 0
52
+
39
53
  table.theads.each_with_index do |thead, index|
40
54
  thead.id.should == table.thead(:index, index).id
55
+
56
+ count += 1
41
57
  end
58
+
59
+ count.should > 0
42
60
  end
43
61
  end
44
62
  end
45
- end
63
+ end