Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #32335 from albertopq/1188350-title-window-open
Browse files Browse the repository at this point in the history
Bug 1188350 - Setting title on popup windows r=etienne
  • Loading branch information
albertopq committed Oct 9, 2015
2 parents 0f8ea33 + 6b025e2 commit a068470
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions apps/system/js/popup_window.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@
*/
PopupWindow.prototype.openAnimation = 'slide-from-bottom';

PopupWindow.prototype._handle_mozbrowsertitlechange = function(evt) {
this.name = evt.detail;
this.publish('namechanged');
};

/**
* Default closing animation.
*
Expand Down
11 changes: 11 additions & 0 deletions apps/system/test/unit/popup_window_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,15 @@ suite('system/PopupWindow', function() {
var popup = new PopupWindow(hiddenPopupConfig);
assert.isTrue(popup.element.classList.contains('alwaysLowered'));
});

test('Should replace the app name if the title changes', function() {
var name = 'testName';
var popup = new PopupWindow(fakePopupConfig);
this.sinon.stub(popup, 'publish');
assert.isFalse(popup.name === name);
var titleEvent = new CustomEvent('mozbrowsertitlechange', {detail: name});
popup.element.dispatchEvent(titleEvent);
assert.isTrue(popup.name === name);
assert.isTrue(popup.publish.calledWith('namechanged'));
});
});

0 comments on commit a068470

Please sign in to comment.