fix for issue #1524
This commit is contained in:
parent
3ae284460b
commit
ae2becd025
|
@ -146,7 +146,7 @@ module Capybara
|
||||||
end
|
end
|
||||||
|
|
||||||
def title
|
def title
|
||||||
native.xpath("//title").first.text
|
native.title
|
||||||
end
|
end
|
||||||
|
|
||||||
def inspect
|
def inspect
|
||||||
|
|
|
@ -96,7 +96,7 @@ class Capybara::RackTest::Browser
|
||||||
end
|
end
|
||||||
|
|
||||||
def title
|
def title
|
||||||
dom.xpath("//title").text
|
dom.title
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
Capybara::SpecHelper.spec '#title' do
|
Capybara::SpecHelper.spec '#title' do
|
||||||
|
|
||||||
it "should print the title of the page" do
|
it "should get the title of the page" do
|
||||||
@session.visit('/with_title')
|
@session.visit('/with_title')
|
||||||
expect(@session.title).to eq('Test Title')
|
expect(@session.title).to eq('Test Title')
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with css as default selector" do
|
context "with css as default selector" do
|
||||||
before { Capybara.default_selector = :css }
|
before { Capybara.default_selector = :css }
|
||||||
it "should print the title of the page" do
|
it "should get the title of the page" do
|
||||||
@session.visit('/with_title')
|
@session.visit('/with_title')
|
||||||
expect(@session.title).to eq('Test Title')
|
expect(@session.title).to eq('Test Title')
|
||||||
end
|
end
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
<title>Test Title</title>
|
<title>Test Title</title>
|
||||||
|
<body>
|
||||||
|
<svg><title>abcdefg</title></svg>
|
||||||
|
</body>
|
|
@ -9,6 +9,7 @@ RSpec.describe Capybara do
|
||||||
<title>simple_node</title>
|
<title>simple_node</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<svg><title>not document title</title></svg>
|
||||||
<div id="page">
|
<div id="page">
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<h1 data="fantastic">Totally awesome</h1>
|
<h1 data="fantastic">Totally awesome</h1>
|
||||||
|
|
Loading…
Reference in New Issue