Wed, 31 Dec 2014 07:16:47 +0100
Revert simplistic fix pending revisit of Mozilla integration attempt.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=435441 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 435441</title> |
michael@0 | 8 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 10 | </head> |
michael@0 | 11 | <body> |
michael@0 | 12 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=435441">Mozilla Bug 435441</a> |
michael@0 | 13 | <div id="content" style="display: none"></div> |
michael@0 | 14 | <pre id="test"> |
michael@0 | 15 | <script type="application/javascript"> |
michael@0 | 16 | |
michael@0 | 17 | /** Test for Bug 435441 **/ |
michael@0 | 18 | |
michael@0 | 19 | |
michael@0 | 20 | /* |
michael@0 | 21 | * test that when transition properties are inherited, the length of the |
michael@0 | 22 | * computed value stays the same |
michael@0 | 23 | */ |
michael@0 | 24 | |
michael@0 | 25 | var p = document.getElementById("content"); |
michael@0 | 26 | var c = document.createElement("div"); |
michael@0 | 27 | p.appendChild(c); |
michael@0 | 28 | var cs = getComputedStyle(c, ""); |
michael@0 | 29 | |
michael@0 | 30 | p.style.transitionProperty = "margin-left, margin-right"; |
michael@0 | 31 | c.style.transitionProperty = "inherit"; |
michael@0 | 32 | is(cs.transitionProperty, "margin-left, margin-right", |
michael@0 | 33 | "computed style match with no other properties"); |
michael@0 | 34 | c.style.transitionDuration = "5s"; |
michael@0 | 35 | is(cs.transitionProperty, "margin-left, margin-right", |
michael@0 | 36 | "computed style match with shorter property"); |
michael@0 | 37 | is(cs.transitionDuration, "5s", |
michael@0 | 38 | "shorter property not extended"); |
michael@0 | 39 | c.style.transitionDuration = "5s, 4s, 3s, 2000ms"; |
michael@0 | 40 | is(cs.transitionProperty, "margin-left, margin-right", |
michael@0 | 41 | "computed style match with longer property"); |
michael@0 | 42 | is(cs.transitionDuration, "5s, 4s, 3s, 2s", |
michael@0 | 43 | "longer property computed correctly"); |
michael@0 | 44 | p.style.transitionProperty = ""; |
michael@0 | 45 | c.style.transitionProperty = ""; |
michael@0 | 46 | c.style.transitionDuration = ""; |
michael@0 | 47 | |
michael@0 | 48 | // and repeat the above set of tests with property and duration swapped |
michael@0 | 49 | p.style.transitionDuration = "5s, 4s"; |
michael@0 | 50 | c.style.transitionDuration = "inherit"; |
michael@0 | 51 | is(cs.transitionDuration, "5s, 4s", |
michael@0 | 52 | "computed style match with no other properties"); |
michael@0 | 53 | c.style.transitionProperty = "margin-left"; |
michael@0 | 54 | is(cs.transitionDuration, "5s, 4s", |
michael@0 | 55 | "computed style match with shorter property"); |
michael@0 | 56 | is(cs.transitionProperty, "margin-left", |
michael@0 | 57 | "shorter property not extended"); |
michael@0 | 58 | c.style.transitionProperty = |
michael@0 | 59 | "margin-left, margin-right, margin-top, margin-bottom"; |
michael@0 | 60 | is(cs.transitionDuration, "5s, 4s", |
michael@0 | 61 | "computed style match with longer property"); |
michael@0 | 62 | is(cs.transitionProperty, |
michael@0 | 63 | "margin-left, margin-right, margin-top, margin-bottom", |
michael@0 | 64 | "longer property computed correctly"); |
michael@0 | 65 | p.style.transitionDuration = ""; |
michael@0 | 66 | c.style.transitionDuration = ""; |
michael@0 | 67 | c.style.transitionProperty = ""; |
michael@0 | 68 | |
michael@0 | 69 | // And do the same pair of tests for animations: |
michael@0 | 70 | |
michael@0 | 71 | p.style.animationName = "bounce, roll"; |
michael@0 | 72 | c.style.animationName = "inherit"; |
michael@0 | 73 | is(cs.animationName, "bounce, roll", |
michael@0 | 74 | "computed style match with no other properties"); |
michael@0 | 75 | c.style.animationDuration = "5s"; |
michael@0 | 76 | is(cs.animationName, "bounce, roll", |
michael@0 | 77 | "computed style match with shorter property"); |
michael@0 | 78 | is(cs.animationDuration, "5s", |
michael@0 | 79 | "shorter property not extended"); |
michael@0 | 80 | c.style.animationDuration = "5s, 4s, 3s, 2000ms"; |
michael@0 | 81 | is(cs.animationName, "bounce, roll", |
michael@0 | 82 | "computed style match with longer property"); |
michael@0 | 83 | is(cs.animationDuration, "5s, 4s, 3s, 2s", |
michael@0 | 84 | "longer property computed correctly"); |
michael@0 | 85 | p.style.animationName = ""; |
michael@0 | 86 | c.style.animationName = ""; |
michael@0 | 87 | c.style.animationDuration = ""; |
michael@0 | 88 | |
michael@0 | 89 | // and repeat the above set of tests with name and duration swapped |
michael@0 | 90 | p.style.animationDuration = "5s, 4s"; |
michael@0 | 91 | c.style.animationDuration = "inherit"; |
michael@0 | 92 | is(cs.animationDuration, "5s, 4s", |
michael@0 | 93 | "computed style match with no other properties"); |
michael@0 | 94 | c.style.animationName = "bounce"; |
michael@0 | 95 | is(cs.animationDuration, "5s, 4s", |
michael@0 | 96 | "computed style match with shorter property"); |
michael@0 | 97 | is(cs.animationName, "bounce", |
michael@0 | 98 | "shorter property not extended"); |
michael@0 | 99 | c.style.animationName = |
michael@0 | 100 | "bounce, roll, wiggle, spin"; |
michael@0 | 101 | is(cs.animationDuration, "5s, 4s", |
michael@0 | 102 | "computed style match with longer property"); |
michael@0 | 103 | is(cs.animationName, |
michael@0 | 104 | "bounce, roll, wiggle, spin", |
michael@0 | 105 | "longer property computed correctly"); |
michael@0 | 106 | p.style.animationDuration = ""; |
michael@0 | 107 | c.style.animationDuration = ""; |
michael@0 | 108 | c.style.animationName = ""; |
michael@0 | 109 | |
michael@0 | 110 | </script> |
michael@0 | 111 | </pre> |
michael@0 | 112 | </body> |
michael@0 | 113 | </html> |