fix for issue #1524

This commit is contained in:
Thomas Walpole 2015-05-28 10:51:23 -07:00
parent 3ae284460b
commit ae2becd025
5 changed files with 9 additions and 5 deletions

View File

@ -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

View File

@ -96,7 +96,7 @@ class Capybara::RackTest::Browser
end end
def title def title
dom.xpath("//title").text dom.title
end end
protected protected

View File

@ -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

View File

@ -1 +1,4 @@
<title>Test Title</title> <title>Test Title</title>
<body>
<svg><title>abcdefg</title></svg>
</body>

View File

@ -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>