Created
May 16, 2013 22:41
-
-
Save ekashida/5595665 to your computer and use it in GitHub Desktop.
The following diff is between the branch developed against in https://github.com/yui/yui3/pull/648 and https://github.com/yui/yui3/pull/721 using the following command: git diff origin/refactor-get-tests origin/get-tests src/get/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/get/tests/unit/assets/get-test.js b/src/get/tests/unit/assets/get-test.js | |
index feb137b..0b6cb09 100644 | |
--- a/src/get/tests/unit/assets/get-test.js | |
+++ b/src/get/tests/unit/assets/get-test.js | |
@@ -2,8 +2,6 @@ YUI.add('get-test', function (Y) { | |
Y.GetTests = new Y.Test.Suite("Get"); | |
- Y.GetTests.TEST_FILES_BASE = "getfiles/"; | |
- | |
var ArrayAssert = Y.ArrayAssert, | |
Assert = Y.Assert, | |
ObjectAssert = Y.ObjectAssert, | |
@@ -26,6 +24,9 @@ YUI.add('get-test', function (Y) { | |
jsFailure: !((ua.ie && ua.ie < 9) || (ua.opera && ua.compareVersions(ua.opera, 11.6) < 0) || (ua.webkit && ua.compareVersions(ua.webkit, 530.17) < 0)) | |
}, | |
+ // echoecho delay in seconds | |
+ DELAY = Y.config.echoechoDelay || 0, | |
+ | |
// JS content | |
JS_A = 'G_SCRIPTS.push("a.js")', | |
JS_B = 'G_SCRIPTS.push("b.js")', | |
@@ -74,12 +75,12 @@ YUI.add('get-test', function (Y) { | |
Y.ObjectAssert.areEqual(o2, o1, msg); | |
} | |
- // Appends a counter to the timestamp for when we generate timestamps too | |
- // fast. | |
function unique() { | |
if (!unique.counter) { | |
unique.counter = 0; | |
} | |
+ // Append a simple counter to guarantee uniqueness in case we invoke | |
+ // this function too fast. | |
unique.counter += 1; | |
return new Date().getTime() + '-' + unique.counter; | |
} | |
@@ -90,13 +91,16 @@ YUI.add('get-test', function (Y) { | |
return url + 'bust=' + unique(); | |
} | |
- function getUniqueEchoechoJs(content, config) { | |
- var delay, | |
- url; | |
+ /** | |
+ Generates a unique echoecho JavaScript URL. | |
+ | |
+ @param {String} content The JavaScript to respond with. | |
+ @param {String} delay The number of seconds to delay the response. | |
+ **/ | |
+ function getUniqueEchoechoJs(content, delay) { | |
+ var url; | |
- config = config || {}; | |
- delay = config.delay || 0; | |
- time = new Date().getTime(); | |
+ delay = delay || 0; | |
content = content || 'console.log("' + unique() + '")'; | |
url = 'echo/delay/' + delay + '/get' | |
@@ -106,12 +110,16 @@ YUI.add('get-test', function (Y) { | |
return randUrl(url); | |
} | |
- function getUniqueEchoechoCss(content, config) { | |
- var delay, | |
- url; | |
+ /** | |
+ Generates a unique echoecho CSS URL. | |
- config = config || {}; | |
- delay = config.delay || 0; | |
+ @param {String} content The CSS to respond with. | |
+ @param {String} delay The number of seconds to delay the response. | |
+ **/ | |
+ function getUniqueEchoechoCss(content, delay) { | |
+ var url; | |
+ | |
+ delay = delay || 0; | |
content = content || '.foo{}'; | |
url = 'echo/delay/' + delay + '/get' | |
@@ -173,7 +181,7 @@ YUI.add('get-test', function (Y) { | |
success:0, | |
failure:0 | |
}; | |
- var url = getUniqueEchoechoJs(JS_A); | |
+ var url = getUniqueEchoechoJs(JS_A, DELAY); | |
var trans = Y.Get.script(url, { | |
data: {a:1, b:2, c:3}, | |
@@ -214,16 +222,17 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'test: single script, failure': function() { | |
var test = this; | |
+ | |
var counts = { | |
success:0, | |
failure:0 | |
}; | |
- var url = 'bogus.js'; | |
+ var url = randUrl('echo/status/404'); | |
var trans = Y.Get.script(url, { | |
data: {a:1, b:2, c:3}, | |
@@ -255,21 +264,27 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'test: single script timeout callback': function() { | |
var test = this, | |
- url = getUniqueEchoechoJs(null, { delay: 1 }); | |
- trans = Y.Get.load(url, { | |
+ // The following delayed JS response should not have any | |
+ // side-effects to avoid interfering with other tests. | |
+ url = getUniqueEchoechoJs( | |
+ 'console.log("1s delayed response")', | |
+ 1 // 1s | |
+ ); | |
+ | |
+ trans = Y.Get.script(url, { | |
- timeout: 1, | |
+ timeout: 1, // 1ms | |
onTimeout: function(e) { | |
test.resume(function() { | |
Assert.areSame('Timeout', e.errors[0].error, 'Failure message is not a timeout message'); | |
- test.wait(); | |
+ test.wait(30000); | |
}); | |
}, | |
@@ -286,7 +301,7 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- test.wait(); | |
+ test.wait(30000); | |
}, | |
'test: single script success, end': function() { | |
@@ -296,7 +311,7 @@ YUI.add('get-test', function (Y) { | |
failure:0, | |
end:0 | |
}; | |
- var url = getUniqueEchoechoJs(JS_A); | |
+ var url = getUniqueEchoechoJs(JS_A, DELAY); | |
var trans = Y.Get.script(url, { | |
data: {a:1, b:2, c:3}, | |
@@ -332,7 +347,7 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'test: single script failure, end': function() { | |
@@ -342,7 +357,7 @@ YUI.add('get-test', function (Y) { | |
failure:0, | |
end:0 | |
}; | |
- var url = 'bogus.js'; | |
+ var url = randUrl('echo/status/404'); | |
var trans = Y.Get.script(url, { | |
data: {a:1, b:2, c:3}, | |
@@ -376,7 +391,7 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'test: multiple scripts, success': function() { | |
@@ -387,9 +402,9 @@ YUI.add('get-test', function (Y) { | |
failure:0 | |
}; | |
var urls = [ | |
- getUniqueEchoechoJs(JS_B, { delay: '0-1' }), | |
- getUniqueEchoechoJs(JS_A, { delay: '0-1' }), | |
- getUniqueEchoechoJs(JS_C, { delay: '0-1' }) | |
+ getUniqueEchoechoJs(JS_B, DELAY), | |
+ getUniqueEchoechoJs(JS_A, DELAY), | |
+ getUniqueEchoechoJs(JS_C, DELAY) | |
]; | |
var trans = Y.Get.script(urls, { | |
@@ -430,7 +445,7 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'test: multiple scripts, one failure': function() { | |
@@ -440,9 +455,9 @@ YUI.add('get-test', function (Y) { | |
failure:0 | |
}; | |
var urls = [ | |
- getUniqueEchoechoJs(JS_A, { delay: '0-1' }), | |
- 'bogus.js', | |
- getUniqueEchoechoJs(JS_C, { delay: '0-1' }) | |
+ getUniqueEchoechoJs(JS_A, DELAY), | |
+ randUrl('echo/status/404'), | |
+ getUniqueEchoechoJs(JS_C, DELAY) | |
]; | |
var trans = Y.Get.script(urls, { | |
@@ -475,7 +490,7 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'test: multiple scripts, success, end': function() { | |
@@ -487,9 +502,9 @@ YUI.add('get-test', function (Y) { | |
end:0 | |
}; | |
var urls = [ | |
- getUniqueEchoechoJs(JS_C, { delay: '0-1' }), | |
- getUniqueEchoechoJs(JS_B, { delay: '0-1' }), | |
- getUniqueEchoechoJs(JS_A, { delay: '0-1' }) | |
+ getUniqueEchoechoJs(JS_C, DELAY), | |
+ getUniqueEchoechoJs(JS_B, DELAY), | |
+ getUniqueEchoechoJs(JS_A, DELAY) | |
]; | |
var trans = Y.Get.script(urls, { | |
@@ -533,7 +548,7 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'test: multiple scripts, failure, end': function() { | |
@@ -544,9 +559,9 @@ YUI.add('get-test', function (Y) { | |
end:0 | |
}; | |
var urls = [ | |
- getUniqueEchoechoJs(JS_A, { delay: '0-1' }), | |
- 'bogus.js', | |
- getUniqueEchoechoJs(JS_C, { delay: '0-1' }) | |
+ getUniqueEchoechoJs(JS_A, DELAY), | |
+ randUrl('echo/status/404'), | |
+ getUniqueEchoechoJs(JS_C, DELAY) | |
]; | |
var trans = Y.Get.script(urls, { | |
@@ -582,7 +597,7 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'test: async multiple scripts, success': function() { | |
@@ -593,9 +608,9 @@ YUI.add('get-test', function (Y) { | |
failure:0 | |
}; | |
var urls = [ | |
- getUniqueEchoechoJs(JS_A, { delay: '0-1' }), | |
- getUniqueEchoechoJs(JS_B, { delay: '0-1' }), | |
- getUniqueEchoechoJs(JS_C, { delay: '0-1' }) | |
+ getUniqueEchoechoJs(JS_A, DELAY), | |
+ getUniqueEchoechoJs(JS_B, DELAY), | |
+ getUniqueEchoechoJs(JS_C, DELAY) | |
]; | |
var trans = Y.Get.script(urls, { | |
@@ -636,7 +651,7 @@ YUI.add('get-test', function (Y) { | |
async:true | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'test: async multiple scripts, success, end': function() { | |
@@ -647,9 +662,9 @@ YUI.add('get-test', function (Y) { | |
end:0 | |
}; | |
var urls = [ | |
- getUniqueEchoechoJs(JS_A, { delay: '0-1' }), | |
- getUniqueEchoechoJs(JS_B, { delay: '0-1' }), | |
- getUniqueEchoechoJs(JS_C, { delay: '0-1' }) | |
+ getUniqueEchoechoJs(JS_C, DELAY), | |
+ getUniqueEchoechoJs(JS_A, DELAY), | |
+ getUniqueEchoechoJs(JS_B, DELAY) | |
]; | |
var trans = Y.Get.script(urls, { | |
@@ -687,7 +702,7 @@ YUI.add('get-test', function (Y) { | |
async:true | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'test: async multiple script, failure, end': function() { | |
@@ -698,9 +713,9 @@ YUI.add('get-test', function (Y) { | |
end:0 | |
}; | |
var urls = [ | |
- getUniqueEchoechoJs(JS_A, { delay: '0-1' }), | |
- 'bogus.js', | |
- getUniqueEchoechoJs(JS_C, { delay: '0-1' }) | |
+ getUniqueEchoechoJs(JS_A, DELAY), | |
+ randUrl('echo/status/404'), | |
+ getUniqueEchoechoJs(JS_C, DELAY) | |
]; | |
var trans = Y.Get.script(urls, { | |
@@ -737,12 +752,12 @@ YUI.add('get-test', function (Y) { | |
async:true | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'test: insertBefore, single' : function() { | |
var test = this; | |
- var url = getUniqueEchoechoJs(); | |
+ var url = getUniqueEchoechoJs(JS_A, DELAY); | |
test.createInsertBeforeNode(); | |
@@ -768,15 +783,14 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'test: insertBefore, multiple' : function() { | |
var test = this; | |
var urls = [ | |
- getUniqueEchoechoJs(null, { delay: '0-1' }), | |
- getUniqueEchoechoJs(null, { delay: '0-1' }), | |
- getUniqueEchoechoJs(null, { delay: '0-1' }) | |
+ getUniqueEchoechoJs(JS_A, DELAY), | |
+ getUniqueEchoechoJs(JS_B, DELAY) | |
]; | |
test.createInsertBeforeNode(); | |
@@ -806,14 +820,14 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'test: async, insertBefore, multiple' : function() { | |
var test = this; | |
var urls = [ | |
- getUniqueEchoechoJs(null, { delay: '0-1' }), | |
- getUniqueEchoechoJs(null, { delay: '0-1' }) | |
+ getUniqueEchoechoJs(JS_A, DELAY), | |
+ getUniqueEchoechoJs(JS_B, DELAY) | |
]; | |
test.createInsertBeforeNode(); | |
@@ -845,12 +859,12 @@ YUI.add('get-test', function (Y) { | |
async:true | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'test: charset, single' : function() { | |
var test = this; | |
- var url = getUniqueEchoechoJs(); | |
+ var url = getUniqueEchoechoJs(JS_A, DELAY); | |
var trans = Y.Get.script(url, { | |
charset: "ISO-8859-1", | |
@@ -875,15 +889,15 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'test: charset, multiple' : function() { | |
var test = this; | |
var urls = [ | |
- getUniqueEchoechoJs(JS_A, { delay: '0-1' }), | |
- getUniqueEchoechoJs(JS_B, { delay: '0-1' }), | |
- getUniqueEchoechoJs(JS_C, { delay: '0-1' }) | |
+ getUniqueEchoechoJs(JS_A, DELAY), | |
+ getUniqueEchoechoJs(JS_B, DELAY), | |
+ getUniqueEchoechoJs(JS_C, DELAY) | |
]; | |
var trans = Y.Get.script(urls, { | |
@@ -912,15 +926,15 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'test: async, charset, multiple' : function() { | |
var test = this; | |
var urls = [ | |
- getUniqueEchoechoJs(JS_A, { delay: '0-1' }), | |
- getUniqueEchoechoJs(JS_B, { delay: '0-1' }), | |
- getUniqueEchoechoJs(JS_C, { delay: '0-1' }) | |
+ getUniqueEchoechoJs(JS_A, DELAY), | |
+ getUniqueEchoechoJs(JS_B, DELAY), | |
+ getUniqueEchoechoJs(JS_C, DELAY) | |
]; | |
var trans = Y.Get.script(urls, { | |
@@ -951,12 +965,12 @@ YUI.add('get-test', function (Y) { | |
async :true | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'test: attributes, single' : function() { | |
var test = this; | |
- var url = getUniqueEchoechoJs(); | |
+ var url = getUniqueEchoechoJs(JS_A, DELAY); | |
var trans = Y.Get.script(url, { | |
attributes: { | |
@@ -989,15 +1003,15 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'test: attributes, multiple' : function() { | |
var test = this; | |
var urls = [ | |
- getUniqueEchoechoJs(JS_A, { delay: '0-1' }), | |
- getUniqueEchoechoJs(JS_B, { delay: '0-1' }), | |
- getUniqueEchoechoJs(JS_C, { delay: '0-1' }) | |
+ getUniqueEchoechoJs(JS_A, DELAY), | |
+ getUniqueEchoechoJs(JS_B, DELAY), | |
+ getUniqueEchoechoJs(JS_C, DELAY) | |
]; | |
var trans = Y.Get.script(urls, { | |
@@ -1032,15 +1046,15 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'test: async, attributes, multiple' : function() { | |
var test = this; | |
var urls = [ | |
- getUniqueEchoechoJs(JS_A, { delay: '0-1' }), | |
- getUniqueEchoechoJs(JS_B, { delay: '0-1' }), | |
- getUniqueEchoechoJs(JS_C, { delay: '0-1' }) | |
+ getUniqueEchoechoJs(JS_A, DELAY), | |
+ getUniqueEchoechoJs(JS_B, DELAY), | |
+ getUniqueEchoechoJs(JS_C, DELAY) | |
]; | |
var trans = Y.Get.script(urls, { | |
@@ -1078,7 +1092,7 @@ YUI.add('get-test', function (Y) { | |
async :true | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'ignore: abort' : function() { | |
@@ -1096,7 +1110,7 @@ YUI.add('get-test', function (Y) { | |
for (i = 0; i < 30; ++i) { | |
urls.push( | |
- getUniqueEchoechoJs() | |
+ getUniqueEchoechoJs(JS_A, DELAY) | |
); | |
} | |
@@ -1107,7 +1121,7 @@ YUI.add('get-test', function (Y) { | |
}); | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'test: purgethreshold' : function() { | |
@@ -1116,13 +1130,13 @@ YUI.add('get-test', function (Y) { | |
var nodeIds = []; | |
// Purge only happens at the start of a queue call. | |
- Y.Get.script(getUniqueEchoechoJs(), { | |
+ Y.Get.script(getUniqueEchoechoJs(JS_A, DELAY), { | |
purgethreshold: 1000, // Just to make sure we're not purged as part of the default 20 script purge. | |
onSuccess: function(o) { | |
nodes = nodes.concat(o.nodes); | |
- Y.Get.script(getUniqueEchoechoJs(), { | |
+ Y.Get.script(getUniqueEchoechoJs(JS_B, DELAY), { | |
purgethreshold: 1000, // Just to make sure we're not purged as part of the default 20 script purge. | |
onSuccess: function(o) { | |
@@ -1138,7 +1152,7 @@ YUI.add('get-test', function (Y) { | |
nodeIds[i] = node.get("id"); | |
} | |
- Y.Get.script(getUniqueEchoechoJs(), { | |
+ Y.Get.script(getUniqueEchoechoJs(JS_C, DELAY), { | |
purgethreshold: 1, | |
onSuccess: function(o) { | |
@@ -1158,7 +1172,7 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
// THE ASYNC FAILURE TESTS NEED TO BE AT THE END, | |
@@ -1175,9 +1189,9 @@ YUI.add('get-test', function (Y) { | |
failure:0 | |
}; | |
var urls = [ | |
- getUniqueEchoechoJs(JS_A), | |
- 'bogus.js', | |
- getUniqueEchoechoJs(JS_C) | |
+ getUniqueEchoechoJs(JS_A, DELAY), | |
+ randUrl('echo/status/404'), | |
+ getUniqueEchoechoJs(JS_C, DELAY) | |
]; | |
var trans = Y.Get.script(urls, { | |
@@ -1210,7 +1224,7 @@ YUI.add('get-test', function (Y) { | |
async:true | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
} | |
}); | |
@@ -1247,7 +1261,7 @@ YUI.add('get-test', function (Y) { | |
link.setAttribute("rel", "stylesheet"); | |
link.setAttribute("type", "text/css"); | |
link.setAttribute("charset", "utf-8"); | |
- link.setAttribute("href", getUniqueEchoechoCss(CSS_IB)); | |
+ link.setAttribute("href", getUniqueEchoechoCss(CSS_IB, DELAY)); | |
this.ib = Y.Node.one(link); | |
@@ -1266,7 +1280,7 @@ YUI.add('get-test', function (Y) { | |
success:0, | |
failure:0 | |
}; | |
- var url = getUniqueEchoechoCss(CSS_A); | |
+ var url = getUniqueEchoechoCss(CSS_A, DELAY); | |
var trans = Y.Get.css(url, { | |
data: {a:1, b:2, c:3}, | |
@@ -1298,7 +1312,7 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- test.wait(); | |
+ test.wait(30000); | |
}, | |
'test: multiple css, success': function() { | |
@@ -1308,9 +1322,9 @@ YUI.add('get-test', function (Y) { | |
failure:0 | |
}; | |
var urls = [ | |
- getUniqueEchoechoCss(CSS_A, { delay: '0-1' }), | |
- getUniqueEchoechoCss(CSS_B, { delay: '0-1' }), | |
- getUniqueEchoechoCss(CSS_C, { delay: '0-1' }) | |
+ getUniqueEchoechoCss(CSS_A, DELAY), | |
+ getUniqueEchoechoCss(CSS_B, DELAY), | |
+ getUniqueEchoechoCss(CSS_C, DELAY) | |
]; | |
var trans = Y.Get.css(urls, { | |
@@ -1345,12 +1359,12 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- test.wait(); | |
+ test.wait(30000); | |
}, | |
'test: insertBefore, single' : function() { | |
var test = this; | |
- var url = getUniqueEchoechoCss(CSS_A); | |
+ var url = getUniqueEchoechoCss(CSS_A, DELAY); | |
test.createInsertBeforeNode(); | |
@@ -1371,21 +1385,21 @@ YUI.add('get-test', function (Y) { | |
// Let the CSS kick in ?? | |
test.wait(function() { | |
Assert.areEqual("9991", this.na.getComputedStyle("zIndex"), "a.css does not seem to be inserted before ib.css"); | |
- }, 100); | |
+ }, 5000); | |
} | |
}); | |
} | |
}); | |
- test.wait(); | |
+ test.wait(30000); | |
}, | |
'test: insertBefore, multiple' : function() { | |
var test = this; | |
var urls = [ | |
- getUniqueEchoechoCss(CSS_A, { delay: '0-1' }), | |
- getUniqueEchoechoCss(CSS_B, { delay: '0-1' }), | |
- getUniqueEchoechoCss(CSS_C, { delay: '0-1' }) | |
+ getUniqueEchoechoCss(CSS_A, DELAY), | |
+ getUniqueEchoechoCss(CSS_B, DELAY), | |
+ getUniqueEchoechoCss(CSS_C, DELAY) | |
]; | |
test.createInsertBeforeNode(); | |
@@ -1412,18 +1426,18 @@ YUI.add('get-test', function (Y) { | |
Assert.areEqual("9991", this.na.getComputedStyle("zIndex"), "a.css does not seem to be inserted before ib.css"); | |
Assert.areEqual("9992", this.nb.getComputedStyle("zIndex"), "b.css does not seem to be inserted before ib.css"); | |
Assert.areEqual("9993", this.nc.getComputedStyle("zIndex"), "c.css does not seem to be inserted before ib.css"); | |
- }, 100); | |
+ }, 5000); | |
} | |
}); | |
} | |
}); | |
- test.wait(); | |
+ test.wait(30000); | |
}, | |
'test: charset, single' : function() { | |
var test = this; | |
- var url = getUniqueEchoechoCss(CSS_A); | |
+ var url = getUniqueEchoechoCss(CSS_A, DELAY); | |
var trans = Y.Get.css(url, { | |
charset: "ISO-8859-1", | |
@@ -1439,15 +1453,15 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- test.wait(); | |
+ test.wait(30000); | |
}, | |
'test: charset, multiple' : function() { | |
var test = this; | |
var urls = [ | |
- getUniqueEchoechoCss(CSS_A, { delay: '0-1' }), | |
- getUniqueEchoechoCss(CSS_B, { delay: '0-1' }), | |
- getUniqueEchoechoCss(CSS_C, { delay: '0-1' }) | |
+ getUniqueEchoechoCss(CSS_A, DELAY), | |
+ getUniqueEchoechoCss(CSS_B, DELAY), | |
+ getUniqueEchoechoCss(CSS_C, DELAY) | |
]; | |
var trans = Y.Get.css(urls, { | |
@@ -1469,12 +1483,12 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- test.wait(); | |
+ test.wait(30000); | |
}, | |
'test: attributes, single' : function() { | |
var test = this; | |
- var url = getUniqueEchoechoCss(CSS_A); | |
+ var url = getUniqueEchoechoCss(CSS_A, DELAY); | |
var trans = Y.Get.css(url, { | |
attributes: { | |
@@ -1495,15 +1509,15 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- test.wait(); | |
+ test.wait(30000); | |
}, | |
'test: attributes, multiple' : function() { | |
var test = this; | |
var urls = [ | |
- getUniqueEchoechoCss(CSS_A, { delay: '0-1' }), | |
- getUniqueEchoechoCss(CSS_B, { delay: '0-1' }), | |
- getUniqueEchoechoCss(CSS_C, { delay: '0-1' }) | |
+ getUniqueEchoechoCss(CSS_A, DELAY), | |
+ getUniqueEchoechoCss(CSS_B, DELAY), | |
+ getUniqueEchoechoCss(CSS_C, DELAY) | |
]; | |
var trans = Y.Get.css(urls, { | |
@@ -1531,7 +1545,7 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- test.wait(); | |
+ test.wait(30000); | |
}, | |
'test: single css, failure': function() { | |
@@ -1540,7 +1554,7 @@ YUI.add('get-test', function (Y) { | |
success:0, | |
failure:0 | |
}; | |
- var url = 'bogus.css'; | |
+ var url = randUrl('echo/status/404'); | |
Y.Get.css(url, { | |
data: {a:1, b:2, c:3}, | |
@@ -1566,7 +1580,7 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- test.wait(); | |
+ test.wait(30000); | |
}, | |
'test: multiple css, failure': function() { | |
@@ -1576,9 +1590,9 @@ YUI.add('get-test', function (Y) { | |
failure:0 | |
}; | |
var urls = [ | |
- getUniqueEchoechoCss(CSS_A, { delay: '0-1' }), | |
- 'bogus.css', | |
- getUniqueEchoechoCss(CSS_C, { delay: '0-1' }) | |
+ getUniqueEchoechoCss(CSS_A, DELAY), | |
+ randUrl('echo/status/404'), | |
+ getUniqueEchoechoCss(CSS_C, DELAY) | |
]; | |
Y.Get.css(urls, { | |
@@ -1606,7 +1620,7 @@ YUI.add('get-test', function (Y) { | |
Assert.areEqual("1111", this.na.getComputedStyle("zIndex"), "a.css does not seem to be loaded"); | |
Assert.areNotEqual("1234", this.nb.getComputedStyle("zIndex"), "b.css was loaded when it shouldn't have been"); | |
Assert.areEqual("4321", this.nc.getComputedStyle("zIndex"), "c.css does not seem to be loaded"); | |
- }, 100); | |
+ }, 5000); | |
} | |
}); | |
@@ -1617,15 +1631,15 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'CSS nodes should be inserted in order': function () { | |
var test = this; | |
var urls = [ | |
- getUniqueEchoechoCss(CSS_A, { delay: '0-1' }), | |
- getUniqueEchoechoCss(CSS_B, { delay: '0-1' }), | |
- getUniqueEchoechoCss(CSS_C, { delay: '0-1' }) | |
+ getUniqueEchoechoCss(CSS_A, DELAY), | |
+ getUniqueEchoechoCss(CSS_B, DELAY), | |
+ getUniqueEchoechoCss(CSS_C, DELAY) | |
]; | |
test.o = Y.Get.css([ | |
@@ -1643,7 +1657,7 @@ YUI.add('get-test', function (Y) { | |
}); | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
} | |
}); | |
@@ -1651,6 +1665,10 @@ YUI.add('get-test', function (Y) { | |
Y.GetTests.GetMethods = new Y.Test.Case({ | |
name: 'Y.Get methods', | |
+ setUp: function () { | |
+ G_SCRIPTS = []; | |
+ }, | |
+ | |
tearDown: function () { | |
this.t && this.t.purge(); | |
this.interval && clearInterval(this.interval); | |
@@ -1659,9 +1677,9 @@ YUI.add('get-test', function (Y) { | |
'abort() should abort a transaction when given a transaction object': function () { | |
var test = this; | |
var urls = [ | |
- getUniqueEchoechoJs(null, { delay: '0-1' }), | |
- getUniqueEchoechoJs(null, { delay: '0-1' }), | |
- getUniqueEchoechoJs(null, { delay: '0-1' }) | |
+ getUniqueEchoechoJs(JS_A, DELAY), | |
+ getUniqueEchoechoJs(JS_B, DELAY), | |
+ getUniqueEchoechoJs(JS_C, DELAY) | |
]; | |
test.t = Y.Get.js(urls, { | |
@@ -1684,15 +1702,15 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- test.wait(); | |
+ test.wait(30000); | |
}, | |
'abort() should abort a transaction when given a transaction id': function () { | |
var test = this; | |
var urls = [ | |
- getUniqueEchoechoJs(null, { delay: '0-1' }), | |
- getUniqueEchoechoJs(null, { delay: '0-1' }), | |
- getUniqueEchoechoJs(null, { delay: '0-1' }) | |
+ getUniqueEchoechoJs(JS_A, DELAY), | |
+ getUniqueEchoechoJs(JS_B, DELAY), | |
+ getUniqueEchoechoJs(JS_C, DELAY) | |
]; | |
test.t = Y.Get.js(urls, { | |
@@ -1715,13 +1733,13 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
// -- css() ------------------------------------------------------------ | |
'css() should accept a URL': function () { | |
var test = this; | |
- var url = getUniqueEchoechoCss(); | |
+ var url = getUniqueEchoechoCss(CSS_A, DELAY); | |
setTimeout(function () { | |
test.t = Y.Get.css(url); | |
@@ -1742,13 +1760,13 @@ YUI.add('get-test', function (Y) { | |
} | |
}, 20); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'css() should accept a URL, options object, and callback function': function () { | |
- var test = this; | |
- var callbackCalled; | |
- var url = getUniqueEchoechoCss(); | |
+ var test = this, | |
+ url = getUniqueEchoechoCss(CSS_A, DELAY), | |
+ callbackCalled; | |
test.t = Y.Get.css(url, { | |
onFailure: function () { | |
@@ -1776,12 +1794,12 @@ YUI.add('get-test', function (Y) { | |
}); | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'css() should allow the callback function as the second parameter': function () { | |
var test = this; | |
- var url = getUniqueEchoechoCss(); | |
+ var url = getUniqueEchoechoCss(CSS_A, DELAY); | |
test.t = Y.Get.css(url, function (err, transaction) { | |
var self = this; | |
@@ -1793,15 +1811,15 @@ YUI.add('get-test', function (Y) { | |
}); | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'css() should accept an array of URLs': function () { | |
var test = this; | |
var urls = [ | |
- getUniqueEchoechoCss(null, { delay: '0-1' }), | |
- getUniqueEchoechoCss(null, { delay: '0-1' }), | |
- getUniqueEchoechoCss(null, { delay: '0-1' }) | |
+ getUniqueEchoechoCss(CSS_A, DELAY), | |
+ getUniqueEchoechoCss(CSS_B, DELAY), | |
+ getUniqueEchoechoCss(CSS_C, DELAY) | |
]; | |
test.t = Y.Get.css(urls, { | |
@@ -1819,12 +1837,12 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'css() should accept a request object': function () { | |
var test = this; | |
- var url = getUniqueEchoechoCss(); | |
+ var url = getUniqueEchoechoCss(CSS_A, DELAY); | |
test.t = Y.Get.css({url: url}, { | |
onFailure: function () { | |
@@ -1841,15 +1859,15 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'css() should accept an array of request objects': function () { | |
var test = this; | |
var urls = [ | |
- getUniqueEchoechoCss(null, { delay: '0-1' }), | |
- getUniqueEchoechoCss(null, { delay: '0-1' }), | |
- getUniqueEchoechoCss(null, { delay: '0-1' }) | |
+ getUniqueEchoechoCss(CSS_A, DELAY), | |
+ getUniqueEchoechoCss(CSS_B, DELAY), | |
+ getUniqueEchoechoCss(CSS_C, DELAY) | |
]; | |
test.t = Y.Get.css([{url: urls[0]}, {url: urls[1]}, {url: urls[2]}], { | |
@@ -1867,15 +1885,15 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'css() should accept a mixed array of URLs and request objects': function () { | |
var test = this; | |
var urls = [ | |
- getUniqueEchoechoCss(CSS_A, { delay: '0-1' }), | |
- getUniqueEchoechoCss(CSS_B, { delay: '0-1' }), | |
- getUniqueEchoechoCss(CSS_C, { delay: '0-1' }) | |
+ getUniqueEchoechoCss(CSS_A, DELAY), | |
+ getUniqueEchoechoCss(CSS_B, DELAY), | |
+ getUniqueEchoechoCss(CSS_C, DELAY) | |
]; | |
test.t = Y.Get.css([urls[0], {url: urls[1]}, urls[2]], { | |
@@ -1893,13 +1911,13 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
// -- js() ------------------------------------------------------------- | |
'js() should accept a URL': function () { | |
var test = this; | |
- var url = getUniqueEchoechoJs(); | |
+ var url = getUniqueEchoechoJs(JS_A, DELAY); | |
setTimeout(function () { | |
test.t = Y.Get.js(url); | |
@@ -1920,13 +1938,13 @@ YUI.add('get-test', function (Y) { | |
} | |
}, 20); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'js() should accept a URL, options object, and callback function': function () { | |
- var test = this; | |
- var callbackCalled; | |
- var url = getUniqueEchoechoJs(); | |
+ var test = this, | |
+ url = getUniqueEchoechoJs(JS_A, DELAY), | |
+ callbackCalled; | |
test.t = Y.Get.js(url, { | |
onFailure: function () { | |
@@ -1954,12 +1972,12 @@ YUI.add('get-test', function (Y) { | |
}); | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'js() should allow the callback function as the second parameter': function () { | |
var test = this; | |
- var url = getUniqueEchoechoJs(); | |
+ var url = getUniqueEchoechoJs(JS_A, DELAY); | |
test.t = Y.Get.js(url, function (err, transaction) { | |
var self = this; | |
@@ -1971,15 +1989,15 @@ YUI.add('get-test', function (Y) { | |
}); | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'js() should accept an array of URLs': function () { | |
var test = this; | |
var urls = [ | |
- getUniqueEchoechoJs(null, { name: 'a.js' }), | |
- getUniqueEchoechoJs(null, { name: 'b.js' }), | |
- getUniqueEchoechoJs(null, { name: 'c.js' }) | |
+ getUniqueEchoechoJs(JS_A, DELAY), | |
+ getUniqueEchoechoJs(JS_B, DELAY), | |
+ getUniqueEchoechoJs(JS_C, DELAY) | |
]; | |
test.t = Y.Get.js(urls, { | |
@@ -1997,12 +2015,12 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'js() should accept a request object': function () { | |
var test = this; | |
- var url = getUniqueEchoechoJs(); | |
+ var url = getUniqueEchoechoJs(JS_A, DELAY); | |
test.t = Y.Get.js({url: url}, { | |
onFailure: function () { | |
@@ -2019,15 +2037,15 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'js() should accept an array of request objects': function () { | |
var test = this; | |
var urls = [ | |
- getUniqueEchoechoJs(null, { delay: '0-1' }), | |
- getUniqueEchoechoJs(null, { delay: '0-1' }), | |
- getUniqueEchoechoJs(null, { delay: '0-1' }) | |
+ getUniqueEchoechoJs(JS_A, DELAY), | |
+ getUniqueEchoechoJs(JS_B, DELAY), | |
+ getUniqueEchoechoJs(JS_C, DELAY) | |
]; | |
test.t = Y.Get.js(urls, { | |
@@ -2045,15 +2063,15 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'js() should accept a mixed array of URLs and request objects': function () { | |
var test = this; | |
var urls = [ | |
- getUniqueEchoechoJs(null, { delay: '0-1' }), | |
- getUniqueEchoechoJs(null, { delay: '0-1' }), | |
- getUniqueEchoechoJs(null, { delay: '0-1' }) | |
+ getUniqueEchoechoJs(JS_A, DELAY), | |
+ getUniqueEchoechoJs(JS_B, DELAY), | |
+ getUniqueEchoechoJs(JS_C, DELAY) | |
]; | |
test.t = Y.Get.js([urls[0], {url: urls[1]}, urls[2]], { | |
@@ -2071,13 +2089,13 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
// -- load() ----------------------------------------------------------- | |
'load() should accept a URL': function () { | |
var test = this; | |
- var url = getUniqueEchoechoJs(); | |
+ var url = getUniqueEchoechoJs(JS_A, DELAY); | |
setTimeout(function () { | |
test.t = Y.Get.load(url); | |
@@ -2100,13 +2118,13 @@ YUI.add('get-test', function (Y) { | |
} | |
}, 20); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'load() should accept a URL, options object, and callback function': function () { | |
- var test = this; | |
- var callbackCalled; | |
- var url = getUniqueEchoechoCss(); | |
+ var test = this, | |
+ url = getUniqueEchoechoCss(CSS_A, DELAY), | |
+ callbackCalled; | |
test.t = Y.Get.load(url, { | |
onFailure: function () { | |
@@ -2135,12 +2153,12 @@ YUI.add('get-test', function (Y) { | |
}); | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'load() should allow the callback function as the second parameter': function () { | |
var test = this; | |
- var url = getUniqueEchoechoJs(); | |
+ var url = getUniqueEchoechoJs(JS_A, DELAY); | |
test.t = Y.Get.load(url, function (err, transaction) { | |
var self = this; | |
@@ -2152,15 +2170,15 @@ YUI.add('get-test', function (Y) { | |
}); | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'load() should accept an array of URLs': function () { | |
var test = this; | |
var urls = [ | |
- getUniqueEchoechoJs(), | |
- getUniqueEchoechoCss(), | |
- getUniqueEchoechoJs() | |
+ getUniqueEchoechoJs(JS_A, DELAY), | |
+ getUniqueEchoechoCss(CSS_B, DELAY), | |
+ getUniqueEchoechoJs(JS_C, DELAY) | |
]; | |
test.t = Y.Get.load(urls, { | |
@@ -2181,12 +2199,12 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'load() should accept a request object': function () { | |
var test = this; | |
- var url = getUniqueEchoechoJs(); | |
+ var url = getUniqueEchoechoJs(JS_A, DELAY); | |
test.t = Y.Get.load({url: url}, { | |
onFailure: function () { | |
@@ -2204,15 +2222,15 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'load() should accept an array of request objects': function () { | |
var test = this; | |
var urls = [ | |
- getUniqueEchoechoCss(), | |
- getUniqueEchoechoJs(), | |
- getUniqueEchoechoCss() | |
+ getUniqueEchoechoCss(CSS_A, DELAY), | |
+ getUniqueEchoechoJs(JS_B, DELAY), | |
+ getUniqueEchoechoCss(CSS_C, DELAY) | |
]; | |
test.t = Y.Get.load([{url: urls[0]}, {url: urls[1]}, {url: urls[2]}], { | |
@@ -2233,15 +2251,15 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'load() should accept a mixed array of URLs and request objects': function () { | |
var test = this; | |
var urls = [ | |
- getUniqueEchoechoJs(), | |
- getUniqueEchoechoJs(), | |
- getUniqueEchoechoCss() | |
+ getUniqueEchoechoJs(JS_A, DELAY), | |
+ getUniqueEchoechoJs(JS_B, DELAY), | |
+ getUniqueEchoechoCss(CSS_C, DELAY) | |
]; | |
test.t = Y.Get.load([urls[0], {url: urls[1]}, urls[2]], { | |
@@ -2262,7 +2280,7 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
// -- script() --------------------------------------------------------- | |
@@ -2275,13 +2293,17 @@ YUI.add('get-test', function (Y) { | |
Y.GetTests.TransactionBehavior = new Y.Test.Case({ | |
name: 'Transaction behavior', | |
+ setUp: function () { | |
+ G_SCRIPTS = []; | |
+ }, | |
+ | |
'transactions should always execute one at a time by default': function () { | |
var test = this, | |
urls = [ | |
- getUniqueEchoechoJs(), | |
- getUniqueEchoechoJs(), | |
- getUniqueEchoechoCss(), | |
- getUniqueEchoechoJs() | |
+ getUniqueEchoechoJs(JS_A, DELAY), | |
+ getUniqueEchoechoJs(JS_B, DELAY), | |
+ getUniqueEchoechoCss(CSS_A, DELAY), | |
+ getUniqueEchoechoJs(JS_C, DELAY) | |
], | |
t1 = Y.Get.js([urls[0], urls[1]], finish), | |
@@ -2309,7 +2331,7 @@ YUI.add('get-test', function (Y) { | |
t.finish = Y.Lang.now(); | |
} | |
- this.wait(); | |
+ this.wait(30000); | |
} | |
}); | |
@@ -2317,6 +2339,10 @@ YUI.add('get-test', function (Y) { | |
Y.GetTests.TransactionMethods = new Y.Test.Case({ | |
name: 'Transaction methods', | |
+ setUp: function () { | |
+ G_SCRIPTS = []; | |
+ }, | |
+ | |
tearDown: function () { | |
this.t && this.t.purge(); | |
}, | |
@@ -2324,9 +2350,9 @@ YUI.add('get-test', function (Y) { | |
'abort() should abort the transaction': function () { | |
var test = this; | |
var urls = [ | |
- getUniqueEchoechoJs(), | |
- getUniqueEchoechoJs(), | |
- getUniqueEchoechoJs() | |
+ getUniqueEchoechoJs(JS_A, DELAY), | |
+ getUniqueEchoechoJs(JS_B, DELAY), | |
+ getUniqueEchoechoJs(JS_C, DELAY) | |
]; | |
// Progress is called async, followed by a sync call to failure | |
@@ -2351,15 +2377,15 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- test.wait(); | |
+ test.wait(30000); | |
}, | |
'abort() should accept a custom error message': function () { | |
var test = this; | |
var urls = [ | |
- getUniqueEchoechoJs(), | |
- getUniqueEchoechoJs(), | |
- getUniqueEchoechoJs() | |
+ getUniqueEchoechoJs(JS_A, DELAY), | |
+ getUniqueEchoechoJs(JS_B, DELAY), | |
+ getUniqueEchoechoJs(JS_C, DELAY) | |
]; | |
// Progress is called async, followed by a sync call to failure | |
@@ -2384,14 +2410,13 @@ YUI.add('get-test', function (Y) { | |
} | |
}); | |
- test.wait(); | |
+ test.wait(30000); | |
}, | |
'execute() should queue callbacks': function () { | |
- var test = this; | |
- var url = getUniqueEchoechoJs(); | |
- var callbackOne; | |
- var callbackTwo; | |
+ var test = this, | |
+ url = getUniqueEchoechoJs(JS_A, DELAY), | |
+ callbackOne, callbackTwo; | |
test.t = Y.Get.js(url); | |
@@ -2403,7 +2428,7 @@ YUI.add('get-test', function (Y) { | |
Assert.isNull(err, '`err` should be null'); | |
Assert.areSame(test.t, transaction, 'transaction should be passed to the callback'); | |
- test.wait(); | |
+ test.wait(30000); | |
}); | |
}); | |
@@ -2417,12 +2442,12 @@ YUI.add('get-test', function (Y) { | |
}); | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'execute() should call the callback immediately if the transaction has already finished': function () { | |
var test = this; | |
- var url = getUniqueEchoechoJs(); | |
+ var url = getUniqueEchoechoJs(JS_A, DELAY); | |
test.t = Y.Get.js(url, function (err, transaction) { | |
@@ -2453,15 +2478,15 @@ YUI.add('get-test', function (Y) { | |
}); | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'purge() should purge any nodes inserted by the transaction': function () { | |
var test = this; | |
var urls = [ | |
- getUniqueEchoechoJs(), | |
- getUniqueEchoechoJs(), | |
- getUniqueEchoechoJs() | |
+ getUniqueEchoechoJs(JS_A, DELAY), | |
+ getUniqueEchoechoJs(JS_B, DELAY), | |
+ getUniqueEchoechoJs(JS_C, DELAY) | |
]; | |
test.t = Y.Get.js(urls, function (err, t) { | |
@@ -2486,7 +2511,7 @@ YUI.add('get-test', function (Y) { | |
}); | |
}); | |
- test.wait(); | |
+ test.wait(30000); | |
} | |
}); | |
@@ -2505,14 +2530,18 @@ YUI.add('get-test', function (Y) { | |
} | |
}, | |
+ setUp: function () { | |
+ G_SCRIPTS = []; | |
+ }, | |
+ | |
tearDown: function () { | |
this.t && this.t.purge(); | |
}, | |
'transactions should have a unique `id` property': function () { | |
var urls = [ | |
- getUniqueEchoechoJs(), | |
- getUniqueEchoechoJs() | |
+ getUniqueEchoechoJs(JS_A, DELAY), | |
+ getUniqueEchoechoJs(JS_B, DELAY) | |
]; | |
var t1 = Y.Get.js(urls[0]); | |
var t2 = Y.Get.js(urls[1]); | |
@@ -2527,7 +2556,7 @@ YUI.add('get-test', function (Y) { | |
'transactions should have a `data` property when a data object is provided': function () { | |
var data = {}; | |
- var url = getUniqueEchoechoJs(); | |
+ var url = getUniqueEchoechoJs(JS_A, DELAY); | |
this.t = Y.Get.js(url, { data: data }); | |
Assert.areSame(data, this.t.data); | |
@@ -2536,8 +2565,8 @@ YUI.add('get-test', function (Y) { | |
'`errors` property should contain an array of error objects': function () { | |
var test = this; | |
var urls = [ | |
- 'bogus.js', | |
- 'bogus.js' | |
+ randUrl('echo/status/404'), | |
+ randUrl('echo/status/404') | |
]; | |
this.t = Y.Get.js(urls, function (err, t) { | |
@@ -2552,14 +2581,14 @@ YUI.add('get-test', function (Y) { | |
}); | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'`nodes` property should contain an array of injected nodes': function () { | |
var test = this; | |
var urls = [ | |
- getUniqueEchoechoJs(), | |
- getUniqueEchoechoJs() | |
+ getUniqueEchoechoJs(JS_A, DELAY), | |
+ getUniqueEchoechoJs(JS_B, DELAY) | |
]; | |
this.t = Y.Get.js(urls, function (err, t) { | |
@@ -2572,11 +2601,11 @@ YUI.add('get-test', function (Y) { | |
}); | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'`options` property should contain transaction options': function () { | |
- var url = getUniqueEchoechoJs(); | |
+ var url = getUniqueEchoechoJs(JS_A, DELAY); | |
this.t = Y.Get.js(url, { | |
attributes: {'class': 'testing'}, | |
@@ -2593,8 +2622,8 @@ YUI.add('get-test', function (Y) { | |
'`requests` property should contain an array of request objects': function () { | |
var test = this; | |
var urls = [ | |
- getUniqueEchoechoJs(), | |
- getUniqueEchoechoJs() | |
+ getUniqueEchoechoJs(JS_A, DELAY), | |
+ getUniqueEchoechoJs(JS_B, DELAY) | |
]; | |
this.t = Y.Get.js(urls, function (err, t) { | |
@@ -2609,7 +2638,7 @@ YUI.add('get-test', function (Y) { | |
}); | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
} | |
}); | |
@@ -2617,9 +2646,19 @@ YUI.add('get-test', function (Y) { | |
Y.GetTests.Options = new Y.Test.Case({ | |
name: 'Options', | |
+ setUp: function () { | |
+ G_SCRIPTS = []; | |
+ }, | |
+ | |
+ tearDown: function () { | |
+ if (this.t) { | |
+ this.t.purge(); | |
+ } | |
+ }, | |
+ | |
'`class` attribute should be set correctly in all browsers': function () { | |
var test = this; | |
- var url = getUniqueEchoechoJs(); | |
+ var url = getUniqueEchoechoJs(JS_A, DELAY); | |
this.t = Y.Get.js(url, { | |
attributes: {'class': 'get-class-test'} | |
@@ -2627,10 +2666,11 @@ YUI.add('get-test', function (Y) { | |
test.resume(function () { | |
Assert.areSame('get-class-test', t.nodes[0].className, 'className should be set'); | |
Assert.areSame(1, Y.all('.get-class-test').size(), 'selector should return one node'); | |
+ test.t = t; | |
}); | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
} | |
}); | |
@@ -2648,7 +2688,7 @@ YUI.add('get-test', function (Y) { | |
}); | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
}, | |
'test: Loader, Autocomplete' : function() { | |
@@ -2660,7 +2700,7 @@ YUI.add('get-test', function (Y) { | |
}); | |
}); | |
- this.wait(); | |
+ this.wait(30000); | |
} | |
}); | |
}, '3.5.0', { | |
diff --git a/src/get/tests/unit/load.html b/src/get/tests/unit/load.html | |
new file mode 100644 | |
index 0000000..ba0828e | |
--- /dev/null | |
+++ b/src/get/tests/unit/load.html | |
@@ -0,0 +1,125 @@ | |
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
+<html> | |
+<head> | |
+ <title>YUI Get Tests</title> | |
+ <link rel="stylesheet" href="../../../../build/widget-base/assets/skins/sam/widget-base.css" charset="utf-8"> | |
+ <link rel="stylesheet" href="../../../../build/console/assets/skins/sam/console.css" charset="utf-8"> | |
+ <link rel="stylesheet" href="../../../../build/console/assets/skins/sam/console-filters.css" charset="utf-8"> | |
+ <link rel="stylesheet" href="../../../../build/test-console/assets/skins/sam/test-console.css" charset="utf-8"> | |
+</head> | |
+<body class="yui3-skin-sam"> | |
+ | |
+<div id="log"></div> | |
+ | |
+<p> | |
+These tests depend on <a href=https://github.com/davglass/echoecho>echoecho</a> | |
+and will mostly fail when run manually. | |
+</p> | |
+ | |
+<p> | |
+<a href=https://github.com/davglass/echoecho>echoecho</a> is | |
+automatically included when running these tests with <a | |
+href=https://github.com/yui/yogi>yogi</a> or <a | |
+href=https://github.com/yui/yeti>yeti</a>. | |
+</p> | |
+ | |
+<script src="../../../../build/yui-core/yui-core.js" charset="utf-8"></script> | |
+<script src="../../../../build/yui-log/yui-log.js" charset="utf-8"></script> | |
+<script src="../../../../build/yui-later/yui-later.js" charset="utf-8"></script> | |
+ | |
+<script src="../../../../build/get/get.js" charset="utf-8"></script> | |
+ | |
+<script src="../../../../build/loader/loader.js" charset="utf-8"></script> | |
+<script src="../../../../build/features/features.js" charset="utf-8"></script> | |
+ | |
+<!-- Adding these manually and doing a use("*") so we don't need "get" to test "get" --> | |
+<script src="../../../../build/oop/oop.js" charset="utf-8"></script> | |
+<script src="../../../../build/event-custom-base/event-custom-base.js" charset="utf-8"></script> | |
+<script src="../../../../build/event-custom-complex/event-custom-complex.js" charset="utf-8"></script> | |
+<script src="../../../../build/intl-base/intl-base.js" charset="utf-8"></script> | |
+<script src="../../../../build/intl/intl.js" charset="utf-8"></script> | |
+<script src="../../../../build/attribute-core/attribute-core.js" charset="utf-8"></script> | |
+<script src="../../../../build/attribute-observable/attribute-observable.js" charset="utf-8"></script> | |
+<script src="../../../../build/attribute-extras/attribute-extras.js" charset="utf-8"></script> | |
+<script src="../../../../build/attribute-base/attribute-base.js" charset="utf-8"></script> | |
+<script src="../../../../build/attribute-complex/attribute-complex.js" charset="utf-8"></script> | |
+<script src="../../../../build/array-extras/array-extras.js" charset="utf-8"></script> | |
+<script src="../../../../build/base-core/base-core.js" charset="utf-8"></script> | |
+<script src="../../../../build/base-observable/base-observable.js" charset="utf-8"></script> | |
+<script src="../../../../build/base-base/base-base.js" charset="utf-8"></script> | |
+<script src="../../../../build/plugin/plugin.js" charset="utf-8"></script> | |
+<script src="../../../../build/console/lang/console.js" charset="utf-8"></script> | |
+<script src="../../../../build/dom-core/dom-core.js" charset="utf-8"></script> | |
+<script src="../../../../build/dom-attrs/dom-attrs.js" charset="utf-8"></script> | |
+<script src="../../../../build/dom-create/dom-create.js" charset="utf-8"></script> | |
+<script src="../../../../build/dom-class/dom-class.js" charset="utf-8"></script> | |
+<script src="../../../../build/dom-size/dom-size.js" charset="utf-8"></script> | |
+<script src="../../../../build/dom-base/dom-base.js" charset="utf-8"></script> | |
+<script src="../../../../build/selector-native/selector-native.js" charset="utf-8"></script> | |
+<script src="../../../../build/selector-css2/selector-css2.js" charset="utf-8"></script> | |
+<script src="../../../../build/selector/selector.js" charset="utf-8"></script> | |
+<script src="../../../../build/dom-style/dom-style.js" charset="utf-8"></script> | |
+<script src="../../../../build/dom-style-ie/dom-style-ie.js" charset="utf-8"></script> | |
+<script src="../../../../build/dom-screen/dom-screen.js" charset="utf-8"></script> | |
+<script src="../../../../build/pluginhost-base/pluginhost-base.js" charset="utf-8"></script> | |
+<script src="../../../../build/pluginhost-config/pluginhost-config.js" charset="utf-8"></script> | |
+<script src="../../../../build/node-core/node-core.js" charset="utf-8"></script> | |
+<script src="../../../../build/node-base/node-base.js" charset="utf-8"></script> | |
+<script src="../../../../build/node-style/node-style.js" charset="utf-8"></script> | |
+<script src="../../../../build/node-event-delegate/node-event-delegate.js" charset="utf-8"></script> | |
+<script src="../../../../build/event-base/event-base.js" charset="utf-8"></script> | |
+<script src="../../../../build/event-base-ie/event-base-ie.js" charset="utf-8"></script> | |
+<script src="../../../../build/event-synthetic/event-synthetic.js" charset="utf-8"></script> | |
+<script src="../../../../build/event-focus/event-focus.js" charset="utf-8"></script> | |
+<script src="../../../../build/base-pluginhost/base-pluginhost.js" charset="utf-8"></script> | |
+<script src="../../../../build/classnamemanager/classnamemanager.js" charset="utf-8"></script> | |
+<script src="../../../../build/event-delegate/event-delegate.js" charset="utf-8"></script> | |
+<script src="../../../../build/widget-base/widget-base.js" charset="utf-8"></script> | |
+<script src="../../../../build/widget-uievents/widget-uievents.js" charset="utf-8"></script> | |
+<script src="../../../../build/widget-htmlparser/widget-htmlparser.js" charset="utf-8"></script> | |
+<script src="../../../../build/widget-skin/widget-skin.js" charset="utf-8"></script> | |
+<script src="../../../../build/substitute/substitute.js" charset="utf-8"></script> | |
+<script src="../../../../build/console/console.js" charset="utf-8"></script> | |
+<script src="../../../../build/console-filters/console-filters.js" charset="utf-8"></script> | |
+<script src="../../../../build/test-console/test-console.js" charset="utf-8"></script> | |
+<script src="../../../../build/event-simulate/event-simulate.js" charset="utf-8"></script> | |
+<script src="../../../../build/json-stringify/json-stringify.js" charset="utf-8"></script> | |
+<script src="../../../../build/test/test.js" charset="utf-8"></script> | |
+ | |
+<script src="./assets/get-test.js" charset="utf-8"></script> | |
+ | |
+<script> | |
+var YUI_config = { | |
+ gconfig: true, | |
+ gfilter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'raw' | |
+}; | |
+ | |
+var Y = YUI({ | |
+ allowRollup: false, | |
+ filter: YUI_config.gfilter, | |
+ modules: { | |
+ 'get-test': { | |
+ fullpath: './assets/get-test.js', | |
+ requires: ['test', 'node'] | |
+ } | |
+ }, | |
+ echoechoDelay: '0-1' | |
+}).use('*', function(Y) { | |
+ Y.GetTests.add(Y.GetTests.BasicJS); | |
+ Y.GetTests.add(Y.GetTests.BasicCSS); | |
+ Y.GetTests.add(Y.GetTests.GetMethods); | |
+ Y.GetTests.add(Y.GetTests.TransactionBehavior); | |
+ Y.GetTests.add(Y.GetTests.TransactionMethods); | |
+ Y.GetTests.add(Y.GetTests.TransactionProperties); | |
+ Y.GetTests.add(Y.GetTests.Options); | |
+ Y.GetTests.add(Y.GetTests.Functional); | |
+ | |
+ new Y.Test.Console().render('#log'); | |
+ | |
+ Y.Test.Runner.add(Y.GetTests); | |
+ Y.Test.Runner.run(); | |
+}); | |
+</script> | |
+ | |
+</body> | |
+</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment