2013-03-23 01:07:20 +08:00
|
|
|
describe("Task", function() {
|
|
|
|
|
|
|
|
/*
|
|
|
|
when running this test with `grunt jasmine:selfTest -d` you got this output
|
|
|
|
|
|
|
|
[D] ["phantomjs","onLoadFinished","success"]
|
|
|
|
[D] ["phantomjs","onResourceRequested","http://httpbin.org/status/500"]
|
|
|
|
[D] ["phantomjs","onResourceReceived","http://httpbin.org/status/500"]
|
|
|
|
[D] ["phantomjs","onLoadFinished","fail"]
|
|
|
|
[D] ["phantomjs","fail.load","_SpecRunner.html"]
|
|
|
|
|
|
|
|
phantomjs.page.onLoadFinished seems to be called for iframes, too.
|
|
|
|
A failing onLoadFinished caused this grunt taks to hang.
|
|
|
|
Now, after removing the event handler, this following test should work as expected
|
|
|
|
*/
|
2013-11-21 08:46:27 +08:00
|
|
|
it("can handle fail on iframe", function(done){
|
2013-03-23 01:07:20 +08:00
|
|
|
var waitedLongEnough;
|
2013-11-21 08:46:27 +08:00
|
|
|
iframe = document.createElement("iframe");
|
|
|
|
iframe.src = "http://localhost:9000";
|
|
|
|
document.body.appendChild(iframe);
|
2013-03-23 01:07:20 +08:00
|
|
|
|
2013-11-21 08:46:27 +08:00
|
|
|
setTimeout(function(){
|
|
|
|
waitedLongEnough = true;
|
|
|
|
expect(true).toBeTruthy("testing iframes");
|
|
|
|
done();
|
|
|
|
}, 50);
|
2013-03-23 01:07:20 +08:00
|
|
|
});
|
|
|
|
});
|