summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-masking/clip-path/animations/clip-path-interpolation-discrete.html
blob: 9c14372006722f313f6c434c93982c836a76bae5 (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>clip-path interpolation with allow-discrete</title>
    <link rel="help" href="https://drafts.fxtf.org/css-masking-1/#the-clip-path">
    <meta name="assert" content="clip-path supports animation with allow-discrete.">
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
    <script src="/css/support/interpolation-testcommon.js"></script>
  </head>
  <style>
    .parent {
      clip-path: circle(farthest-side);
    }
    .target {
      clip-path: circle(10px);
    }
  </style>
  <body>
    <script>
      'use strict';

      test_interpolation({
        property: 'clip-path',
        behavior: 'allow-discrete',
        from: 'circle(10px)',
        to: 'inset(20px)',
      }, [
        {at: -1, expect: 'circle(10px)'},
        {at: 0, expect: 'circle(10px)'},
        {at: 0.4, expect: 'circle(10px)'},
        {at: 0.5, expect: 'inset(20px)'},
        {at: 1, expect: 'inset(20px)'},
        {at: 1.5, expect: 'inset(20px)'},
      ]);

      test_interpolation({
        property: 'clip-path',
        behavior: 'allow-discrete',
        from: 'ellipse()',
        to: 'padding-box',
      }, [
        {at: -1, expect: 'ellipse()'},
        {at: 0, expect: 'ellipse()'},
        {at: 0.4, expect: 'ellipse()'},
        {at: 0.5, expect: 'padding-box'},
        {at: 1, expect: 'padding-box'},
        {at: 1.5, expect: 'padding-box'},
      ]);

      test_interpolation({
        property: 'clip-path',
        behavior: 'allow-discrete',
        from: neutralKeyframe,
        to: 'none',
      }, [
        {at: -1, expect: 'circle(10px)'},
        {at: 0, expect: 'circle(10px)'},
        {at: 0.4, expect: 'circle(10px)'},
        {at: 0.5, expect: 'none'},
        {at: 1, expect: 'none'},
        {at: 1.5, expect: 'none'},
      ]);

      test_interpolation({
        property: 'clip-path',
        behavior: 'allow-discrete',
        from: 'initial',
        to: 'circle()',
      }, [
        {at: -1, expect: 'none'},
        {at: 0, expect: 'none'},
        {at: 0.4, expect: 'none'},
        {at: 0.5, expect: 'circle()'},
        {at: 1, expect: 'circle()'},
        {at: 1.5, expect: 'circle()'},
      ]);

      test_interpolation({
        property: 'clip-path',
        behavior: 'allow-discrete',
        from: 'inherit',
        to: 'circle()',
      }, [
        {at: -0.1, expect: 'circle(farthest-side)'},
        {at: 0, expect: 'circle(farthest-side)'},
        {at: 0.4, expect: 'circle(farthest-side)'},
        {at: 0.5, expect: 'circle()'},
        {at: 1, expect: 'circle()'},
        {at: 1.5, expect: 'circle()'},
      ]);

      test_interpolation({
        property: 'clip-path',
        behavior: 'allow-discrete',
        from: 'unset',
        to: 'inset(10%)',
      }, [
        {at: -0.1, expect: 'none'},
        {at: 0, expect: 'none'},
        {at: 0.4, expect: 'none'},
        {at: 0.5, expect: 'inset(10%)'},
        {at: 1, expect: 'inset(10%)'},
        {at: 1.5, expect: 'inset(10%)'},
      ]);

      test_interpolation({
        property: 'clip-path',
        behavior: 'allow-discrete',
        from: 'stroke-box',
        to: 'url("abc")',
      }, [
        {at: -0.1, expect: 'stroke-box'},
        {at: 0, expect: 'stroke-box'},
        {at: 0.4, expect: 'stroke-box'},
        {at: 0.5, expect: 'url("abc")'},
        {at: 1, expect: 'url("abc")'},
        {at: 1.5, expect: 'url("abc")'},
      ]);

    </script>
  </body>
</html>