Skip to content

Commit

Permalink
Fix flakey attached/detached timing test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Orvell committed May 18, 2016
1 parent 409ad83 commit 04da868
Showing 1 changed file with 29 additions and 16 deletions.
45 changes: 29 additions & 16 deletions test/unit/attach-detach-timing.html
Expand Up @@ -52,22 +52,35 @@
<body>
<attach-detach id="ad"></attach-detach>
<script>
var ad = document.getElementById('ad');
ad.remove();
var el = document.createElement('attach-detach');
document.body.appendChild(el);
el.remove();
test('attach() and detach() are correct for upgraded elements', function() {
checkOrder(ad);
});
test('attach() and detach() are correct for imperative elements', function() {
checkOrder(el);
});
test('attach() and detach() are correct for elements made after load', function() {
var e = document.createElement('attach-detach');
document.body.appendChild(e);
e.remove();
checkOrder(e);
suite('attached-detached timing', function() {

var ad = document.getElementById('ad');
ad.remove();
var el = document.createElement('attach-detach');
document.body.appendChild(el);
el.remove();

test('attach() and detach() are correct for upgraded elements', function(done) {
Polymer.RenderStatus.whenReady(function() {
checkOrder(ad);
done();
});
});
test('attach() and detach() are correct for imperative elements', function(done) {
Polymer.RenderStatus.whenReady(function() {
checkOrder(el);
done();
});
});
test('attach() and detach() are correct for elements made after load', function(done) {
Polymer.RenderStatus.whenReady(function() {
var e = document.createElement('attach-detach');
document.body.appendChild(e);
e.remove();
checkOrder(e);
done();
});
});
});
</script>
</body>
Expand Down

0 comments on commit 04da868

Please sign in to comment.