提交 30a0ebb3 编写于 作者: S Sean Huber 提交者: Pratik Naik

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

Signed-off-by: NPratik Naik <pratiknaik@gmail.com>
上级 82e96eb2
*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')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册