aboutsummaryrefslogtreecommitdiffstats
path: root/tests/resource_loader.js
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2011-10-28 15:58:33 -0400
committerScott González <scott.gonzalez@gmail.com>2011-10-28 15:58:33 -0400
commitdcac8c1f29cd718c949c1b2c48681a90b0f647ed (patch)
tree417325b1d7c56154ec735b24b2d2211f2c757aba /tests/resource_loader.js
parent94b852f1155d89ff52f3c59da736406b239dcca1 (diff)
downloadjquery-ui-dcac8c1f29cd718c949c1b2c48681a90b0f647ed.tar.gz
jquery-ui-dcac8c1f29cd718c949c1b2c48681a90b0f647ed.zip
Tests: Added ability to run tests against minified files via ?min=1
Diffstat (limited to 'tests/resource_loader.js')
-rw-r--r--tests/resource_loader.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/resource_loader.js b/tests/resource_loader.js
new file mode 100644
index 000000000..c8dec4881
--- /dev/null
+++ b/tests/resource_loader.js
@@ -0,0 +1,39 @@
+(function( $ ) {
+
+var parts = document.location.search.slice( 1 ).split( "&" ),
+ length = parts.length,
+ i = 0,
+ current,
+ min;
+
+for ( ; i < length; i++ ) {
+ current = parts[ i ].split( "=" );
+ if ( current[ 0 ] === "min" ) {
+ min = current[ 1 ];
+ break;
+ }
+}
+
+function includeStyle( url ) {
+ document.write( "<link rel='stylesheet' href='../../../" + url + "'>" );
+}
+
+function includeScript( url ) {
+ document.write( "<script src='../../../" + url + "'></script>" );
+}
+
+window.loadResources = min ?
+ function() {
+ includeStyle( "build/dist/theme/jquery-ui.min.css" );
+ includeScript( "build/dist/jquery-ui.min.js" );
+ } :
+ function( resources ) {
+ $.each( resources.css || [], function( i, resource ) {
+ includeStyle( "themes/base/jquery." + resource + ".css" );
+ });
+ $.each( resources.js || [], function( i, resource ) {
+ includeScript( resource );
+ });
+ };
+
+})( jQuery );