mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1088672 - Part 6. Rewrite Loop's incoming call handling in the flux style. Fix window titles for the incoming call view. r=mikedeboer
This commit is contained in:
parent
cab5a8b9ad
commit
fcf1584a61
@ -124,8 +124,6 @@ loop.conversationViews = (function(mozL10n) {
|
||||
render: function() {
|
||||
var contactName = _getContactDisplayName(this.props.contact);
|
||||
|
||||
document.title = contactName;
|
||||
|
||||
return (
|
||||
React.createElement("div", {className: "call-window"},
|
||||
React.createElement(CallIdentifierView, {
|
||||
@ -966,6 +964,7 @@ loop.conversationViews = (function(mozL10n) {
|
||||
var CallControllerView = React.createClass({displayName: "CallControllerView",
|
||||
mixins: [
|
||||
sharedMixins.AudioMixin,
|
||||
sharedMixins.DocumentTitleMixin,
|
||||
loop.store.StoreMixin("conversationStore"),
|
||||
Backbone.Events
|
||||
],
|
||||
@ -995,7 +994,7 @@ loop.conversationViews = (function(mozL10n) {
|
||||
* Used to setup and render the feedback view.
|
||||
*/
|
||||
_renderFeedbackView: function() {
|
||||
document.title = mozL10n.get("conversation_has_ended");
|
||||
this.setTitle(mozL10n.get("conversation_has_ended"));
|
||||
|
||||
return (
|
||||
React.createElement(sharedViews.FeedbackView, {
|
||||
@ -1033,6 +1032,14 @@ loop.conversationViews = (function(mozL10n) {
|
||||
},
|
||||
|
||||
render: function() {
|
||||
// Set the default title to the contact name or the callerId, note
|
||||
// that views may override this, e.g. the feedback view.
|
||||
if (this.state.contact) {
|
||||
this.setTitle(_getContactDisplayName(this.state.contact));
|
||||
} else {
|
||||
this.setTitle(this.state.callerId || "");
|
||||
}
|
||||
|
||||
switch (this.state.callState) {
|
||||
case CALL_STATES.CLOSE: {
|
||||
this._closeWindow();
|
||||
|
@ -124,8 +124,6 @@ loop.conversationViews = (function(mozL10n) {
|
||||
render: function() {
|
||||
var contactName = _getContactDisplayName(this.props.contact);
|
||||
|
||||
document.title = contactName;
|
||||
|
||||
return (
|
||||
<div className="call-window">
|
||||
<CallIdentifierView
|
||||
@ -966,6 +964,7 @@ loop.conversationViews = (function(mozL10n) {
|
||||
var CallControllerView = React.createClass({
|
||||
mixins: [
|
||||
sharedMixins.AudioMixin,
|
||||
sharedMixins.DocumentTitleMixin,
|
||||
loop.store.StoreMixin("conversationStore"),
|
||||
Backbone.Events
|
||||
],
|
||||
@ -995,7 +994,7 @@ loop.conversationViews = (function(mozL10n) {
|
||||
* Used to setup and render the feedback view.
|
||||
*/
|
||||
_renderFeedbackView: function() {
|
||||
document.title = mozL10n.get("conversation_has_ended");
|
||||
this.setTitle(mozL10n.get("conversation_has_ended"));
|
||||
|
||||
return (
|
||||
<sharedViews.FeedbackView
|
||||
@ -1033,6 +1032,14 @@ loop.conversationViews = (function(mozL10n) {
|
||||
},
|
||||
|
||||
render: function() {
|
||||
// Set the default title to the contact name or the callerId, note
|
||||
// that views may override this, e.g. the feedback view.
|
||||
if (this.state.contact) {
|
||||
this.setTitle(_getContactDisplayName(this.state.contact));
|
||||
} else {
|
||||
this.setTitle(this.state.callerId || "");
|
||||
}
|
||||
|
||||
switch (this.state.callState) {
|
||||
case CALL_STATES.CLOSE: {
|
||||
this._closeWindow();
|
||||
|
@ -96,6 +96,7 @@ describe("loop.conversationViews", function () {
|
||||
fakeWindow = {
|
||||
navigator: { mozLoop: fakeMozLoop },
|
||||
close: sinon.stub(),
|
||||
document: {},
|
||||
addEventListener: function() {},
|
||||
removeEventListener: function() {}
|
||||
};
|
||||
@ -172,28 +173,6 @@ describe("loop.conversationViews", function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe("ConversationDetailView", function() {
|
||||
function mountTestComponent(props) {
|
||||
return TestUtils.renderIntoDocument(
|
||||
React.createElement(loop.conversationViews.ConversationDetailView, props));
|
||||
}
|
||||
|
||||
it("should set the document title to the calledId", function() {
|
||||
mountTestComponent({contact: contact});
|
||||
|
||||
expect(document.title).eql("mrsmith");
|
||||
});
|
||||
|
||||
it("should fallback to the email if the contact name is not defined",
|
||||
function() {
|
||||
delete contact.name;
|
||||
|
||||
mountTestComponent({contact: contact});
|
||||
|
||||
expect(document.title).eql("fakeEmail");
|
||||
});
|
||||
});
|
||||
|
||||
describe("PendingConversationView", function() {
|
||||
function mountTestComponent(props) {
|
||||
return TestUtils.renderIntoDocument(
|
||||
@ -605,6 +584,37 @@ describe("loop.conversationViews", function () {
|
||||
});
|
||||
});
|
||||
|
||||
it("should set the document title to the callerId", function() {
|
||||
store.setStoreState({
|
||||
contact: contact
|
||||
});
|
||||
|
||||
mountTestComponent();
|
||||
|
||||
expect(fakeWindow.document.title).eql("mrsmith");
|
||||
});
|
||||
|
||||
it("should fallback to the contact email if the contact name is not defined", function() {
|
||||
delete contact.name;
|
||||
store.setStoreState({
|
||||
contact: contact
|
||||
});
|
||||
|
||||
mountTestComponent({contact: contact});
|
||||
|
||||
expect(fakeWindow.document.title).eql("fakeEmail");
|
||||
});
|
||||
|
||||
it("should fallback to the caller id if no contact is defined", function() {
|
||||
store.setStoreState({
|
||||
callerId: "fakeId"
|
||||
});
|
||||
|
||||
mountTestComponent({contact: contact});
|
||||
|
||||
expect(fakeWindow.document.title).eql("fakeId");
|
||||
});
|
||||
|
||||
it("should render the CallFailedView when the call state is 'terminated'",
|
||||
function() {
|
||||
store.setStoreState({
|
||||
@ -664,6 +674,14 @@ describe("loop.conversationViews", function () {
|
||||
loop.shared.views.FeedbackView);
|
||||
});
|
||||
|
||||
it("should set the document title to conversation_has_ended when displaying the feedback view", function() {
|
||||
store.setStoreState({callState: CALL_STATES.FINISHED});
|
||||
|
||||
mountTestComponent();
|
||||
|
||||
expect(fakeWindow.document.title).eql("conversation_has_ended");
|
||||
});
|
||||
|
||||
it("should play the terminated sound when the call state is 'finished'",
|
||||
function() {
|
||||
var fakeAudio = {
|
||||
|
@ -54,6 +54,7 @@ describe("loop.conversation", function() {
|
||||
fakeWindow = {
|
||||
navigator: { mozLoop: navigator.mozLoop },
|
||||
close: sinon.stub(),
|
||||
document: {},
|
||||
addEventListener: function() {},
|
||||
removeEventListener: function() {}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user