| <!DOCTYPE html> |
| <meta charset="UTF-8"> |
| <style> |
| .parent { |
| border-image-slice: 50%; |
| } |
| .target { |
| width: 50px; |
| height: 50px; |
| background-color: black; |
| display: inline-block; |
| border: 25px; |
| border-image-source: linear-gradient(45deg, red, blue, green); |
| border-image-slice: 20%; |
| } |
| .expected { |
| background-color: green; |
| margin-right: 2px; |
| } |
| </style> |
| <body> |
| <script src="resources/interpolation-test.js"></script> |
| <script> |
| assertInterpolation({ |
| property: 'border-image-slice', |
| from: neutralKeyframe, |
| to: '10%', |
| }, [ |
| {at: -0.3, is: '23%'}, |
| {at: 0, is: '20%'}, |
| {at: 0.3, is: '17%'}, |
| {at: 0.5, is: '15%'}, |
| {at: 0.6, is: '14%'}, |
| {at: 1, is: '10%'}, |
| {at: 1.5, is: '5%'}, |
| ]); |
| |
| assertInterpolation({ |
| property: 'border-image-slice', |
| from: 'initial', |
| to: '10%', |
| }, [ |
| {at: -0.3, is: '127%'}, |
| {at: 0, is: '100%'}, |
| {at: 0.3, is: '73%'}, |
| {at: 0.5, is: '55%'}, |
| {at: 0.6, is: '46%'}, |
| {at: 1, is: '10%'}, |
| {at: 1.5, is: '0%'}, |
| ]); |
| |
| assertInterpolation({ |
| property: 'border-image-slice', |
| from: 'inherit', |
| to: '10%', |
| }, [ |
| {at: -0.3, is: '62%'}, |
| {at: 0, is: '50%'}, |
| {at: 0.3, is: '38%'}, |
| {at: 0.5, is: '30%'}, |
| {at: 0.6, is: '26%'}, |
| {at: 1, is: '10%'}, |
| {at: 1.5, is: '0%'}, |
| ]); |
| |
| assertInterpolation({ |
| property: 'border-image-slice', |
| from: 'unset', |
| to: '10%', |
| }, [ |
| {at: -0.3, is: '127%'}, |
| {at: 0, is: '100%'}, |
| {at: 0.3, is: '73%'}, |
| {at: 0.5, is: '55%'}, |
| {at: 0.6, is: '46%'}, |
| {at: 1, is: '10%'}, |
| {at: 1.5, is: '0%'}, |
| ]); |
| |
| assertInterpolation({ |
| property: 'border-image-slice', |
| from: '0%', |
| to: '50%', |
| }, [ |
| {at: -0.3, is: '0%'}, // CSS border-image-slice can't be negative. |
| {at: 0, is: '0%'}, |
| {at: 0.3, is: '15%'}, |
| {at: 0.5, is: '25%'}, |
| {at: 0.6, is: '30%'}, |
| {at: 1, is: '50%'}, |
| {at: 1.5, is: '75%'}, |
| ]); |
| |
| assertInterpolation({ |
| property: 'border-image-slice', |
| from: '0% 10% 20% 30%', |
| to: '40% 50% 60% 70%', |
| }, [ |
| {at: -0.5, is: '0% 0% 0% 10%'}, |
| {at: 0, is: '0% 10% 20% 30%'}, |
| {at: 0.3, is: '12% 22% 32% 42%'}, |
| {at: 0.5, is: '20% 30% 40% 50%'}, |
| {at: 0.6, is: '24% 34% 44% 54%'}, |
| {at: 1, is: '40% 50% 60% 70%'}, |
| {at: 1.5, is: '60% 70% 80% 90%'}, |
| ]); |
| |
| assertInterpolation({ |
| property: 'border-image-slice', |
| from: '0 10 20 30 fill', |
| to: '40 50 60 70 fill', |
| }, [ |
| {at: -0.5, is: '0 0 0 10 fill'}, // CSS border-image-slice can't be negative. |
| {at: 0, is: '0 10 20 30 fill'}, |
| {at: 0.3, is: '12 22 32 42 fill'}, |
| {at: 0.5, is: '20 30 40 50 fill'}, |
| {at: 0.6, is: '24 34 44 54 fill'}, |
| {at: 1, is: '40 50 60 70 fill'}, |
| {at: 1.5, is: '60 70 80 90 fill'}, |
| ]); |
| |
| assertInterpolation({ |
| property: 'border-image-slice', |
| from: '0% 10 20% 30 fill', |
| to: '40% 50 60% 70 fill', |
| }, [ |
| {at: -0.5, is: '0% 0 0% 10 fill'}, // CSS border-image-slice can't be negative. |
| {at: 0, is: '0% 10 20% 30 fill'}, |
| {at: 0.3, is: '12% 22 32% 42 fill'}, |
| {at: 0.5, is: '20% 30 40% 50 fill'}, |
| {at: 0.6, is: '24% 34 44% 54 fill'}, |
| {at: 1, is: '40% 50 60% 70 fill'}, |
| {at: 1.5, is: '60% 70 80% 90 fill'}, |
| ]); |
| |
| assertNoInterpolation({ |
| property: 'border-image-slice', |
| from: '0% fill', |
| to: '50%', |
| }); |
| |
| assertNoInterpolation({ |
| property: 'border-image-slice', |
| from: '50%', |
| to: '100', |
| }); |
| |
| assertNoInterpolation({ |
| property: 'border-image-slice', |
| from: '50% fill', |
| to: '100 fill', |
| }); |
| |
| assertNoInterpolation({ |
| property: 'border-image-slice', |
| from: '0% 10 20% 30 fill', |
| to: '40% 50 60% 70', |
| }); |
| |
| assertNoInterpolation({ |
| property: 'border-image-slice', |
| from: '0% 10 20 30 fill', |
| to: '40 50 60% 70', |
| }); |
| </script> |
| </body> |