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

Commit

Permalink
Bug 1120346 - Interropt the event only when the search window has a f…
Browse files Browse the repository at this point in the history
…ront window, r=alive
  • Loading branch information
evanxd committed Jan 29, 2015
1 parent 52e714d commit c9fcd3f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 12 deletions.
6 changes: 2 additions & 4 deletions apps/system/js/rocketbar.js
Expand Up @@ -204,10 +204,8 @@
},

'_handle_system-resize': function() {
if (this.isActive()) {
if (this.searchWindow.frontWindow) {
this.searchWindow.frontWindow.resize();
}
if (this.isActive() && this.searchWindow.frontWindow) {
this.searchWindow.frontWindow.resize();
return false;
}
return true;
Expand Down
36 changes: 28 additions & 8 deletions apps/system/test/unit/rocketbar_test.js
Expand Up @@ -589,14 +589,34 @@ suite('system/Rocketbar', function() {
assert.ok(setInputStub.calledWith(''));
});

test('handle hierarchy event - system-resize', function() {
subject.activate();
subject.searchWindow.frontWindow = {
resize: function() {}
};
var stub = this.sinon.stub(subject.searchWindow.frontWindow, 'resize');
subject.respondToHierarchyEvent(new CustomEvent('system-resize'));
assert.ok(stub.calledOnce);
suite('handle hierarchy event - system-resize', function() {
setup(function() {
subject.activate();
});

teardown(function() {
subject.searchWindow.frontWindow = undefined;
});

test('Search window with front window', function() {
subject.searchWindow.frontWindow = {
resize: function() {}
};
var stub = this.sinon.stub(subject.searchWindow.frontWindow, 'resize');
var respond =
subject.respondToHierarchyEvent(new CustomEvent('system-resize'));

assert.ok(stub.calledOnce);
assert.isFalse(respond);

stub.restore();
});

test('Search window without front window', function() {
var respond =
subject.respondToHierarchyEvent(new CustomEvent('system-resize'));
assert.isTrue(respond);
});
});

test('_handle_home', function() {
Expand Down

0 comments on commit c9fcd3f

Please sign in to comment.