Commits

masklinn committed 1b29311

Test that adding new promises during the resolution of a promise works correctly

Comments (0)

Files changed (1)

             start();
         });
     });
+    asyncTest("Stack new deferred in the deferred", 1, function () {
+        var d = [
+            $.Deferred().then(function () { queue.push(d[1], d[2]); }),
+            $.Deferred().then(function () { queue.push(d[3]); }),
+            $.Deferred(),
+            $.Deferred().then(function () { queue.push(d[4]); }),
+            $.Deferred()
+        ];
+        queue.push(d[0]).then(function () { resolved = true; });
+        d[2].resolve();
+        d[1].resolve();
+        d[3].resolve();
+        d[0].resolve();
+        d[4].resolve();
+        setTimeout(function () {
+            ok(resolved);
+            start();
+        });
+    });
 });