Update CSS tests to revision 0698c2aa9ead844b6d7d10eafb096cb1118e13ef

This commit is contained in:
Ms2ger 2015-12-09 01:48:05 -05:00
parent 9aa1b1e408
commit 35c74aecc2
11290 changed files with 92400 additions and 49214 deletions

View file

@ -1,23 +1,23 @@
<!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>
<title>
CSS Values and Units Test:
CSS Values and Units Test:
Checks viewport units against CSS 2.1 properties and the CSSOM
</title>
<meta content="Testing what happens when one applies and rereads viewport unit lengths to CSS 2.1 properties that accept length values" name="assert" />
<link href="mailto:schaepp@gmx.de" rel="author" title="Christian Schaefer" />
<!-- You must have at least one spec link, but may have as many as are covered in the test. -->
<!-- Be sure to make the main testing area first in the order -->
<link href="http://www.w3.org/TR/css3-values/#viewport-relative-lengths" rel="help" />
<!-- testharness inclusion for later submission -->
<!-- testharness inclusion for later submission -->
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!-- testharness fallback for local testing -->
<!-- testharness fallback for local testing -->
<script>
window.test || document.write('\
&lt;script src="http://www.w3c-test.org/resources/testharness.js"&gt;&lt;\/script&gt;\
@ -26,7 +26,7 @@
</script>
<style>
#div {
position: relative;
width: 50vw;
@ -35,17 +35,17 @@
border: 0 green solid;
font-size: 4vw;
}
#table td {
border: 1px solid green;
}
</style>
</head>
<body>
<div id="log"></div>
<p>
Checks viewport units. Also re-check with zoom in/out.
</p>
@ -53,7 +53,7 @@
<div id="div">
Test the Web Forward!
</div>
<table id="table">
<tbody>
<tr>
@ -64,46 +64,46 @@
</tr>
</tbody>
</table>
<script>
/* Boilerplate code */
var camelize = function (str) {
return str.replace(/\-(\w)/g, function(str, letter){
return letter.toUpperCase();
});
};
var retrieveComputedStyle = function(element,property){
var result =
var result =
document
.defaultView
.getComputedStyle(element,null)
.getPropertyValue(property);
// If there are multiple values, cut down to the first
result = result.split(' ')[0];
if(window.console) console.log('Retrieving ' + property + ' property. Result: ' + result);
return result;
}
var testit = function(element,vunit,property,expectedResult){
element.style[camelize(property)] = '0px';
element.style[camelize(property)] = lengthAmount + vunit;
if(window.console) console.log(element.nodeName.toLowerCase() + '.style.' + camelize(property) + ' = ' + lengthAmount + vunit);
var result = retrieveComputedStyle(element,property);
// Test against WebKit's getComputedStyle bug, where it does not return absolute values
// As required here: http://www.w3.org/TR/1998/REC-CSS2-19980512/cascade.html#computed-value
// If it returns a pixel value, but this value is 0px then it is considered a fail, too.
var px_result = result.search(/^[-\d\.]+px$/) !== -1 &amp;&amp; result !== '0px' ? 'non-zero px-based value' : result;
// If browser returns pixel value, we compare against our expected pixel value
if(px_result === 'non-zero px-based value'){
test(function(){
@ -121,14 +121,14 @@
test(function(){
assert_equals(px_result,'non-zero px-based value');
},vunit + ' length applied to ' + property + ': getComputedStyle returns a non-zero px-based value');
element.style[camelize(property)] = '';
}
var lengthAmount = 10;
var layoutViewportWidth = document.documentElement.clientWidth;
var layoutViewportHeight = document.documentElement.clientHeight;
var viewportUnits = [
{
ident: 'vw',
@ -147,7 +147,7 @@
expectedResult: layoutViewportWidth &amp;gt; layoutViewportHeight ? Math.round(layoutViewportWidth * (lengthAmount / 100)) : Math.round(layoutViewportHeight * (lengthAmount / 100))
}
]
// List of length accepting properties and which element they map to
// http://www.w3.org/TR/CSS21/propidx.html
var lengthAcceptingProperties = [
@ -239,12 +239,12 @@
for(unitEntry in viewportUnits){
for(propertyEntry in lengthAcceptingProperties){
var vunit = viewportUnits[unitEntry].ident;
var expectedResult = viewportUnits[unitEntry].expectedResult;
var property = lengthAcceptingProperties[propertyEntry].name;
var element = window[lengthAcceptingProperties[propertyEntry].element];
testit(element,vunit,property,expectedResult);
}
}