summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/dom/shadow/shadowhost-keyframes.html
blob: b77cbd4a4e20c9ecae9af202ae7662fc6e41cdd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!doctype html>
<html>
<head>
<style>
@-webkit-keyframes anim {
    from {
        background-color: red;
    }
    to {
        background-color: green;
    }
}
</style>
<script src="../../../resources/js-test.js"></script>
</head>
<body>
  <div id="host"></div>
  <div id="result"></div>
<script>
if (window.testRunner)
    testRunner.waitUntilDone();

function getColor(element) {
    return window.getComputedStyle(element).color;
}

description('Test if @keyframes works for shadow host when using :host. i.e. crbug.com/332577');

var host = document.getElementById('host');
var sr = host.createShadowRoot();
sr.innerHTML = '<style>@-webkit-keyframes anim {'
    + 'from { color: red; } to { color: green; } }'
    + ':host { -webkit-animation: anim 0.5s both; color: red; }</style>'
    + 'I should become green';

window.setTimeout(function() {
    shouldBe("getColor(document.getElementById('host'))", '"rgb(0, 128, 0)"');
    if (window.testRunner)
        testRunner.notifyDone();
}, 1000);
</script>
</body>
</html>