From 83870b15611057ccec8d3ce891a96a3e8c5efdf1 Mon Sep 17 00:00:00 2001
From: Christian Pekeler
Date: Sun, 2 Mar 2014 16:46:23 -0700
Subject: [PATCH 1/2] Added a new page for manual tests (at
localhost:4567/manual) which are tricky or impossible to automate. This new
page has just three tests, one to demonstrate that non-remote links don't
show the disable-with text when clicked on Safari and Chrome, and two to
demonstrate that non-remote links around a div stop working in IE if they
have a disable-with attribute.
---
test/server.rb | 18 ++++++++++++++----
test/views/manual.erb | 30 ++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+), 4 deletions(-)
create mode 100644 test/views/manual.erb
diff --git a/test/server.rb b/test/server.rb
index f15a91bf..59bcf4f5 100644
--- a/test/server.rb
+++ b/test/server.rb
@@ -6,19 +6,19 @@
use Rack::Static, :urls => ["/src"], :root => File.expand_path('..', settings.root)
helpers do
- def jquery_link version
+ def jquery_link(version, path="/")
if params[:version] == version
"[#{version}]"
else
- "#{version}"
+ "#{version}"
end
end
- def cdn_link cdn
+ def cdn_link(cdn, path="/")
if params[:cdn] == cdn
"[#{cdn}]"
else
- "#{cdn}"
+ "#{cdn}"
end
end
@@ -53,6 +53,16 @@ def jquery_versions
erb :index
end
+get '/manual' do
+ params[:version] ||= '1.11.0'
+ params[:cdn] ||= 'jquery'
+ params[:sleep] ||= 0
+ sleep params[:sleep].to_i
+ @extra_params = "version=#{params[:version]}&cdn=#{params[:cdn]}"
+ erb :manual
+end
+
+
[:get, :post, :put, :delete].each do |method|
send(method, '/echo') {
data = { :params => params }.update(request.env)
diff --git a/test/views/manual.erb b/test/views/manual.erb
new file mode 100644
index 00000000..700cf288
--- /dev/null
+++ b/test/views/manual.erb
@@ -0,0 +1,30 @@
+<% @title = "jquery-ujs manual test" %>
+
+
+ CDN:
+ <%= cdn_link('jquery', '/manual') %> •
+ <%= cdn_link('googleapis', '/manual') %>
+
+
+ jQuery version:
+
+ <% jquery_versions.each do |v| %>
+ <%= ' • ' if v != jquery_versions.first %>
+ <%= jquery_link(v, '/manual') %>
+ <% end %>
+ <%= (' • ' + jquery_link('edge', '/manual')) if File.exist?(settings.root + '/public/vendor/jquery.js') %>
+
+
+We just haven't figured out how to automate these yet.
+
+data-disable
+Clicking these links will reload this page with a short delay. During the delay, each link should become disabled and its text should change to "Please wait..."
+
+page loaded at:
+
\ No newline at end of file
From 64b567ee76ff21fa64914e34a1cceb6208400ed2 Mon Sep 17 00:00:00 2001
From: Christian Pekeler
Date: Sun, 2 Mar 2014 21:09:39 -0700
Subject: [PATCH 2/2] added a couple more tests to make sure inline-js and
target attributes still work on non-remote disable-with links
---
test/views/manual.erb | 2 ++
1 file changed, 2 insertions(+)
diff --git a/test/views/manual.erb b/test/views/manual.erb
index 700cf288..2c76ff65 100644
--- a/test/views/manual.erb
+++ b/test/views/manual.erb
@@ -23,6 +23,8 @@
link
div in link disabled with text
div in link disabled with div
+ link with inline handler which should turn body green
+ link with _blank target (_top would be more realistic but is more effort to test) should open in new window
page loaded at: