Files
Modernizr/test/browser/integration.pug
Veeck 1560f1f0dd Update Integration page (#2612)
* Show boolean value of complex tests also on the integration test page

* Fix formatting for video tests

* Cleanup integration page layout

* Update dependencies
2020-10-28 22:11:28 +01:00

111 lines
3.3 KiB
Plaintext

doctype html
html
head
meta(charset='utf-8')
meta(http-equiv='X-UA-Compatible', content='IE=edge')
title Cow tests
link(rel='stylesheet', media='all', href='../node_modules/mocha/mocha.css')
link(rel='stylesheet', media='all', href='../test/browser/integration.css')
body
section
h2 Modernizr results
ul#modernizrResults.output
section
h2 Raw results
textarea#rawResults
input(type="checkbox", id="prettyprint", checked)
label(for="prettyprint") pretty print raw output
section
h2 Mocha results
#mocha
#messages
#fixtures
script(src='../dist/modernizr-build.js')
script(src='../node_modules/jquery/dist/jquery.js')
script(src='../node_modules/lodash/lodash.js')
script(src='../node_modules/mocha/mocha.js')
script(src='../node_modules/chai/chai.js')
script.
var expect = chai.expect;
script(src = '../node_modules/ua-parser-js/src/ua-parser.js')
script.
window.onerror = function(err) {
var uncaughtErr = describe('uncaught errors', function() {
it('should not exist', function() {
expect(err).to.be.equal(undefined)
});
});
mocha.suite.suites.push(uncaughtErr);
return true;
};
mocha.setup('bdd').timeout(20000);
each test in integrationTests
script(src='../'+test)
script(src='../node_modules/json3/lib/json3.js')
script.
$.getJSON("https://raw.githubusercontent.com/Fyrd/caniuse/master/data.json", caniusecb);
function dumpModernizr() {
var output = '';
dumpModernizr.old = dumpModernizr.old || {};
var templatize = function(obj) {
_.forEach(obj, function(result, name) {
if (dumpModernizr.old[name]) return;
if (_.isObject(result)) {
output += '<li class="section"><b>' + name +'</b>';
if (_.isBoolean(result)) {
output += '<span class="' + (Boolean(result) ? 'pass' : 'fail') + '">: ' + formatResult(result) + '</span>'
}
output += '<ul>'
templatize(result);
output += '</ul></li>'
} else {
output += '<li id="' + name + '" class="' + (Boolean(result) ? 'pass' : 'fail') + '">' + name + ': ' + formatResult(result) + '</li>';
}
dumpModernizr.old[name] = true;
});
}
templatize(Modernizr);
return output;
}
function formatResult(result) {
if (result==="")
return false;
return result;
}
function stringify(obj, minified) {
var replacer = function(key, value) {
return value;
}
var args = minified ? [replacer,2] : [];
args.unshift(obj);
return JSON.stringify.apply(JSON, args);
}
function updateRawOutput() {
$('#rawResults').html(stringify(Modernizr, $('#prettyprint').is(":checked")));
}
function resultsToDOM() {
var output = dumpModernizr(Modernizr);
if (output) {
$('#modernizrResults').append(output);
updateRawOutput();
}
}
$('#prettyprint').on('click', updateRawOutput);
resultsToDOM();
setTimeout(resultsToDOM, 5e3);
setTimeout(resultsToDOM, 15e3);
script(src='../test/browser/setup.js')