layout/style/test/test_bug716226.html

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=716226
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <meta charset="utf-8">
michael@0 8 <title>Test for Bug 716226</title>
michael@0 9 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
michael@0 11 <style id="s">
michael@0 12 @keyframes foo { }
michael@0 13 </style>
michael@0 14 </head>
michael@0 15 <body>
michael@0 16 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=716226">Mozilla Bug 716226</a>
michael@0 17 <p id="display"></p>
michael@0 18 <div id="content" style="display: none">
michael@0 19
michael@0 20 </div>
michael@0 21 <pre id="test">
michael@0 22 <script type="application/javascript">
michael@0 23
michael@0 24 /** Test for Bug 716226 **/
michael@0 25 var sheet = $("s").sheet;
michael@0 26 var rules = sheet.cssRules;
michael@0 27 is(rules.length, 1, "Should have one keyframes rule");
michael@0 28 var keyframesRule = rules[0];
michael@0 29 var keyframeRules = keyframesRule.cssRules;
michael@0 30 is(keyframeRules.length, 0, "Should have no keyframe rules yet");
michael@0 31
michael@0 32 keyframesRule.appendRule('0% { }');
michael@0 33 is(keyframeRules.length, 1, "Should have a keyframe rule now");
michael@0 34 var keyframeRule = keyframeRules[0];
michael@0 35 is(keyframeRule.parentRule, keyframesRule,
michael@0 36 "Parent of keyframe should be keyframes");
michael@0 37 is(keyframeRule.parentStyleSheet, sheet,
michael@0 38 "Parent stylesheet of keyframe should be our sheet");
michael@0 39
michael@0 40 is(keyframeRule.style.cssText, "", "Should have no declarations yet");
michael@0 41 // Note: purposefully non-canonical cssText string so we can make sure we
michael@0 42 // really invoked the CSS parser and serializer.
michael@0 43 keyframeRule.style.cssText = "color:green";
michael@0 44 is(keyframeRule.style.cssText, "color: green;",
michael@0 45 "Should have the declarations we set now");
michael@0 46
michael@0 47
michael@0 48
michael@0 49 </script>
michael@0 50 </pre>
michael@0 51 </body>
michael@0 52 </html>

mercurial