Skip to content
Browse files

fix for thoughtbot#52

  • Loading branch information...
1 parent fbcadaf commit 046eeb8dc9a3238aa23fc65fe93bf09e385c4640 Chad Pytel committed Jun 2, 2011
Showing with 13 additions and 3 deletions.
  1. +1 −0 Gemfile.lock
  2. +6 −0 spec/driver_spec.rb
  3. +6 −2 src/Visit.cpp
  4. +0 −1 src/Visit.h
View
1 Gemfile.lock
@@ -50,6 +50,7 @@ PLATFORMS
ruby
DEPENDENCIES
+ capybara (~> 1.0.0.beta1)
capybara-webkit!
rake (~> 0.8.7)
rspec
View
6 spec/driver_spec.rb
@@ -167,6 +167,12 @@
subject.current_url.should =~ /hello%20there/
end
+ it "visits a page with an anchor" do
+ subject.visit("/hello#display_none")
+ p subject.body
+ subject.current_url.should =~ /hello#display_none/
+ end
+
it "returns the source code for the page" do
subject.source.should =~ %r{<html>.*greeting.*}m
end
View
8 src/Visit.cpp
@@ -7,7 +7,12 @@ Visit::Visit(WebPage *page, QObject *parent) : Command(page, parent) {
}
void Visit::start(QStringList &arguments) {
- page()->currentFrame()->setUrl(QUrl(arguments[0]));
+ QUrl requestedUrl = QUrl(arguments[0]);
+ page()->currentFrame()->setUrl(QUrl(requestedUrl));
+ if(requestedUrl.hasFragment()) {
+ // workaround for https://bugs.webkit.org/show_bug.cgi?id=32723
+ page()->currentFrame()->setUrl(QUrl(requestedUrl));
+ }
}
void Visit::loadFinished(bool success) {
@@ -17,4 +22,3 @@ void Visit::loadFinished(bool success) {
emit finished(new Response(success, message));
}
-
View
1 src/Visit.h
@@ -13,4 +13,3 @@ class Visit : public Command {
void loadFinished(bool success);
};
-

0 comments on commit 046eeb8

Please sign in to comment.
Something went wrong with that request. Please try again.