1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

rows option has been removed in xpath gem

This commit is contained in:
Jonas Nicklas 2012-01-02 12:17:15 +01:00
parent 0a47692c0a
commit 6de89c1038
5 changed files with 17 additions and 138 deletions

View file

@ -427,7 +427,6 @@ module Capybara
# and the text needs to match exactly.
#
# @param [String] locator The id or caption of a table
# @option options [Array[Array[String]]] :rows A set of rows the table should contain
# @return [Boolean] Whether it exist
#
def has_table?(locator, options={})
@ -446,6 +445,8 @@ module Capybara
has_no_selector?(:table, locator, options)
end
private
##
#
# Normalizes whitespace space by stripping leading and trailing

View file

@ -69,7 +69,7 @@ module Capybara
def split_options(options)
xpath_options = options.dup
property_options = PROPERTY_OPTION_KEYS.inject({}) do |opts, key|
opts[key] = xpath_options.delete(key) if xpath_options[key]
opts[key] = xpath_options.delete(key) if xpath_options.has_key?(key)
opts
end

View file

@ -4,45 +4,14 @@ shared_examples_for "has_table" do
@session.visit('/tables')
end
it "should be true if the field is on the page" do
@session.should have_table('Deaths')
it "should be true if the table is on the page" do
@session.should have_table('Villain')
@session.should have_table('villain_table')
end
it "should be false if the field is not on the page" do
it "should be false if the table is not on the page" do
@session.should_not have_table('Monkey')
end
context 'with rows' do
it "should be true if a table with the given rows is on the page" do
@session.should have_table('Ransom', :rows => [['2007', '$300', '$100']])
@session.should have_table('Deaths', :rows => [['2007', '66', '7'], ['2008', '123', '12']])
end
it "should be true if the given rows are incomplete" do
@session.should have_table('Ransom', :rows => [['$300', '$100']])
end
it "should be false if the given table is not on the page" do
@session.should_not have_table('Does not exist', :selected => 'John')
end
it "should be false if the given rows contain incorrect elements" do
@session.should_not have_table('Ransom', :rows => [['2007', '$1000000000', '$100']])
end
it "should be false if the given rows are incorrectly ordered" do
@session.should_not have_table('Ransom', :rows => [['2007', '$100', '$300']])
end
it "should be false if the only some of the given rows are correct" do
@session.should_not have_table('Deaths', :rows => [['2007', '66', '7'], ['2007', '99999999', '12']])
end
it "should be false if the given rows are out of order" do
@session.should_not have_table('Deaths', :rows => [['2007', '123', '12'], ['2007', '66', '7']])
end
end
end
describe '#has_no_table?' do
@ -50,45 +19,14 @@ shared_examples_for "has_table" do
@session.visit('/tables')
end
it "should be false if the field is on the page" do
@session.should_not have_no_table('Deaths')
it "should be false if the table is on the page" do
@session.should_not have_no_table('Villain')
@session.should_not have_no_table('villain_table')
end
it "should be true if the field is not on the page" do
it "should be true if the table is not on the page" do
@session.should have_no_table('Monkey')
end
context 'with rows' do
it "should be false if a table with the given rows is on the page" do
@session.should_not have_no_table('Ransom', :rows => [['2007', '$300', '$100']])
@session.should_not have_no_table('Deaths', :rows => [['2007', '66', '7'], ['2008', '123', '12']])
end
it "should be false if the given rows are incomplete" do
@session.should_not have_no_table('Ransom', :rows => [['$300', '$100']])
end
it "should be true if the given table is not on the page" do
@session.should have_no_table('Does not exist', :selected => 'John')
end
it "should be true if the given rows contain incorrect elements" do
@session.should have_no_table('Ransom', :rows => [['2007', '$1000000000', '$100']])
end
it "should be true if the given rows are incorrectly ordered" do
@session.should have_no_table('Ransom', :rows => [['2007', '$100', '$300']])
end
it "should be true if the only some of the given rows are correct" do
@session.should have_no_table('Deaths', :rows => [['2007', '66', '7'], ['2007', '99999999', '12']])
end
it "should be true if the given rows are out of order" do
@session.should have_no_table('Deaths', :rows => [['2007', '123', '12'], ['2007', '66', '7']])
end
end
end
end

View file

@ -60,63 +60,3 @@
</tr>
</table>
</form>
<table>
<caption>Ransom</caption>
<thead>
<tr>
<th>Year</th>
<th>Governmental</th>
<th>Private</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">2007</th>
<td>$300</td>
<td>$100</td>
</tr>
<tr>
<th scope="row">2008</th>
<td>$123</td>
<td>$897</td>
</tr>
<tr>
<th scope="row">2009</th>
<td>$543</td>
<td>$99</td>
</tr>
</tbody>
</table>
<table>
<caption>Deaths</caption>
<thead>
<tr>
<th>Year</th>
<th>Sharks with lasers</th>
<th>Flaming volcano</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">2007</th>
<td>66</td>
<td>7</td>
</tr>
<tr>
<th scope="row">2008</th>
<td>123</td>
<td>12</td>
</tr>
<tr>
<th scope="row">2009</th>
<td>913</td>
<td>13</td>
</tr>
</tbody>
</table>

2
xpath

@ -1 +1 @@
Subproject commit a0d00a09c39cfef6a807bfdd4d2c8a20bb0d2401
Subproject commit 422ff063e2a46869574b764e405c1e5573b14ff2