get-test.js revision 9128cdadc891d69f01e5b4ea8c0d212a7f91e8a6
supports = {
// True if this browser should call an onFailure callback on a link
// that 404s. Currently only Firefox 9+ supports this.
// True if this browser should call an onFailure callback on a
// script that 404s.
jsFailure: !((ua.ie && ua.ie < 9) || (ua.opera && ua.opera < 11.6) || (ua.webkit && ua.webkit < 530.17))
};
}
}
if (typeof urls === "string") {
} else {
}
}
return urls;
}
name: "Script Tests",
setUp: function() {
G_SCRIPTS = [];
},
tearDown: function() {
if (this.o) {
this.o.purge();
}
this.removeInsertBeforeNode();
},
createInsertBeforeNode: function() {
},
removeInsertBeforeNode: function() {
if (this.ib) {
}
},
_should: {
ignore: {
}
},
'test: single script, success': function() {
var test = this;
var progress = [];
var counts = {
success:0,
failure:0
};
onProgress: function(o) {
},
onSuccess: function(o) {
var context = this;
test.o = o;
});
},
onFailure: function(o) {
test.o = o;
});
}
});
this.wait();
},
// TODO: need to test abort()
'test: single script, failure': function() {
var test = this;
var counts = {
success:0,
failure:0
};
onSuccess: function(o) {
test.o = o;
});
},
onFailure: function(o) {
var context = this;
test.o = o;
});
}
});
this.wait();
},
'test: single script success, end': function() {
var test = this;
var counts = {
success:0,
failure:0,
end:0
};
onSuccess: function() {
},
onFailure: function() {
},
onEnd: function(o) {
var context = this;
test.o = o;
});
}
});
this.wait();
},
'test: single script failure, end': function() {
var test = this;
var counts = {
success:0,
failure:0,
end:0
};
onFailure: function() {
},
onSuccess: function() {
},
onEnd : function(o) {
var context = this;
test.o = o;
});
}
});
this.wait();
},
'test: multiple scripts, success': function() {
var test = this;
var progress = [];
var counts = {
success:0,
failure:0
};
onFailure: function(o) {
test.o = o;
});
},
onProgress: function(o) {
},
onSuccess: function(o) {
var context = this;
test.o = o;
});
}
});
this.wait();
},
'test: multiple scripts, one failure': function() {
var test = this;
var counts = {
success:0,
failure:0
};
onSuccess: function(o) {
test.o = o;
});
},
onFailure: function(o) {
var context = this;
test.o = o;
});
}
});
this.wait();
},
'test: multiple scripts, success, end': function() {
var test = this;
var progress = [];
var counts = {
success:0,
failure:0,
end:0
};
onSuccess: function() {
},
onProgress: function(o) {
},
onFailure: function() {
},
onEnd: function(o) {
var context = this;
test.o = o;
});
}
});
this.wait();
},
'test: multiple scripts, failure, end': function() {
var test = this;
var counts = {
success:0,
failure:0,
end:0
};
onSuccess: function() {
},
onFailure: function() {
},
onEnd: function(o) {
var context = this;
test.o = o;
});
}
});
this.wait();
},
'test: async multiple scripts, success': function() {
var test = this;
var progress = [];
var counts = {
success:0,
failure:0
};
onFailure: function(o) {
test.o = o;
});
},
onProgress: function(o) {
},
onSuccess: function(o) {
var context = this;
test.o = o;
});
},
async:true
});
this.wait();
},
'test: async multiple scripts, success, end': function() {
var test = this;
var counts = {
success:0,
failure:0,
end:0
};
onSuccess: function() {
},
onFailure: function() {
},
onEnd: function(o) {
var context = this;
test.o = o;
});
},
async:true
});
this.wait();
},
// THE ASYNC FAILURE TESTS NEED TO BE AT THE END,
// BECAUSE ABORTING THEM WILL NOT STOP PARALLEL SCRIPTS
// FROM DOWNLOADING (at least currently) AND SINCE WE USE
// A GLOBAL, IT POLLUTES THE NEXT SUCCESS TEST
// TODO: Maybe we can explore the idea of moving from global to something instance based?
'test: async multiple script, failure': function() {
var test = this;
var counts = {
success:0,
failure:0
};
onSuccess: function(o) {
test.o = o;
});
},
onFailure: function(o) {
var context = this;
test.o = o;
});
},
async:true
});
this.wait();
},
'test: async multiple script, failure, end': function() {
var test = this;
var counts = {
success:0,
failure:0,
end:0
};
onSuccess: function() {
},
onFailure: function() {
},
onEnd: function(o) {
var context = this;
test.o = o;
});
},
async:true
});
this.wait();
},
'test: insertBefore, single' : function() {
var test = this;
insertBefore: "insertBeforeMe",
onSuccess: function(o) {
test.o = o;
});
},
onFailure: function(o) {
test.o = o;
});
}
});
this.wait();
},
'test: insertBefore, multiple' : function() {
var test = this;
insertBefore: "insertBeforeMe",
onSuccess: function(o) {
insertBefore = n;
}
test.o = o;
});
},
onFailure: function(o) {
test.o = o;
});
}
});
this.wait();
},
'test: async, insertBefore, multiple' : function() {
var test = this;
insertBefore: "insertBeforeMe",
onSuccess: function(o) {
insertBefore = n;
}
test.o = o;
});
},
onFailure: function(o) {
test.o = o;
});
},
async:true
});
this.wait();
},
'test: charset, single' : function() {
var test = this;
charset: "ISO-8859-1",
onSuccess: function(o) {
test.o = o;
});
},
onFailure: function(o) {
test.o = o;
});
}
});
this.wait();
},
'test: charset, multiple' : function() {
var test = this;
charset: "ISO-8859-1",
onSuccess: function(o) {
}
test.o = o;
});
},
onFailure: function(o) {
test.o = o;
});
}
});
this.wait();
},
'test: async, charset, multiple' : function() {
var test = this;
charset: "ISO-8859-1",
onSuccess: function(o) {
}
test.o = o;
});
},
onFailure: function(o) {
test.o = o;
});
},
async :true
});
this.wait();
},
'test: attributes, single' : function() {
var test = this;
attributes: {
"charset": "ISO-8859-1",
"title" : "myscripts",
"id" : "my-awesome-script"
},
onSuccess: function(o) {
test.o = o;
});
},
onFailure: function(o) {
test.o = o;
});
}
});
this.wait();
},
'test: attributes, multiple' : function() {
var test = this;
attributes: {
"charset": "ISO-8859-1",
"title" : "myscripts"
},
onSuccess: function(o) {
}
test.o = o;
});
},
onFailure: function(o) {
test.o = o;
});
}
});
this.wait();
},
'test: async, attributes, multiple' : function() {
var test = this;
attributes: {
"charset": "ISO-8859-1",
"title" : "myscripts"
},
onSuccess: function(o) {
}
test.o = o;
});
},
onFailure: function(o) {
test.o = o;
});
},
async :true
});
this.wait();
},
'ignore: abort' : function() {
// Covered above, but worth testing payload also
},
'ignore: timeout' : function() {
// Need delay.js always available to test this reliably. Leaving out for now
},
'test: purgethreshold' : function() {
var test = this;
var nodes = [];
var nodeIds = [];
// Purge only happens at the start of a queue call.
onSuccess: function(o) {
onSuccess: function(o) {
// Convert to id, for final doc check, because purge destroys parentNode
}
purgethreshold: 1,
onSuccess: function(o) {
Y.Assert.isNull(document.getElementById(nodeIds[i]), "Script from previous transaction was not purged");
}
test.o = o;
});
}
});
}
});
}
});
this.wait();
}
});
// -- CSS Tests ------------------------------------------------------------
name: "CSS Tests",
setUp: function() {
},
tearDown: function() {
this.o && this.o.purge();
this.removeInsertBeforeNode();
},
_should: {
ignore: {
}
},
createInsertBeforeNode: function() {
this.ib = Y.Node.create('<link id="insertBeforeMe" href="' + path("ib.css?delay=0") + '" rel="stylesheet" type="text/css" charset="utf-8">');
},
removeInsertBeforeNode: function() {
if (this.ib) {
}
},
'test: single css, success': function() {
var test = this;
var counts = {
success:0,
failure:0
};
onSuccess: function(o) {
var context = this;
test.o = o;
});
},
onFailure: function(o) {
}
});
},
'test: multiple css, success': function() {
var test = this;
var counts = {
success:0,
failure:0
};
onFailure: function(o) {
},
onSuccess: function(o) {
var context = this;
test.o = o;
});
}
});
},
'test: insertBefore, single' : function() {
var test = this;
insertBefore: "insertBeforeMe",
onSuccess: function(o) {
// TODO: These don't work as expected on IE (even though insertBefore worked). Better cross-browser assertion?
Y.Assert.areEqual("9991", this.na.getComputedStyle("zIndex"), "a.css does not seem to be inserted before ib.css");
}
test.o = o;
});
}
});
},
'test: insertBefore, multiple' : function() {
var test = this;
insertBefore: "insertBeforeMe",
onSuccess: function(o) {
insertBefore = n;
}
// TODO: These don't work as expected on IE (even though insertBefore worked). Better cross-browser assertion?
Y.Assert.areEqual("9991", this.na.getComputedStyle("zIndex"), "a.css does not seem to be inserted before ib.css");
Y.Assert.areEqual("9992", this.nb.getComputedStyle("zIndex"), "b.css does not seem to be inserted before ib.css");
Y.Assert.areEqual("9993", this.nc.getComputedStyle("zIndex"), "c.css does not seem to be inserted before ib.css");
}
test.o = o;
});
}
});
},
'test: charset, single' : function() {
var test = this;
charset: "ISO-8859-1",
onSuccess: function(o) {
test.o = o;
});
}
});
},
'test: charset, multiple' : function() {
var test = this;
charset: "ISO-8859-1",
onSuccess: function(o) {
}
test.o = o;
});
}
});
},
'test: attributes, single' : function() {
var test = this;
attributes: {
"charset": "ISO-8859-1",
"title": "myscripts"
},
onSuccess: function(o) {
test.o = o;
});
}
});
},
'test: attributes, multiple' : function() {
var test = this;
attributes: {
"charset": "ISO-8859-1",
"title": "myscripts"
},
onSuccess: function(o) {
}
test.o = o;
});
}
});
},
'test: single css, failure': function() {
var test = this;
var counts = {
success:0,
failure:0
};
onSuccess: function(o) {
});
},
onFailure: function(o) {
});
},
onEnd: function(o) {
test.o = o;
}
});
},
'test: multiple css, failure': function() {
var test = this;
var counts = {
success:0,
failure:0
};
onSuccess: function(o) {
});
},
onFailure: function(o) {
Y.Assert.areNotEqual("1234", this.nb.getComputedStyle("zIndex"), "b.css was loaded when it shouldn't have been");
}
test.o = o;
});
},
onEnd: function(o) {
test.o = o;
}
});
this.wait();
}
});
name: "Functional Tests",
'test: Loader, ScrollView' : function() {
var test = this;
});
});
this.wait();
},
'test: Loader, Autocomplete' : function() {
var test = this;
});
});
this.wait();
}
});
});