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

@ -14,7 +14,7 @@ var suite = root.generalParallelTest = {
data.fixture = document.getElementById('fixture').cloneNode(true);
data.fixture.id = 'test-' + (index++);
(document.getElementById('offscreen') || document.body).appendChild(data.fixture);
// data container for #fixture > .container > .transition
data.transition = {
node: data.fixture.querySelector('.transition'),
@ -34,7 +34,7 @@ var suite = root.generalParallelTest = {
return computedStyle(data.container.node, property);
}
};
// data container for #fixture > .container > .transition[:before | :after]
if (data.pseudo) {
data.pseudo = {
@ -92,13 +92,13 @@ var suite = root.generalParallelTest = {
if (!options.styles) {
options.styles = {};
}
Object.keys(styles).forEach(function(key) {
var selector = '#' + data.fixture.id
// fixture must become #fixture.fixture rather than a child selector
+ (key.substring(0, 8) === '.fixture' ? '' : ' ')
+ key;
options.styles[selector] = styles[key];
});
},
@ -109,7 +109,7 @@ var suite = root.generalParallelTest = {
suite._getStyleFor(data, 'from');
// apply target state
suite._addClass(data, 'to', true);
// grab current styles: "target state"
// grab current styles: "target state"
suite._getStyleFor(data, 'to');
// remove target state
suite._removeClass(data, 'to', true);
@ -157,7 +157,7 @@ var suite = root.generalParallelTest = {
var raf = window.requestAnimationFrame || function(callback){
setTimeout(callback, 20);
};
// flag denoting if the runLoop should continue (true) or exit (false)
options._collectValues = true;
@ -166,19 +166,19 @@ var suite = root.generalParallelTest = {
// test's are done, stop annoying the CPU
return;
}
// collect current style for test's elements
options.tests.forEach(function(data) {
if (!data.property) {
return;
}
['transition', 'container', 'pseudo'].forEach(function(elem) {
var pseudo = null;
if (!data[elem] || (elem === 'pseudo' && !data.pseudo)) {
return;
}
var current = data[elem].computedStyle(data.property);
var values = data[elem].values;
var length = values.length;
@ -187,11 +187,11 @@ var suite = root.generalParallelTest = {
}
});
});
// rinse and repeat
raf(runLoop);
}
runLoop();
},
// stop requestAnimationFrame runLoop collecting computed values
@ -222,7 +222,7 @@ var suite = root.generalParallelTest = {
assert_not_equals(values[1], data[elem].from, "may not be initial value while transitioning on ." + elem);
assert_not_equals(values[1], data[elem].to, "may not be target value while transitioning on ." + elem);
}
// TODO: first value must be initial, last value must be target
};
}

View file

@ -1,6 +1,6 @@
//
//
// Simple Helper Functions For Testing CSS
//
//
(function(root) {
'use strict';
@ -17,7 +17,7 @@ root.setStyle = function(selector, styles) {
target.type = "text/css";
document.getElementsByTagName('head')[0].appendChild(target);
}
var data = [];
// single selector/styles
if (typeof selector === 'string' && styles !== undefined) {
@ -44,7 +44,7 @@ function serializeStyles(styles) {
data.push(prefixedProperty + ":" + styles[property] + ";");
}
}
return data.join('\n');
}

View file

@ -114,7 +114,7 @@ var values = {
data: ['url(data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=)', 'url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==)'],
// A hunch, as from the spec:
// http://www.w3.org/TR/css3-transitions/#animatable-types
// gradient: interpolated via the positions and colors of each stop. They must have the same type (radial or linear) and same number of stops in order to be animated. Note: [CSS3-IMAGES] may extend this definition.
// gradient: interpolated via the positions and colors of each stop. They must have the same type (radial or linear) and same number of stops in order to be animated. Note: [CSS3-IMAGES] may extend this definition.
gradient: [prefix + 'linear-gradient(top, hsl(0, 80%, 70%), #bada55)', prefix + 'linear-gradient(top, #bada55, hsl(0, 80%, 70%))']
};
},
@ -171,39 +171,39 @@ var values = {
var properties = {
'background-color': ['color'],
'background-position': ['length', 'percentage'],
'border-top-width': ['length'],
'border-right-width': ['length'],
'border-bottom-width': ['length'],
'border-left-width': ['length'],
'border-top-color': ['color'],
'border-right-color': ['color'],
'border-bottom-color': ['color'],
'border-left-color': ['color'],
'padding-bottom': ['length'],
'padding-left': ['length'],
'padding-right': ['length'],
'padding-top': ['length'],
'margin-bottom': ['length'],
'margin-left': ['length'],
'margin-right': ['length'],
'margin-top': ['length'],
'height': ['length', 'percentage'],
'width': ['length', 'percentage'],
'min-height': ['length', 'percentage'],
'min-width': ['length', 'percentage'],
'max-height': ['length', 'percentage'],
'max-width': ['length', 'percentage'],
'top': ['length', 'percentage'],
'right': ['length', 'percentage'],
'bottom': ['length', 'percentage'],
'left': ['length', 'percentage'],
'color': ['color'],
'font-size': ['length', 'percentage'],
'font-weight': ['font-weight'],
@ -214,16 +214,16 @@ var properties = {
'word-spacing': ['length', 'percentage'],
'text-indent': ['length', 'percentage'],
'text-shadow': ['shadow'],
'outline-color': ['color'],
// outline-offset <integer> used to be an error in the spec
'outline-offset': ['length'],
'outline-width': ['length'],
'clip': ['rectangle'],
// Note: doesn't seem implemented anywhere
'crop': ['rectangle'],
'vertical-align': ['length', 'percentage'],
'opacity': ['number[0,1]'],
'visibility': ['visibility'],
@ -279,7 +279,7 @@ var unspecified_properties = {
'background-image': ['image'],
'background-size': ['background-size'],
// https://drafts.csswg.org/css3-background/#the-box-shadow
// Animatable: yes, except between inner and outer shadows (Transition to/from an absent shadow is a transition to/from 0 0 transparent or 0 0 transparent inset, as appropriate.)
// Animatable: yes, except between inner and outer shadows (Transition to/from an absent shadow is a transition to/from 0 0 transparent or 0 0 transparent inset, as appropriate.)
'box-shadow': ['box-shadow'],
'font-size-adjust': ['number'],
'font-stretch': ['font-stretch'],
@ -342,7 +342,7 @@ var parent_styles = {
// unspecified properties
'position': {'position': 'relative', 'width': '100px', 'height': '100px'},
// inheritance tests
'top': {'width': '100px', 'height': '100px', 'position': 'relative'},
'top': {'width': '100px', 'height': '100px', 'position': 'relative'},
'right': {'width': '100px', 'height': '100px', 'position': 'relative'},
'bottom': {'width': '100px', 'height': '100px', 'position': 'relative'},
'left': {'width': '100px', 'height': '100px', 'position': 'relative'}
@ -375,7 +375,7 @@ function assemble(props) {
});
});
}
return tests;
}
@ -393,23 +393,23 @@ root.getUnspecifiedPropertyTests = function() {
root.getFontSizeRelativePropertyTests = function() {
var accepted = {};
for (var key in properties) {
if (!Object.prototype.hasOwnProperty.call(properties, key) || key === "font-size") {
continue;
}
if (properties[key].indexOf('length') > -1) {
accepted[key] = ['length-em'];
}
}
return assemble(accepted);
};
root.getAutoPropertyTests = function() {
var accepted = {};
for (var i = 0, key; key = properties_auto[i]; i++) {
accepted[key] = ['auto'];
}
@ -420,17 +420,17 @@ root.getAutoPropertyTests = function() {
root.filterPropertyTests = function(tests, names) {
var allowed = {};
var accepted = [];
if (typeof names === "string") {
names = [names];
}
if (!(names instanceof RegExp)) {
names.forEach(function(name) {
allowed[name] = true;
});
}
tests.forEach(function(test) {
if (names instanceof RegExp) {
if (!test.name.match(names)) {
@ -439,11 +439,11 @@ root.filterPropertyTests = function(tests, names) {
} else if (!allowed[test.name]) {
return;
}
accepted.push(test);
});
return accepted;
};
})(window);
})(window);

View file

@ -13,13 +13,13 @@
{name: "name of test 2", custom: "data"},
// ...
],
// number of tests (tests, not test-cases!) to run concurrently
testsPerSlice: 100,
// time in milliseconds a test-run takes
duration: 1000,
// test-cases to run for for the test - there must be at least one
// each case creates its separate async_test() instance
cases: {
@ -33,17 +33,17 @@
},
// ...
}
// all callbacks are optional:
// invoked for individual test before it starts so you can setup the environment
// like DOM, CSS, adding event listeners and such
setup: function(data, options){},
// invoked after a test ended, so you can clean up the environment
// like DOM, CSS, removing event listeners and such
teardown: function(data, options){},
// invoked before a batch of tests ("slice") are run concurrently
// tests is an array of test data objects
sliceStart: function(options, tests)
@ -60,22 +60,22 @@ root.runParallelAsyncHarness = function(options) {
if (!options.cases) {
throw new Error("Options don't contain test cases!");
}
var noop = function(){};
// add a 100ms buffer to the test timeout, just in case
var duration = Math.ceil(options.duration + 100);
// names of individual tests
var cases = Object.keys(options.cases);
// run tests in a batch of slices
// primarily not to overload weak devices (tablets, phones, …)
// primarily not to overload weak devices (tablets, phones, …)
// with too many tests running simultaneously
var iteration = -1;
var testPerSlice = options.testsPerSlice || 100;
var slices = Math.ceil(options.tests.length / testPerSlice);
// initialize all async test cases
// Note: satisfying testharness.js needs to know all async tests before load-event
options.tests.forEach(function(data, index) {
@ -84,7 +84,7 @@ root.runParallelAsyncHarness = function(options) {
data.cases[name] = async_test(data.name + " / " + name, {timeout: options.timeout || 60000});
});
});
function runLoop() {
iteration++;
if (iteration >= slices) {
@ -92,7 +92,7 @@ root.runParallelAsyncHarness = function(options) {
(options.done || noop)(options);
return;
}
// grab a slice of testss and initialize them
var offset = iteration * testPerSlice;
var tests = options.tests.slice(offset, offset + testPerSlice);
@ -100,10 +100,10 @@ root.runParallelAsyncHarness = function(options) {
(options.setup || noop)(data, options);
});
// kick off the current slice of tests
(options.sliceStart || noop)(options, tests);
// perform individual "start" test-case
tests.forEach(function(data) {
cases.forEach(function(name) {
@ -112,7 +112,7 @@ root.runParallelAsyncHarness = function(options) {
});
});
});
// conclude test (possibly abort)
setTimeout(function() {
tests.forEach(function(data) {
@ -129,17 +129,17 @@ root.runParallelAsyncHarness = function(options) {
data.cases[name].done();
});
});
// finish the test for current slice of tests
(options.sliceDone || noop)(options, tests);
// next test please, give the browser 50ms to do catch its breath
setTimeout(runLoop, 50);
}, duration);
}
// allow DOMContentLoaded before actually doing something
setTimeout(runLoop, 100);
};
})(window);
})(window);

View file

@ -5,14 +5,14 @@ function resizeViewportTo(viewportSelector, width, height) {
iframe.width = width;
iframe.height = height;
iframe.contentWindow.document.body.offsetTop;
}
function injectStylesInIFrame(styleSelector, frameSelector) {
var style = document.querySelector(styleSelector),
frame = document.querySelector(frameSelector);
frame.contentWindow.addNewStyles(style.textContent);
}
@ -26,4 +26,4 @@ if (window.parent != window) {
styleTag.appendChild(textNode);
document.head.appendChild(styleTag);
}
}
}

View file

@ -1,6 +1,6 @@
//
//
// Vendor-Prefix Helper Functions For Testing CSS
//
//
(function(root) {
'use strict';
@ -21,7 +21,7 @@ root.addVendorPrefix = function (name) {
// property unknown to browser
return name;
}
return prefix + name;
};
@ -32,7 +32,7 @@ root.addValueVendorPrefix = function (property, value) {
// property unknown to browser
return name;
}
return prefix + value;
};
@ -41,7 +41,7 @@ root.getVendorPrefix = function(name) {
if (prefixCache[name] !== undefined) {
return prefixCache[name];
}
var elem = document.createElement("div");
name = camelCase(name);
@ -78,9 +78,9 @@ root.getValueVendorPrefix = function(property, value) {
return styles[i];
}
}
document.body.removeChild(elem);
document.body.removeChild(elem);
return false;
};
})(window);
})(window);