aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/upload_progress_helper_testx.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/template/upload_progress_helper_testx.rb')
-rw-r--r--actionpack/test/template/upload_progress_helper_testx.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/actionpack/test/template/upload_progress_helper_testx.rb b/actionpack/test/template/upload_progress_helper_testx.rb
index b22b6a67b4..7a4fb18f04 100644
--- a/actionpack/test/template/upload_progress_helper_testx.rb
+++ b/actionpack/test/template/upload_progress_helper_testx.rb
@@ -57,14 +57,14 @@ class UploadProgressHelperTest < Test::Unit::TestCase
end
def test_upload_status_tag
- assert_equal(
+ assert_dom_equal(
'<div class="progressBar" id="UploadProgressBar0"><div class="border"><div class="background"><div class="foreground"></div></div></div></div><div class="uploadStatus" id="UploadStatus0"></div>',
upload_status_tag
)
end
def test_upload_status_text_tag
- assert_equal(
+ assert_dom_equal(
'<div class="my-upload" id="my-id">Starting</div>',
upload_status_text_tag('Starting', :class => 'my-upload', :id => 'my-id')
)
@@ -104,31 +104,31 @@ class UploadProgressHelperTest < Test::Unit::TestCase
end
def test_finish_upload_status
- assert_equal(
+ assert_dom_equal(
"<html><head><script language=\"javascript\" type=\"text/javascript\">function finish() { if (parent.document.uploadStatus0) { parent.document.uploadStatus0.stop();\n }\n }</script></head><body onload=\"finish()\"></body></html>",
finish_upload_status
)
- assert_equal(
+ assert_dom_equal(
"<html><head><script language=\"javascript\" type=\"text/javascript\">function finish() { if (parent.document.uploadStatus0) { parent.document.uploadStatus0.stop(123);\n }\n }</script></head><body onload=\"finish()\"></body></html>",
finish_upload_status(:client_js_argument => 123)
)
- assert_equal(
+ assert_dom_equal(
"<html><head><script language=\"javascript\" type=\"text/javascript\">function finish() { if (parent.document.uploadStatus0) { parent.document.uploadStatus0.stop();\nparent.location.replace('/redirected/');\n }\n }</script></head><body onload=\"finish()\"></body></html>",
finish_upload_status(:redirect_to => '/redirected/')
)
end
def test_form_tag_with_upload_progress
- assert_equal(
+ assert_dom_equal(
"<form action=\"http://www.example.com\" enctype=\"multipart/form-data\" method=\"post\" onsubmit=\"if (this.action.indexOf('upload_id') &lt; 0){ this.action += '?upload_id=1'; }this.target = 'UploadTarget1';$('UploadStatus1').innerHTML='Upload starting...'; if($('UploadProgressBar1')){$('UploadProgressBar1').firstChild.firstChild.style.width='0%'}; if (document.uploadStatus1) { document.uploadStatus1.stop(); }document.uploadStatus1 = new Ajax.PeriodicalUpdater('UploadStatus1','http://www.example.com', Object.extend({asynchronous:true, evalScripts:true, onComplete:function(request){$('UploadStatus1').innerHTML='A message';if($('UploadProgressBar1')){$('UploadProgressBar1').firstChild.firstChild.style.width='100%'};document.uploadStatus1 = null}},{decay:1.8,frequency:2.0})); return true\"><iframe id=\"UploadTarget1\" name=\"UploadTarget1\" src=\"\" style=\"width:0px;height:0px;border:0\"></iframe>",
form_tag_with_upload_progress
)
end
def test_form_tag_with_upload_progress_custom
- assert_equal(
+ assert_dom_equal(
"<form action=\"http://www.example.com\" enctype=\"multipart/form-data\" method=\"post\" onsubmit=\"if (this.action.indexOf('upload_id') &lt; 0){ this.action += '?upload_id=5'; }this.target = 'awindow';$('UploadStatus0').innerHTML='Upload starting...'; if($('UploadProgressBar0')){$('UploadProgressBar0').firstChild.firstChild.style.width='0%'}; alert('foo'); if (document.uploadStatus0) { document.uploadStatus0.stop(); }document.uploadStatus0 = new Ajax.PeriodicalUpdater('UploadStatus0','http://www.example.com', Object.extend({asynchronous:true, evalScripts:true, onComplete:function(request){$('UploadStatus0').innerHTML='A message';if($('UploadProgressBar0')){$('UploadProgressBar0').firstChild.firstChild.style.width='100%'};document.uploadStatus0 = null; alert('bar')}},{decay:7,frequency:6})); return true\" target=\"awindow\">",
form_tag_with_upload_progress({:upload_id => 5}, {:begin => "alert('foo')", :finish => "alert('bar')", :frequency => 6, :decay => 7, :target => 'awindow'})
)