Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
296 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
Capybara::SpecHelper.spec '#accept_alert', :requires => [:modals] do | ||
before do | ||
@session.visit('/with_js') | ||
end | ||
|
||
it "should accept the alert" do | ||
@session.accept_alert do | ||
@session.click_link('Open alert') | ||
end | ||
expect(@session).to have_xpath("//a[@id='open-alert' and @opened='true']") | ||
end | ||
|
||
it "should return the message presented" do | ||
message = @session.accept_alert do | ||
@session.click_link('Open alert') | ||
end | ||
expect(message).to eq('Alert opened') | ||
end | ||
|
||
context "with an asynchronous alert" do | ||
it "should accept the alert" do | ||
@session.accept_alert do | ||
@session.click_link('Open delayed alert') | ||
end | ||
expect(@session).to have_xpath("//a[@id='open-delayed-alert' and @opened='true']") | ||
end | ||
|
||
it "should return the message presented" do | ||
message = @session.accept_alert do | ||
@session.click_link('Open delayed alert') | ||
end | ||
expect(message).to eq('Delayed alert opened') | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Capybara::SpecHelper.spec '#accept_confirm', :requires => [:modals] do | ||
before do | ||
@session.visit('/with_js') | ||
end | ||
|
||
it "should accept the confirm" do | ||
@session.accept_confirm do | ||
@session.click_link('Open confirm') | ||
end | ||
expect(@session).to have_xpath("//a[@id='open-confirm' and @confirmed='true']") | ||
end | ||
|
||
it "should return the message presented" do | ||
message = @session.accept_confirm do | ||
@session.click_link('Open confirm') | ||
end | ||
expect(message).to eq('Confirm opened') | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Capybara::SpecHelper.spec '#accept_prompt', :requires => [:modals] do | ||
before do | ||
@session.visit('/with_js') | ||
end | ||
|
||
it "should accept the prompt with no message" do | ||
@session.accept_prompt do | ||
@session.click_link('Open prompt') | ||
end | ||
expect(@session).to have_xpath("//a[@id='open-prompt' and @response='']") | ||
end | ||
|
||
it "should return the message presented" do | ||
message = @session.accept_prompt do | ||
@session.click_link('Open prompt') | ||
end | ||
expect(message).to eq('Prompt opened') | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Capybara::SpecHelper.spec '#dismiss_confirm', :requires => [:modals] do | ||
before do | ||
@session.visit('/with_js') | ||
end | ||
|
||
it "should dismiss the confirm" do | ||
@session.dismiss_confirm do | ||
@session.click_link('Open confirm') | ||
end | ||
expect(@session).to have_xpath("//a[@id='open-confirm' and @confirmed='false']") | ||
end | ||
|
||
it "should return the message presented" do | ||
message = @session.dismiss_confirm do | ||
@session.click_link('Open confirm') | ||
end | ||
expect(message).to eq('Confirm opened') | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Capybara::SpecHelper.spec '#dismiss_prompt', :requires => [:modals] do | ||
before do | ||
@session.visit('/with_js') | ||
end | ||
|
||
it "should dismiss the prompt" do | ||
@session.dismiss_prompt do | ||
@session.click_link('Open prompt') | ||
end | ||
expect(@session).to have_xpath("//a[@id='open-prompt' and @response='dismissed']") | ||
end | ||
|
||
it "should return the message presented" do | ||
message = @session.dismiss_prompt do | ||
@session.click_link('Open prompt') | ||
end | ||
expect(message).to eq('Prompt opened') | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Capybara::SpecHelper.spec '#respond_to_prompt', :requires => [:modals] do | ||
before do | ||
@session.visit('/with_js') | ||
end | ||
|
||
it "should accept the prompt" do | ||
@session.respond_to_prompt 'the response' do | ||
@session.click_link('Open prompt') | ||
end | ||
expect(@session).to have_xpath("//a[@id='open-prompt' and @response='the response']") | ||
end | ||
|
||
it "should return the message presented" do | ||
message = @session.respond_to_prompt 'the response' do | ||
@session.click_link('Open prompt') | ||
end | ||
expect(message).to eq('Prompt opened') | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters