mirror of
https://github.com/servo/servo.git
synced 2025-06-23 08:34:42 +01:00
82 lines
No EOL
4.2 KiB
HTML
82 lines
No EOL
4.2 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head>
|
||
<meta charset="utf-8" />
|
||
<title>CSS Transitions Test: Parsing transition shorthand</title>
|
||
<meta content="Test checks that transition shorthand values are parsed properly" name="assert" />
|
||
<link href="http://www.w3.org/TR/css3-transitions/#transition-shorthand-property" rel="help" title="2.5. The 'transition' Shorthand Property" />
|
||
<link href="http://rodneyrehm.de/en/" rel="author" title="Rodney Rehm" />
|
||
<meta content="dom" name="flags" />
|
||
|
||
<script src="/resources/testharness.js" type="text/javascript"></script>
|
||
<script src="/resources/testharnessreport.js" type="text/javascript"></script>
|
||
|
||
<script src="./support/vendorPrefix.js" type="text/javascript"></script>
|
||
<script src="./support/helper.js" type="text/javascript"></script>
|
||
|
||
<script id="metadata_cache">/*
|
||
{
|
||
"parse '1s'": {},
|
||
"parse '1s 2s'": {},
|
||
"parse '1s 2s ease-in'": {},
|
||
"parse '1s ease-in 2s'": {},
|
||
"parse 'ease-in 1s 2s'": {},
|
||
"parse '1s width'": {},
|
||
"parse 'width 1s'": {},
|
||
"parse '1s width 2s'": {},
|
||
"parse '1s 2s width ease-in'": {},
|
||
"parse '1s ease-in 2s width'": {},
|
||
"parse 'width ease-in 1s 2s'": {},
|
||
"parse 'width .1s ease-in .2s'": {}
|
||
}
|
||
*/</script>
|
||
</head>
|
||
<body>
|
||
<!-- required by testharnessreport.js -->
|
||
<div id="log"></div>
|
||
<!-- elements used for testing -->
|
||
<div id="container">
|
||
<div id="transition"></div>
|
||
</div>
|
||
|
||
<script>
|
||
var transition = document.getElementById('transition');
|
||
var ease = 'cubic-bezier(0.25, 0.1, 0.25, 1)';
|
||
var easeIn = 'cubic-bezier(0.42, 0, 1, 1)';
|
||
// Note that order is important in this property. The first value that can be parsed as a time is assigned to
|
||
// the transition-duration. The second value that can be parsed as a time is assigned to transition-delay.
|
||
// [<‘transition-property’> || <‘transition-duration’> || <‘transition-timing-function’> || <‘transition-delay’> [, [<‘transition-property’> || <‘transition-duration’> || <‘transition-timing-function’> || <‘transition-delay’>]]*
|
||
var values = {
|
||
// [property, duration, timing, delay]
|
||
// random order
|
||
'1s' : ["all", "1s", ease, "0s"],
|
||
'1s 2s' : ["all", "1s", ease, "2s"],
|
||
'1s 2s ease-in' : ["all", "1s", easeIn, "2s"],
|
||
'1s ease-in 2s' : ["all", "1s", easeIn, "2s"],
|
||
'ease-in 1s 2s' : ["all", "1s", easeIn, "2s"],
|
||
'1s width' : ["width", "1s", ease, "0s"],
|
||
'width 1s' : ["width", "1s", ease, "0s"],
|
||
'1s width 2s' : ["width", "1s", ease, "2s"],
|
||
'1s 2s width ease-in' : ["width", "1s", easeIn, "2s"],
|
||
'1s ease-in 2s width' : ["width", "1s", easeIn, "2s"],
|
||
'width ease-in 1s 2s' : ["width", "1s", easeIn, "2s"],
|
||
'width .1s ease-in .2s' : ["width", "0.1s", easeIn, "0.2s"]
|
||
};
|
||
|
||
for (var key in values) {
|
||
if (Object.prototype.hasOwnProperty.call(values, key)) {
|
||
test(function() {
|
||
setStyle('#transition', {
|
||
'transition': key
|
||
});
|
||
// WET much?
|
||
assert_equals(computedStyle(transition, 'transition-property'), values[key][0], "transition-property");
|
||
assert_equals(computedStyle(transition, 'transition-duration'), values[key][1], "transition-duration");
|
||
assert_equals(computedStyle(transition, 'transition-timing-function'), values[key][2], "transition-timing-function");
|
||
assert_equals(computedStyle(transition, 'transition-delay'), values[key][3], "transition-delay");
|
||
}, "parse '" + key + "'");
|
||
}
|
||
}
|
||
</script>
|
||
|
||
|
||
</body></html> |