Bug 1208047 - Close the dropdown menu for sharing on Loop's conversation window as soon as an item is clicked, rather than leaving it open in a potentially confusing state. r=mikedeboer

This commit is contained in:
Mark Banner 2015-10-06 16:05:50 +01:00
parent ec703b86f5
commit 8c53d8fd48
3 changed files with 36 additions and 0 deletions

View File

@ -120,10 +120,12 @@ loop.shared.views = (function(_, mozL10n) {
_handleShareTabs: function() {
this._startScreenShare("browser");
this.hideDropdownMenu();
},
_handleShareWindows: function() {
this._startScreenShare("window");
this.hideDropdownMenu();
},
_getTitle: function() {

View File

@ -120,10 +120,12 @@ loop.shared.views = (function(_, mozL10n) {
_handleShareTabs: function() {
this._startScreenShare("browser");
this.hideDropdownMenu();
},
_handleShareWindows: function() {
this._startScreenShare("window");
this.hideDropdownMenu();
},
_getTitle: function() {

View File

@ -176,6 +176,22 @@ describe("loop.shared.views", function() {
new sharedActions.StartScreenShare({ type: "browser" }));
});
it("should close the dropdown on 'browser' option click", function() {
var comp = TestUtils.renderIntoDocument(
React.createElement(sharedViews.ScreenShareControlButton, {
dispatcher: dispatcher,
visible: true,
state: SCREEN_SHARE_STATES.INACTIVE
}));
sandbox.stub(comp, "hideDropdownMenu");
TestUtils.Simulate.click(comp.getDOMNode().querySelector(
".screen-share-menu > li"));
sinon.assert.calledOnce(comp.hideDropdownMenu);
});
it("should dispatch a 'window' StartScreenShare action on option click",
function() {
var comp = TestUtils.renderIntoDocument(
@ -193,6 +209,22 @@ describe("loop.shared.views", function() {
new sharedActions.StartScreenShare({ type: "window" }));
});
it("should close the dropdown on 'window' option click", function() {
var comp = TestUtils.renderIntoDocument(
React.createElement(sharedViews.ScreenShareControlButton, {
dispatcher: dispatcher,
visible: true,
state: SCREEN_SHARE_STATES.INACTIVE
}));
sandbox.stub(comp, "hideDropdownMenu");
TestUtils.Simulate.click(comp.getDOMNode().querySelector(
".screen-share-menu > li:last-child"));
sinon.assert.calledOnce(comp.hideDropdownMenu);
});
it("should have the 'window' option enabled", function() {
var comp = TestUtils.renderIntoDocument(
React.createElement(sharedViews.ScreenShareControlButton, {