From 7c896ddb8563e1f4fc655904614cf72d010e2ecb Mon Sep 17 00:00:00 2001 From: Scott González Date: Fri, 3 Apr 2015 15:21:16 -0400 Subject: Tests: Change test infrastructure to use AMD and reduce boilerplate Ref #10119 Ref gh-1528 * Adds RequireJS and relies on AMD for loading dependencies. * Updates to grunt-contrib-qunit 0.6.0. * Convert `domEqual()` to a proper QUnit assertion. * Introduces two bootstrap files (JS and CSS) which use `data-` attributes to reduce the amount of boilerplate needed in each test --- tests/lib/css.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/lib/css.js (limited to 'tests/lib/css.js') diff --git a/tests/lib/css.js b/tests/lib/css.js new file mode 100644 index 000000000..37353e912 --- /dev/null +++ b/tests/lib/css.js @@ -0,0 +1,23 @@ +(function() { + +function includeStyle( url ) { + document.write( "" ); +} + +// Find the script element +var scripts = document.getElementsByTagName( "script" ); +var script = scripts[ scripts.length - 1 ]; + +// Load the modules +var modules = script.getAttribute( "data-modules" ); +if ( modules ) { + modules = modules.split( /\s+/ ); + for ( var i = 0; i < modules.length; i++ ) { + includeStyle( "themes/base/" + modules[ i ] + ".css" ); + } +} + +// Load the QUnit stylesheet +includeStyle( "external/qunit/qunit.css" ); + +} )(); -- cgit v1.2.3