Bug 998271 - L10n notifications, r=dmose

This commit is contained in:
Nicolas Perriault 2014-05-29 21:13:44 +01:00
parent f5b358c5bb
commit b148744fb0
4 changed files with 14 additions and 13 deletions

View File

@ -100,7 +100,7 @@ loop.conversation = (function(OT, mozL10n) {
if (!this._conversation.isSessionReady()) {
console.error("Error: navigated to conversation route without " +
"the start route to initialise the call first");
this._notifier.error(__("cannot_start_call_session_not_ready"));
this._notifier.errorL10n("cannot_start_call_session_not_ready");
return;
}

View File

@ -43,10 +43,7 @@ loop.panel = (function(mozL10n) {
var nickname = this.$("input[name=caller]").val();
var callback = function(err, callUrl) {
if (err) {
this.notifier.notify({
message: __("unable_retrieve_url"),
level: "error"
});
this.notifier.errorL10n("unable_retrieve_url");
return;
}
this.onCallUrlReceived(callUrl);

View File

@ -18,7 +18,9 @@ describe("loop.conversation", function() {
notifier = {
notify: sandbox.spy(),
warn: sandbox.spy(),
error: sandbox.spy()
warnL10n: sandbox.spy(),
error: sandbox.spy(),
errorL10n: sandbox.spy()
};
});
@ -73,9 +75,8 @@ describe("loop.conversation", function() {
router.conversation();
sinon.assert.calledOnce(router.loadView);
sinon.assert.calledWith(router.loadView, sinon.match(function(obj) {
return obj instanceof loop.shared.views.ConversationView;
}));
sinon.assert.calledWith(router.loadView,
sinon.match.instanceOf(loop.shared.views.ConversationView));
});
it("should not load the ConversationView if session is not set",
@ -89,7 +90,9 @@ describe("loop.conversation", function() {
function() {
router.conversation();
sinon.assert.calledOnce(router._notifier.error);
sinon.assert.calledOnce(router._notifier.errorL10n);
sinon.assert.calledWithExactly(router._notifier.errorL10n,
"cannot_start_call_session_not_ready");
});
});

View File

@ -67,12 +67,13 @@ describe("loop.panel", function() {
cb("fake error");
});
var view = new loop.panel.PanelView();
sandbox.stub(view.notifier, "notify");
sandbox.stub(view.notifier, "errorL10n");
view.getCallUrl({preventDefault: sandbox.spy()});
sinon.assert.calledOnce(view.notifier.notify);
sinon.assert.calledWithMatch(view.notifier.notify, {level: "error"});
sinon.assert.calledOnce(view.notifier.errorL10n);
sinon.assert.calledWithExactly(view.notifier.errorL10n,
"unable_retrieve_url");
});
});