Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
Merge pull request #45 from garlicnation/flushCleanup
Browse files Browse the repository at this point in the history
Remove locally defined animationFrameFlush
  • Loading branch information
garlicnation committed Nov 12, 2014
2 parents 8c3aa77 + ec76472 commit 1f646f5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 66 deletions.
5 changes: 0 additions & 5 deletions test/core-ajax-progress.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@
// whether to attach an event listener.
xhr['onprogress'] = null;
};
var animationFrameFlush = function(callback) {
requestAnimationFrame(function(){
flush(callback);
})
};
var progressEvent = function(lengthComputable, loaded, total) {
var progress = new ProgressEvent('progress', {
lengthComputable: lengthComputable,
Expand Down
7 changes: 0 additions & 7 deletions test/core-ajax-race.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,18 @@
xhr.onCreate = function (xhr) {
requests.push(xhr);
};
var animationFrameFlush = function(callback) {
requestAnimationFrame(function(){
flush(callback);
})
};

// Make request1, then request2. request2 returns first, followed by request1.
async.series([
function(cb) {
ajax.url="http://example.org/request1"
cb();
},
flush,
animationFrameFlush,
function(cb) {
ajax.url="http://example.org/request2"
cb();
},
flush,
animationFrameFlush,
function(cb) {
requests[0].respond(200, headers, body("http://example.org/request2"));
Expand Down
63 changes: 9 additions & 54 deletions test/core-ajax.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,7 @@
ajax.auto = true;
cb();
},
flush,
function(cb) {
requestAnimationFrame(function(){
cb();
});
},
animationFrameFlush,
function(cb){
requests[0].respond(200, headers, "test text");
cb();
Expand All @@ -80,12 +75,7 @@
ajax.auto = true;
cb();
},
flush,
function(cb) {
requestAnimationFrame(function(){
cb();
});
},
animationFrameFlush,
function(cb){
requests[0].respond(200, headers,
"<note>" +
Expand Down Expand Up @@ -116,12 +106,7 @@
ajax.auto = true;
cb();
},
flush,
function(cb) {
requestAnimationFrame(function(){
cb();
});
},
animationFrameFlush,
function(cb){
requests[0].respond(200, headers,
'{"object" : {"list" : [2, 3, {"key": "value"}]}}');
Expand All @@ -147,12 +132,7 @@
ajax.auto = true;
cb();
},
flush,
function(cb) {
requestAnimationFrame(function(){
cb();
});
},
animationFrameFlush,
function(cb){
var buf = new ArrayBuffer(8*4);
var resp = new Int32Array(buf);
Expand Down Expand Up @@ -185,12 +165,7 @@
ajax.url = "http://example.com/auto";
cb();
},
flush,
function(cb) {
requestAnimationFrame(function(){
cb();
});
},
animationFrameFlush,
function(cb){
assert.equal(requests.length, 1);
cb();
Expand All @@ -203,12 +178,7 @@
ajax.params = {param: "value"};
cb();
},
flush,
function(cb) {
requestAnimationFrame(function(){
cb();
});
},
animationFrameFlush,
function(cb){
assert.equal(requests.length, 1);
cb();
Expand All @@ -222,12 +192,7 @@
ajax.body = "bodystuff";
cb();
},
flush,
function(cb) {
requestAnimationFrame(function(){
cb();
});
},
animationFrameFlush,
function(cb){
assert.equal(requests.length, 1);
cb();
Expand All @@ -247,24 +212,14 @@
ajax.auto = false;
cb();
},
flush,
function(cb) {
requestAnimationFrame(function(){
cb();
});
},
animationFrameFlush,
function(cb){;
ajax.handleAs = 'text';
ajax.url = "http://example.com/text"
ajax.auto = true;
cb();
},
flush,
function(cb) {
requestAnimationFrame(function(){
cb();
});
}
animationFrameFlush,
], done);
responded = false;
});
Expand Down

0 comments on commit 1f646f5

Please sign in to comment.