summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/css-generated-content/pseudo-animation-display.html
blob: a44bddd5a7188403adce574fde6d286e208a1f7c (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<!DOCTYPE html>
<style>
#target {
    width: 100px;
    height: 100px;
    background-color: red;
}
#target:after {
    display: block;
    position: relative;
    content: "";
    width: 50px;
    height: 50px;
    background-color: blue;    
}
#target.animated:after {
    -webkit-animation: anim 1ms forwards;
    animation: anim 1ms forwards;
}
@-webkit-keyframes anim {
    from {
        left: 0px;
        display: block;
    }
    to {
        left: 100px;
        display: none;
    }
}
@keyframes anim {
    from {
        left: 0px;
        display: block;
    }
    to {
        left: 100px;
        display: none;
    }
}
</style>

<script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

function go() {
    var target = document.getElementById('target');
    target.addEventListener('webkitAnimationEnd', completeTest);
    target.classList.add('animated');
}

function test(style, property, expected) {
    var pass = style[property] === expected;
    document.getElementById('log').innerHTML +=
        (pass ? 'PASS' : 'FAIL') + ': ' + property + ' was ' + (pass ? '' : 'not ') + expected + '<br>';
}

function completeTest(message) {
    var style = getComputedStyle(document.getElementById('target'), ':after');
    test(style, 'left', '100px');
    test(style, 'display', 'block');
    if (window.testRunner) {
        testRunner.notifyDone();
    }
}
</script>

<body onload="go()">
<div>
  Tests that an attempt to animate the display property of a pseudo element is
  ignored, and that the animation proceeds as expected.
</div>
<div id="target"></div>
<div id="log"></div>
</body>