Skip to content

Commit 99fce51

Browse files
Fix some async tests.
These weren’t being handled as async tests even though they do async stuff. Any failures in these tests were being thrown but not caught; in most browsers this just displays an error, but in IE 6-7 it caused everything to get out of whack. Subsequent tests would run at the wrong time and would fail because they didn’t see the HTML fixtures they were expecting.
1 parent fa2fcdb commit 99fce51

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

test.new/tests/function.test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ suite('Function', function () {
111111
assert.strictEqual(split, split.curry());
112112
});
113113

114-
test('#delay', function () {
114+
test('#delay', function (done) {
115115
window.delayed = undefined;
116116
var delayedFunction = function() { window.delayed = true; };
117117
var delayedFunctionWithArgs = function() { window.delayedWithArgs = $A(arguments).join(' '); };
@@ -121,6 +121,7 @@ suite('Function', function () {
121121
wait(1000, function() {
122122
assert(window.delayed);
123123
assert.equal('hello world', window.delayedWithArgs);
124+
done();
124125
});
125126
});
126127

@@ -146,7 +147,7 @@ suite('Function', function () {
146147
String.prototype.capitalize = temp;
147148
});
148149

149-
test('#defer', function () {
150+
test('#defer', function (done) {
150151
window.deferred = undefined;
151152
var deferredFunction = function() { window.deferred = true; };
152153
deferredFunction.defer();
@@ -180,6 +181,7 @@ suite('Function', function () {
180181

181182
wait(50, function() {
182183
assert(window.deferBoundProperlyOnString);
184+
done();
183185
});
184186
});
185187
});

test.new/tests/layout.test.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,8 @@ suite("Layout",function(){
387387

388388
suite('document.viewport', function () {
389389

390-
test('#getDimensions', function () {
390+
test('#getDimensions', function (done) {
391+
this.timeout(5000);
391392
var original = document.viewport.getDimensions();
392393

393394
try {
@@ -404,13 +405,14 @@ suite("Layout",function(){
404405

405406
window.resizeBy(50, 50);
406407
wait(1000, function() {
407-
var after = document.viewport.getDimensions();
408+
var after = document.viewport.getDimensions();
408409

409410
// Assume that JavaScript window resizing is disabled if before width
410411
// and after width are the same.
411412
if (before.width === after.width) {
412413
RESIZE_DISABLED = true;
413414
info("SKIPPING REMAINING TESTS (JavaScript window resizing disabled)");
415+
done();
414416
return;
415417
}
416418

@@ -429,6 +431,7 @@ suite("Layout",function(){
429431
original.width + delta.width,
430432
original.height + delta.height
431433
);
434+
done();
432435
});
433436
});
434437
});
@@ -449,7 +452,8 @@ suite("Layout",function(){
449452
});
450453
});
451454

452-
test('#getScrollOffsets', function () {
455+
test('#getScrollOffsets', function (done) {
456+
this.timeout(5000);
453457
var original = document.viewport.getDimensions();
454458

455459
window.scrollTo(0, 0);
@@ -479,6 +483,7 @@ suite("Layout",function(){
479483
original.width + delta.width,
480484
original.height + delta.height
481485
);
486+
done();
482487
});
483488
});
484489
});

test.new/tests/periodical_executer.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
suite('PeriodicalExecuter', function () {
33
this.name = 'periodical_executer';
44

5-
test('#stop', function () {
5+
test('#stop', function (done) {
66
var peEventCount = 0;
77
function peEventFired(pe) {
88
if (++peEventCount > 2) pe.stop();
@@ -13,6 +13,7 @@ suite('PeriodicalExecuter', function () {
1313

1414
wait(600, function() {
1515
assert.equal(3, peEventCount);
16+
done();
1617
});
1718
});
1819

0 commit comments

Comments
 (0)