Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Commit

Permalink
fix timing
Browse files Browse the repository at this point in the history
  • Loading branch information
valdrinkoshi committed Mar 13, 2018
1 parent 68dbf84 commit e2c339c
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions test/paper-dialog.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,17 @@
dialog.addEventListener('animationend', spy);
dialog.open();
dialog.addEventListener('iron-overlay-opened', function() {
// Wait a RAF so that `animationend` can propagate up and be captured by `spy`.
// Wait for `animationend` to propagate up.
requestAnimationFrame(function() {
assert.equal(spy.callCount, 0, 'no open animation');
dialog.close();
dialog.addEventListener('iron-overlay-closed', function() {
// Wait a RAF so that `animationend` can propagate up and be captured by `spy`.
requestAnimationFrame(function() {
assert.equal(spy.callCount, 0, 'no close animation');
done();
});
});
});
});
dialog.addEventListener('iron-overlay-closed', function() {
// Wait for `animationend` to propagate up.
requestAnimationFrame(function() {
assert.equal(spy.callCount, 0, 'no close animation');
done();
});
});
});
Expand All @@ -123,14 +123,14 @@
dialog.addEventListener('animationend', spy);
dialog.open();
dialog.addEventListener('iron-overlay-opened', function() {
// Wait a RAF so that `animationend` can propagate up and be captured by `spy`.
// Wait for `animationend` to propagate up.
requestAnimationFrame(function() {
assert.equal(spy.callCount, 1, 'open animation ok');
dialog.close();
});
});
dialog.addEventListener('iron-overlay-closed', function() {
// Wait a RAF so that `animationend` can propagate up and be captured by `spy`.
// Wait for `animationend` to propagate up.
requestAnimationFrame(function() {
assert.equal(spy.callCount, 2, 'close animation ok');
done();
Expand All @@ -144,7 +144,7 @@
dialog.addEventListener('animationend', spy);
dialog.open();
dialog.addEventListener('iron-overlay-opened', function() {
// Wait a RAF so that `animationend` can propagate up and be captured by `spy`.
// Wait for `animationend` to propagate up.
requestAnimationFrame(function() {
assert.equal(spy.callCount, 0, 'open animation ok');
done();
Expand All @@ -155,12 +155,18 @@
test('should remove animation classes when done animating', function(done) {
dialog.open();
dialog.addEventListener('iron-overlay-opened', function() {
assert.isFalse(dialog.classList.contains(dialog.entryAnimation), 'no entry animation class');
dialog.close();
// Classes are updated after the event is fired.
setTimeout(function() {
assert.isFalse(dialog.classList.contains(dialog.entryAnimation), 'no entry animation class');
dialog.close();
});
});
dialog.addEventListener('iron-overlay-closed', function() {
assert.isFalse(dialog.classList.contains(dialog.exitAnimation), 'no exit animation class');
done();
// Classes are updated after the event is fired.
setTimeout(function() {
assert.isFalse(dialog.classList.contains(dialog.exitAnimation), 'no exit animation class');
done();
});
});
});

Expand Down

0 comments on commit e2c339c

Please sign in to comment.