Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix re-opening before closing animation end and vice versa
- Loading branch information
1 parent
ed9a39e
commit 04d26e8
Showing
3 changed files
with
113 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<!doctype html> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<title>vaadin-overlay tests</title> | ||
<script src="../../web-component-tester/browser.js"></script> | ||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script> | ||
<link rel="import" href="../../test-fixture/test-fixture.html"> | ||
<link rel="import" href="../vaadin-overlay.html"> | ||
</head> | ||
|
||
<body> | ||
|
||
<test-fixture id="default"> | ||
<template> | ||
<vaadin-overlay> | ||
<template> | ||
overlay-content | ||
</template> | ||
</vaadin-overlay> | ||
</template> | ||
</test-fixture> | ||
|
||
<script> | ||
describe('animated overlay', () => { | ||
let overlay; | ||
|
||
beforeEach(() => { | ||
overlay = fixture('default'); | ||
|
||
sinon.stub(overlay, '_shouldAnimate', () => true); | ||
|
||
sinon.stub(overlay, '_enqueueAnimation', type => { | ||
const handler = `__${type}Handler`; | ||
overlay[handler] = Polymer.Debouncer.debounce(overlay[handler], Polymer.Async.timeOut, () => { | ||
overlay.removeAttribute(type); | ||
}); | ||
}); | ||
|
||
sinon.stub(overlay, '_flushAnimation', type => { | ||
const handler = `__${type}Handler`; | ||
overlay[handler].flush(); | ||
}); | ||
}); | ||
|
||
it('should remove overlay when closed while opening animation is in progress', () => { | ||
overlay.opened = true; | ||
overlay._flushAnimation('opening'); | ||
|
||
overlay.opened = false; | ||
overlay.opened = true; | ||
|
||
expect(overlay.hasAttribute('closing')).to.be.false; | ||
}); | ||
|
||
it('should remove overlay when closed while opening animation is in progress', () => { | ||
overlay.opened = true; | ||
overlay.opened = false; | ||
|
||
expect(overlay.hasAttribute('opening')).to.be.false; | ||
}); | ||
}); | ||
</script> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters