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:
parent
0a47692c0a
commit
6de89c1038
5 changed files with 17 additions and 138 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1,48 +1,17 @@
|
|||
shared_examples_for "has_table" do
|
||||
shared_examples_for "has_table" do
|
||||
describe '#has_table?' do
|
||||
before 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
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<form action="/form" method="post">
|
||||
<table id="agent_table">
|
||||
<caption>Agent</caption>
|
||||
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="form_agent_name">Name</label>
|
||||
|
@ -10,7 +10,7 @@
|
|||
<input type="text" name="form[agent_name]" value="James" id="form_agent_name"/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input type="submit" value="Create"/>
|
||||
|
@ -22,7 +22,7 @@
|
|||
<form action="/form" method="post">
|
||||
<table id="girl_table">
|
||||
<caption>Girl</caption>
|
||||
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="form_girl_name">Name</label>
|
||||
|
@ -31,7 +31,7 @@
|
|||
<input type="text" name="form[girl_name]" value="Vesper" id="form_girl_name"/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input type="submit" value="Create"/>
|
||||
|
@ -43,7 +43,7 @@
|
|||
<form action="/form" method="post">
|
||||
<table id="villain_table">
|
||||
<caption>Villain</caption>
|
||||
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="form_villain_name">Name</label>
|
||||
|
@ -52,7 +52,7 @@
|
|||
<input type="text" name="form[villain_name]" value="Ernst" id="form_villain_name"/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input type="submit" value="Create"/>
|
||||
|
@ -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
2
xpath
|
@ -1 +1 @@
|
|||
Subproject commit a0d00a09c39cfef6a807bfdd4d2c8a20bb0d2401
|
||||
Subproject commit 422ff063e2a46869574b764e405c1e5573b14ff2
|
Loading…
Reference in a new issue