Commit e2bcdce3 authored by Romain Courteaud's avatar Romain Courteaud

Propagate failure parameters.

parent 7e1d09df
......@@ -294,16 +294,23 @@
next_loading_gadget_deferred.resolve(gadget);
}).fail(function () {
// One error during css/js loading
next_loading_gadget_deferred.reject();
next_loading_gadget_deferred.reject.apply(
next_loading_gadget_deferred,
arguments
);
});
}).fail(function () {
// Failed to fetch dependencies information.
next_loading_gadget_deferred.reject();
next_loading_gadget_deferred.reject.apply(
next_loading_gadget_deferred,
arguments
);
});
}).fail(function () {
// Klass not correctly loaded. Reject instanciation
next_loading_gadget_deferred.reject();
next_loading_gadget_deferred.reject.apply(next_loading_gadget_deferred,
arguments);
});
});
......@@ -561,8 +568,8 @@
dfr.reject(jqXHR, "Unexpected content type");
}
})
.fail(function (jqXHR, textStatus, errorThrown) {
dfr.reject(jqXHR, textStatus, errorThrown);
.fail(function () {
dfr.reject.apply(dfr, arguments);
});
}
return dfr.promise();
......@@ -744,7 +751,8 @@
gadget_loading_klass = undefined;
loading_gadget_deferred.resolve();
}).fail(function () {
loading_gadget_deferred.reject();
loading_gadget_deferred.reject.apply(loading_gadget_deferred,
arguments);
});
});
}
......
......@@ -321,7 +321,9 @@
ok(false, "text/plain should fail");
})
.fail(function (jqXHR, textStatus) {
equal("200", jqXHR.status);
equal(jqXHR.status, "200");
equal(textStatus, "Unexpected content type");
equal(jqXHR.getResponseHeader("Content-Type"), "text/plain");
})
.always(function () {
start();
......@@ -347,10 +349,11 @@
stop();
renderJS.declareGadgetKlass(url)
.done(function () {
ok(false, "text/plain should fail");
ok(false, "Non parsable HTML should fail");
})
.fail(function (jqXHR, textStatus) {
equal("200", jqXHR.status);
equal(textStatus, "HTML Parsing failed");
})
.always(function () {
mock.verify();
......@@ -455,7 +458,7 @@
ok(false, "404 should fail");
})
.fail(function (jqXHR, textStatus) {
equal("404", jqXHR.status);
equal(jqXHR.status, "404");
})
.always(function () {
start();
......@@ -474,7 +477,7 @@
ok(false, "404 should fail");
})
.fail(function (jqXHR, textStatus) {
equal("404", jqXHR.status);
equal(jqXHR.status, "404");
})
.always(function () {
start();
......@@ -779,11 +782,34 @@
});
});
// test('clearGadgetKlassList leads to CSS reload', function () {
// // Check that declareCSS reload the CSS
// // after clearGadgetKlassList is called
// ok(false, "not implemented");
// });
test('clearGadgetKlassList leads to CSS reload', function () {
// Check that declareCSS reload the CSS
// after clearGadgetKlassList is called
var url = "data:text/css;base64," +
window.btoa("#qunit-fixture {background-color: blue;}"),
count = $('head').find('link[rel=stylesheet]').length;
stop();
renderJS.declareCSS(url)
.done(function () {
renderJS.clearGadgetKlassList();
equal($('head').find('link[rel=stylesheet]').length, count + 1);
renderJS.declareCSS(url)
.done(function () {
equal($('head').find('link[rel=stylesheet]').length, count + 2);
})
.fail(function (jqXHR, textStatus) {
ok(false, "Failed to load " + textStatus + " " + jqXHR.status);
})
.always(function () {
start();
});
})
.fail(function (jqXHR, textStatus) {
ok(false, "Failed to load " + textStatus + " " + jqXHR.status);
start();
});
});
/////////////////////////////////////////////////////////////////
// RenderJSGadget.getInterfaceList
......@@ -1309,8 +1335,8 @@
.done(function (new_gadget) {
ok(false);
})
.fail(function () {
ok(true);
.fail(function (jqXHR, textStatus) {
equal("404", jqXHR.status);
})
.always(function () {
start();
......@@ -1340,8 +1366,9 @@
.done(function (new_gadget) {
ok(false);
})
.fail(function () {
ok(true);
.fail(function (jqXHR, textStatus) {
equal(jqXHR.status, 404);
equal(textStatus, "error");
})
.always(function () {
start();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment