mirror of
https://github.com/Modernizr/Modernizr.git
synced 2026-01-09 15:47:55 -05:00
99 lines
3.0 KiB
Plaintext
99 lines
3.0 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
|
|
#modernizrResults
|
|
textarea#rawResults
|
|
input(type="checkbox", id="prettyprint", checked)
|
|
label(for="prettyprint") pretty print raw output
|
|
#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/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(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(src='../node_modules/expect.js/index.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><ul>';
|
|
templatize(result);
|
|
output += '</ul></li>'
|
|
} else {
|
|
output += '<li id="' + name + '" class="' + (result ? 'pass' : 'fail') + '">' + name + ': ' + result + '</li>';
|
|
}
|
|
dumpModernizr.old[name] = true;
|
|
});
|
|
}
|
|
|
|
templatize(Modernizr);
|
|
|
|
return output;
|
|
}
|
|
|
|
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) {
|
|
var modOutput = $('<ul>')
|
|
.attr('class', 'output')
|
|
.html(output);
|
|
|
|
$('#modernizrResults').append(modOutput);
|
|
|
|
// Modernizr object as text
|
|
updateRawOutput()
|
|
}
|
|
}
|
|
|
|
$('#prettyprint').on('click', updateRawOutput);
|
|
|
|
resultsToDOM();
|
|
setTimeout(resultsToDOM, 5e3);
|
|
setTimeout(resultsToDOM, 15e3);
|
|
script(src='../test/browser/setup.js')
|