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

Commit

Permalink
Bug 1070058 - Create child/dialog windows when FTU is running. r=alive
Browse files Browse the repository at this point in the history
  • Loading branch information
sfoster authored and rvandermeulen committed Oct 10, 2014
1 parent 09fae6f commit a6f6470
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 2 additions & 0 deletions apps/system/js/child_window_factory.js
Expand Up @@ -55,7 +55,9 @@
}

// <a href="" target="_blank"> should never be part of the app
// except while FTU is running: windows must be closable & parented by FTU
if (evt.detail.name == '_blank' &&
!window.System.runningFTU &&
evt.detail.features !== 'attention') {
this.createNewWindow(evt);
evt.stopPropagation();
Expand Down
24 changes: 23 additions & 1 deletion apps/system/test/unit/child_window_factory_test.js
Expand Up @@ -3,6 +3,7 @@
MockActivityWindow, MockPopupWindow, MockSettingsListener */
/* jshint nonew: false */

require('/shared/test/unit/mocks/mock_system.js');
requireApp('system/test/unit/mock_app_window.js');
requireApp('system/test/unit/mock_popup_window.js');
requireApp('system/test/unit/mock_activity_window.js');
Expand All @@ -12,7 +13,7 @@ requireApp('system/test/unit/mock_activity.js');

var mocksForChildWindowFactory = new MocksHelper([
'MozActivity', 'AppWindow', 'ActivityWindow', 'PopupWindow',
'SettingsListener', 'AttentionWindow'
'SettingsListener', 'AttentionWindow', 'System'
]).init();

suite('system/ChildWindowFactory', function() {
Expand Down Expand Up @@ -334,4 +335,25 @@ suite('system/ChildWindowFactory', function() {
assert.isTrue(stubSetOrientation.called);
assert.isTrue(stubRequestForeground.called);
});

suite('runningFTU', function() {
setup(function() {
window.System.runningFTU = true;
});
teardown(function() {
window.System.runningFTU = false;
});

test('> _blank', function() {
var app1 = new MockAppWindow(fakeAppConfig1);
var cwf = new ChildWindowFactory(app1);
var stubCreatePopupWindow = this.sinon.stub(cwf, 'createPopupWindow');
var testEvt = (new CustomEvent('mozbrowseropenwindow', {
detail: fakeWindowOpenBlank
}));
cwf.handleEvent(testEvt);
assert.isTrue(stubCreatePopupWindow.calledOnce);
});
});

});

0 comments on commit a6f6470

Please sign in to comment.