Bug 1065714 - Right-click context menu should not be shown on Panel nor Conversation [r=Mardak]

--HG--
extra : amend_source : 6d4d38370df44f74ff0d526d2b48206483c7fdd5
This commit is contained in:
Fernando Campo 2015-11-05 08:12:20 -08:00
Родитель ed9f1a7319
Коммит 4a37911a65
6 изменённых файлов: 48 добавлений и 7 удалений

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

@ -921,12 +921,17 @@ loop.panel = (function(_, mozL10n) {
window.removeEventListener("GettingStartedSeen", this._gettingStartedSeen);
},
handleContextMenu: function(e) {
e.preventDefault();
},
render: function() {
var NotificationListView = sharedViews.NotificationListView;
if (!this.state.gettingStartedSeen) {
return (
React.createElement("div", {className: "fte-get-started-container"},
React.createElement("div", {className: "fte-get-started-container",
onContextMenu: this.handleContextMenu},
React.createElement(NotificationListView, {
clearOnDocumentHidden: true,
notifications: this.props.notifications}),
@ -941,7 +946,8 @@ loop.panel = (function(_, mozL10n) {
}
return (
React.createElement("div", {className: "panel-content"},
React.createElement("div", {className: "panel-content",
onContextMenu: this.handleContextMenu},
React.createElement("div", {className: "beta-ribbon"}),
React.createElement(NotificationListView, {
clearOnDocumentHidden: true,

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

@ -921,12 +921,17 @@ loop.panel = (function(_, mozL10n) {
window.removeEventListener("GettingStartedSeen", this._gettingStartedSeen);
},
handleContextMenu: function(e) {
e.preventDefault();
},
render: function() {
var NotificationListView = sharedViews.NotificationListView;
if (!this.state.gettingStartedSeen) {
return (
<div className="fte-get-started-container">
<div className="fte-get-started-container"
onContextMenu={this.handleContextMenu}>
<NotificationListView
clearOnDocumentHidden={true}
notifications={this.props.notifications} />
@ -941,7 +946,8 @@ loop.panel = (function(_, mozL10n) {
}
return (
<div className="panel-content">
<div className="panel-content"
onContextMenu={this.handleContextMenu} >
<div className="beta-ribbon" />
<NotificationListView
clearOnDocumentHidden={true}

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

@ -762,6 +762,10 @@ loop.roomViews = (function(mozL10n) {
}
},
handleContextMenu: function(e) {
e.preventDefault();
},
render: function() {
if (this.state.roomName || this.state.roomContextUrls) {
var roomTitle = this.state.roomName ||
@ -807,7 +811,8 @@ loop.roomViews = (function(mozL10n) {
{ id: "help" }
];
return (
React.createElement("div", {className: "room-conversation-wrapper desktop-room-wrapper"},
React.createElement("div", {className: "room-conversation-wrapper desktop-room-wrapper",
onContextMenu: this.handleContextMenu},
React.createElement(sharedViews.MediaLayoutView, {
dispatcher: this.props.dispatcher,
displayScreenShare: false,

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

@ -762,6 +762,10 @@ loop.roomViews = (function(mozL10n) {
}
},
handleContextMenu: function(e) {
e.preventDefault();
},
render: function() {
if (this.state.roomName || this.state.roomContextUrls) {
var roomTitle = this.state.roomName ||
@ -807,7 +811,8 @@ loop.roomViews = (function(mozL10n) {
{ id: "help" }
];
return (
<div className="room-conversation-wrapper desktop-room-wrapper">
<div className="room-conversation-wrapper desktop-room-wrapper"
onContextMenu={this.handleContextMenu}>
<sharedViews.MediaLayoutView
dispatcher={this.props.dispatcher}
displayScreenShare={false}

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

@ -218,6 +218,16 @@ describe("loop.panel", function() {
navigator.mozLoop.fxAEnabled = true;
});
it("should NOT show the context menu on right click", function() {
var prevent = sandbox.stub();
var view = createTestPanelView();
TestUtils.Simulate.contextMenu(
view.getDOMNode(),
{ preventDefault: prevent }
);
sinon.assert.calledOnce(prevent);
});
it("should trigger the FxA sign in/up process when clicking the link",
function() {
navigator.mozLoop.logInToFxA = sandbox.stub();

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

@ -342,6 +342,16 @@ describe("loop.roomViews", function() {
React.createElement(loop.roomViews.DesktopRoomConversationView, props));
}
it("should NOT show the context menu on right click", function() {
var prevent = sandbox.stub();
view = mountTestComponent();
TestUtils.Simulate.contextMenu(
view.getDOMNode(),
{ preventDefault: prevent }
);
sinon.assert.calledOnce(prevent);
});
it("should dispatch a setMute action when the audio mute button is pressed",
function() {
view = mountTestComponent();
@ -690,7 +700,6 @@ describe("loop.roomViews", function() {
expect(fakeWindow.document.title).to.equal("https://fakeurl.com");
});
});
});
describe("Edit Context", function() {