Files
polymer/test/runner.html

112 lines
3.6 KiB
HTML

<!doctype html>
<!--
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
<meta charset="utf-8">
<script src="../../web-component-tester/browser.js"></script>
</head>
<body>
<script>
var suites = [
'unit/bind.html',
'unit/notify-path.html',
'unit/shady.html',
'unit/shady-events.html',
'unit/shady-content.html',
'unit/shady-dynamic.html',
'unit/styling-scoped.html',
'unit/styling-cross-scope-var.html',
'unit/styling-cross-scope-apply.html',
'unit/styling-cross-scope-unknown-host.html',
'unit/custom-style.html',
'unit/custom-style-late.html',
'unit/custom-style-async.html',
'unit/custom-style-scope-cache.html',
'unit/events.html',
'unit/template-whitespace.html',
'unit/resolveurl.html',
'unit/case-map.html',
'unit/configure.html',
'unit/ready-attached-order.html',
'unit/attributes.html',
'unit/async.html',
'unit/behaviors.html',
'unit/polymer.element.html',
'unit/polymer.legacyelement.html',
'unit/debounce.html',
'unit/inheritance.html',
'unit/path.html',
'unit/templatizer.html',
'unit/dom-repeat.html',
'unit/dom-if.html',
'unit/dom-bind.html',
'unit/array-selector.html',
'unit/polymer-dom.html',
'unit/polymer-dom-observeNodes.html',
'unit/importHref.html',
'unit/gestures.html',
'unit/logging.html'
];
// http://eddmann.com/posts/cartesian-product-in-javascript/
function flatten(arr) { return [].concat.apply([], arr) }
function product(sets) {
return sets.reduce(function(acc, set) {
return flatten(acc.map(function(x) {
return set.map(function(y) { return x.concat(y); });
}));
}, [[]]);
}
function combinations(suites, flags) {
return product(flags).reduce(function(list, f) {
f = f.filter(function(i) { return i; }).join('&');
return list.concat(suites.map(function(s) { return s + (f ? '?' + f : '') }))
}, []);
}
function addUrlOption(previous, next) {
previous = previous || '';
next = next || '';
return previous + (previous ? '&' : '') + next;
}
// test shadowdom/custom elements polyfills together
// prefering both if possible.
var matrix = [''];
var webcomponents = '';
if (window.customElements) {
webcomponents = 'wc-register=true';
}
// if native is available, make sure to test polyfill
if (Element.prototype.attachShadow) {
webcomponents = addUrlOption(webcomponents, 'wc-shadydom=true');
}
// ce + sd becomes a single test iteration.
if (webcomponents) {
matrix.push(webcomponents);
}
// economize testing by testing css shimming
// only against 1 environment (native or polyfill).
if (window.CSS && CSS.supports && CSS.supports('box-shadow', '0 0 0 var(--foo)')) {
var last = matrix[matrix.length-1];
matrix.push(addUrlOption(last, 'wc-shimcssproperties=true'));
}
suites = combinations(suites, [matrix]);
console.log('Testing suites:\n\t' + suites.join('\n\t'));
WCT.loadSuites(suites);
</script>
</body>
</html>