diff options
Diffstat (limited to 'dom/base/test/test_anonymousContent_manipulate_content.html')
-rw-r--r-- | dom/base/test/test_anonymousContent_manipulate_content.html | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/dom/base/test/test_anonymousContent_manipulate_content.html b/dom/base/test/test_anonymousContent_manipulate_content.html new file mode 100644 index 0000000000..e67bfdfea6 --- /dev/null +++ b/dom/base/test/test_anonymousContent_manipulate_content.html @@ -0,0 +1,41 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=1020244 +--> +<meta charset="utf-8"> +<title>Test for Bug 1020244 - Manipulate content created with the AnonymousContent API</title> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<link rel="stylesheet" href="/tests/SimpleTest/test.css"/> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1020244">Mozilla Bug 1020244</a> +<div> + <div id="test-element" class="test-class" test="test">text content</div> +</div> +<script> + // Insert content + let chromeDocument = SpecialPowers.wrap(document); + let testElement = document.querySelector("div"); + let anonymousContent = chromeDocument.insertAnonymousContent(); + anonymousContent.root.appendChild(testElement.cloneNode(true)); + + // Test getting/setting text content. + is(anonymousContent.root.getElementById("test-element").textContent, + "text content", "Textcontent for the test element is correct"); + + let anonTestElement = anonymousContent.root.getElementById("test-element"); + anonTestElement.textContent = + "updated text content"; + is(anonTestElement.textContent, + "updated text content", + "Textcontent for the test element is correct after update"); + + let anim = anonTestElement.animate([ + { transform: 'translateY(0px)' }, + { transform: 'translateY(-300px)' } + ], 2000); + is(anim.playState, "running", "Animation should be running"); + anim.cancel(); + is(anim.playState, "idle", "Animation should have stopped immediately"); + + chromeDocument.removeAnonymousContent(anonymousContent); +</script> |