Bug 1081079 - Use the DocumentTitleMixin for Loop in more places. r=jaws

This commit is contained in:
Mark Banner 2015-03-17 08:41:25 +00:00
Родитель 1dbad789bb
Коммит c8e33db0c4
4 изменённых файлов: 15 добавлений и 10 удалений

Просмотреть файл

@ -316,7 +316,10 @@ loop.conversationViews = (function(mozL10n) {
* Something went wrong view. Displayed when there's a big problem.
*/
var GenericFailureView = React.createClass({displayName: "GenericFailureView",
mixins: [sharedMixins.AudioMixin],
mixins: [
sharedMixins.AudioMixin,
sharedMixins.DocumentTitleMixin
],
propTypes: {
cancelCall: React.PropTypes.func.isRequired
@ -327,7 +330,7 @@ loop.conversationViews = (function(mozL10n) {
},
render: function() {
document.title = mozL10n.get("generic_failure_title");
this.setTitle(mozL10n.get("generic_failure_title"));
return (
React.createElement("div", {className: "call-window"},

Просмотреть файл

@ -316,7 +316,10 @@ loop.conversationViews = (function(mozL10n) {
* Something went wrong view. Displayed when there's a big problem.
*/
var GenericFailureView = React.createClass({
mixins: [sharedMixins.AudioMixin],
mixins: [
sharedMixins.AudioMixin,
sharedMixins.DocumentTitleMixin
],
propTypes: {
cancelCall: React.PropTypes.func.isRequired
@ -327,7 +330,7 @@ loop.conversationViews = (function(mozL10n) {
},
render: function() {
document.title = mozL10n.get("generic_failure_title");
this.setTitle(mozL10n.get("generic_failure_title"));
return (
<div className="call-window">

Просмотреть файл

@ -8,7 +8,7 @@ describe("loop.conversationViews", function () {
var sharedUtils = loop.shared.utils;
var sharedView = loop.shared.views;
var sandbox, oldTitle, view, dispatcher, contact, fakeAudioXHR;
var sandbox, view, dispatcher, contact, fakeAudioXHR;
var fakeMozLoop, fakeWindow;
var CALL_STATES = loop.store.CALL_STATES;
@ -33,7 +33,6 @@ describe("loop.conversationViews", function () {
sandbox = sinon.sandbox.create();
sandbox.useFakeTimers();
oldTitle = document.title;
sandbox.stub(document.mozL10n, "get", function(x) {
return x;
});
@ -106,7 +105,6 @@ describe("loop.conversationViews", function () {
afterEach(function() {
loop.shared.mixins.setRootObject(window);
document.title = oldTitle;
view = undefined;
delete navigator.mozLoop;
sandbox.restore();
@ -912,5 +910,8 @@ describe("loop.conversationViews", function () {
expect(fakeAudio.loop).to.equal(false);
});
it("should set the title to generic_failure_title", function() {
expect(fakeWindow.document.title).eql("generic_failure_title");
});
});
});

Просмотреть файл

@ -130,7 +130,7 @@ describe("loop.conversation", function() {
});
describe("AppControllerView", function() {
var conversationStore, client, ccView, oldTitle, dispatcher;
var conversationStore, client, ccView, dispatcher;
var conversationAppStore, roomStore;
function mountTestComponent() {
@ -142,7 +142,6 @@ describe("loop.conversation", function() {
}
beforeEach(function() {
oldTitle = document.title;
client = new loop.Client();
dispatcher = new loop.Dispatcher();
conversationStore = new loop.store.ConversationStore(
@ -177,7 +176,6 @@ describe("loop.conversation", function() {
afterEach(function() {
ccView = undefined;
document.title = oldTitle;
});
it("should display the CallControllerView for outgoing calls", function() {