Skip to content

Commit

Permalink
Web Animations: Add test for Document::getAnimations across iframes (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenmcgruer authored and birtles committed May 6, 2018
1 parent 081648f commit b8639ae
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions web-animations/interfaces/Document/getAnimations.html
Expand Up @@ -64,5 +64,26 @@
'elements in this document');
}, 'Test document.getAnimations with null target');

async_test(t => {
const iframe = document.createElement('iframe');

iframe.addEventListener("load", t.step_func_done(function() {
const div = createDiv(t, iframe.contentDocument)
const effect = new KeyframeEffect(div, null, 100 * MS_PER_SEC);
const anim = new Animation(effect, document.timeline);
anim.play();

// The animation's timeline is from the main document, but the effect's
// target element is part of the iframe document and that is what matters
// for getAnimations.
assert_equals(document.getAnimations().length, 0);
assert_equals(iframe.contentDocument.getAnimations().length, 1);
anim.finish();
}));

document.body.appendChild(iframe);
t.add_cleanup(function() { document.body.removeChild(iframe); });
}, 'Test document.getAnimations for elements inside same-origin iframes');

</script>
</body>

0 comments on commit b8639ae

Please sign in to comment.