Permalink
Browse files

Add RJS#page.reload. [#277 state:resolved]

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
  • Loading branch information...
1 parent 82e96eb commit 30a0ebb3eb9fd4c8e4401bcaa4887eb1ce95defa Sean Huber committed with lifo May 29, 2008
View
@@ -1,5 +1,7 @@
*Edge*
+* Added page.reload functionality. Resolves #277. [Sean Huber]
+
* Fixed Request#remote_ip to only raise hell if the HTTP_CLIENT_IP and HTTP_X_FORWARDED_FOR doesn't match (not just if they're both present) [Mark Imbriaco, Bradford Folkens]
* Allow caches_action to accept a layout option [José Valim]
@@ -868,6 +868,16 @@ def redirect_to(location)
record "window.location.href = #{url.inspect}"
end
+ # Reloads the browser's current +location+ using JavaScript
+ #
+ # Examples:
+ #
+ # # Generates: window.location.reload();
+ # page.reload
+ def reload
+ record 'window.location.reload()'
+ end
+
# Calls the JavaScript +function+, optionally with the given +arguments+.
#
# If a block is given, the block will be passed to a new JavaScriptGenerator;
@@ -347,6 +347,11 @@ def test_redirect_to
@generator.redirect_to("http://www.example.com/welcome?a=b&c=d")
end
+ def test_reload
+ assert_equal 'window.location.reload();',
+ @generator.reload
+ end
+
def test_delay
@generator.delay(20) do
@generator.hide('foo')

0 comments on commit 30a0ebb

Please sign in to comment.