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 #30098 from alivedise/bugzilla/1149003/attention-t…
Browse files Browse the repository at this point in the history
…oaster-animation

Bug 1149003 - RAF before doing toaster animation
  • Loading branch information
alivedise committed May 21, 2015
2 parents 208ec11 + a46c3ff commit ed9747b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apps/system/js/attention_toaster.js
Expand Up @@ -76,7 +76,9 @@
break;

case '_closed':
this.processStateChange('init', evt.type);
window.requestAnimationFrame(() => {
this.processStateChange('init', evt.type);
});
break;

case '_lockscreen-appopened':
Expand Down Expand Up @@ -202,4 +204,4 @@
}
};
exports.AttentionToaster = AttentionToaster;
}(window));
}(window));
3 changes: 3 additions & 0 deletions apps/system/test/unit/attention_toaster_test.js
Expand Up @@ -13,6 +13,7 @@ suite('system/AttentionToaster', function() {
var stubById;
mocksForAttentionToaster.attachTestHelpers();
setup(function(done) {
this.sinon.stub(window, 'requestAnimationFrame');
this.sinon.useFakeTimers();
stubById = this.sinon.stub(document, 'getElementById');
stubById.returns(document.createElement('div'));
Expand Down Expand Up @@ -52,6 +53,8 @@ suite('system/AttentionToaster', function() {
at1.start();
assert.isTrue(at1._currentToasterState === 'uninit');
app1.element.dispatchEvent(new CustomEvent('_closed'));
assert.notEqual(at1._currentToasterState, 'closed');
window.requestAnimationFrame.yield();
assert.equal(at1._currentToasterState, 'closed');
});

Expand Down

0 comments on commit ed9747b

Please sign in to comment.