diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-09-04 00:33:45 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-09-04 00:33:45 +0000 |
commit | 258bacbf8221dc20a83cfaa03decfb522bda3ffb (patch) | |
tree | eb2a24f5af367c5a4058f169e500edd27d03576f /actionpack/test/template/url_helper_test.rb | |
parent | 9e803e081a04a817c109fa42360ebf020d23a342 (diff) | |
download | rails-258bacbf8221dc20a83cfaa03decfb522bda3ffb.tar.gz rails-258bacbf8221dc20a83cfaa03decfb522bda3ffb.tar.bz2 rails-258bacbf8221dc20a83cfaa03decfb522bda3ffb.zip |
Added :popup option to UrlHelper#link_to #1996 [gabriel.gironda@gmail.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2129 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/template/url_helper_test.rb')
-rw-r--r-- | actionpack/test/template/url_helper_test.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/actionpack/test/template/url_helper_test.rb b/actionpack/test/template/url_helper_test.rb index 8367108fab..73d87f6956 100644 --- a/actionpack/test/template/url_helper_test.rb +++ b/actionpack/test/template/url_helper_test.rb @@ -62,6 +62,32 @@ class UrlHelperTest < Test::Unit::TestCase ) end + def test_link_tag_with_popup + assert_equal( + "<a href=\"http://www.example.com\" onclick=\"window.open(this.href);return false;\">Hello</a>", + link_to("Hello", "http://www.example.com", :popup => true) + ) + assert_equal( + "<a href=\"http://www.example.com\" onclick=\"window.open(this.href);return false;\">Hello</a>", + link_to("Hello", "http://www.example.com", :popup => 'true') + ) + assert_equal( + "<a href=\"http://www.example.com\" onclick=\"window.open(this.href,'window_name','width=300,height=300');return false;\">Hello</a>", + link_to("Hello", "http://www.example.com", :popup => ['window_name', 'width=300,height=300']) + ) + end + + def test_link_tag_with_popup_and_javascript_confirm + assert_equal( + "<a href=\"http://www.example.com\" onclick=\"if (confirm('Fo\\' sho\\'?')) { window.open(this.href); };return false;\">Hello</a>", + link_to("Hello", "http://www.example.com", { :popup => true, :confirm => "Fo' sho'?" }) + ) + assert_equal( + "<a href=\"http://www.example.com\" onclick=\"if (confirm('Are you serious?')) { window.open(this.href,'window_name','width=300,height=300'); };return false;\">Hello</a>", + link_to("Hello", "http://www.example.com", { :popup => ['window_name', 'width=300,height=300'], :confirm => "Are you serious?" }) + ) + end + def test_link_to_unless assert_equal "Showing", link_to_unless(true, "Showing", :action => "show", :controller => "weblog") assert "<a href=\"http://www.example.com\">Listing</a>", link_to_unless(false, "Listing", :action => "list", :controller => "weblog") |