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

Commit

Permalink
Bug 1226133 - Synchronise pages container on window resize. r=alberto…
Browse files Browse the repository at this point in the history
…pq, a=mahe
  • Loading branch information
Cwiiis authored and BavarianTomcat committed Nov 25, 2015
1 parent a70d47c commit b9eb09a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions apps/homescreen/js/pages.js
Expand Up @@ -31,6 +31,7 @@
this.pages.addEventListener('click', this);
this.pages.addEventListener('contextmenu', this);
this.pages.addEventListener('keydown', this);
window.addEventListener('resize', this);

this.done.addEventListener('click', e => {
e.preventDefault();
Expand Down Expand Up @@ -259,6 +260,10 @@
this.launchCard(e.target);
}
break;

case 'resize':
this.pages.synchronise();
break;
}
}
};
Expand Down
9 changes: 9 additions & 0 deletions apps/homescreen/test/unit/pages_test.js
Expand Up @@ -397,5 +397,14 @@ suite('Pages', () => {
assert.isFalse(editModeStub.called);
});
});

suite('resize', () => {
test('should call pages.synchronise()', () => {
var synchroniseCalled = false;
pages.pages.synchronise = () => { synchroniseCalled = true; };
pages.handleEvent(new CustomEvent('resize'));
assert.isTrue(synchroniseCalled);
});
});
});
});

0 comments on commit b9eb09a

Please sign in to comment.