parent
ff0a6e769b
commit
6d92f35d98
|
@ -1,7 +1,10 @@
|
||||||
class Capybara::Driver::Webkit
|
class Capybara::Driver::Webkit
|
||||||
class Node < Capybara::Driver::Node
|
class Node < Capybara::Driver::Node
|
||||||
|
NBSP = "\xC2\xA0"
|
||||||
|
NBSP.force_encoding("UTF-8") if NBSP.respond_to?(:force_encoding)
|
||||||
|
|
||||||
def text
|
def text
|
||||||
invoke "text"
|
invoke("text").gsub(NBSP, ' ').gsub(/\s+/u, ' ').strip
|
||||||
end
|
end
|
||||||
|
|
||||||
def [](name)
|
def [](name)
|
||||||
|
|
|
@ -159,6 +159,7 @@ describe Capybara::Driver::Webkit do
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<div class='normalize'>Spaces not normalized </div>
|
||||||
<div id="display_none">
|
<div id="display_none">
|
||||||
<div id="invisible">Can't see me</div>
|
<div id="invisible">Can't see me</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -202,6 +203,10 @@ describe Capybara::Driver::Webkit do
|
||||||
subject.find("//p").first.text.should == "hello"
|
subject.find("//p").first.text.should == "hello"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "normalizes a node's text" do
|
||||||
|
subject.find("//div[contains(@class, 'normalize')]").first.text.should == "Spaces not normalized"
|
||||||
|
end
|
||||||
|
|
||||||
it "returns the current URL" do
|
it "returns the current URL" do
|
||||||
port = subject.instance_variable_get("@rack_server").port
|
port = subject.instance_variable_get("@rack_server").port
|
||||||
subject.current_url.should == "http://127.0.0.1:#{port}/hello/world?success=true"
|
subject.current_url.should == "http://127.0.0.1:#{port}/hello/world?success=true"
|
||||||
|
|
Loading…
Reference in New Issue