Permalink
Browse files

only display the pages that will be tested based on TEST_PATH when it…

…'s defined
  • Loading branch information...
1 parent 7e103f9 commit 0223dc2770cab19355adf5a6a475268608230331 @johnbender johnbender committed Dec 18, 2012
Showing with 34 additions and 21 deletions.
  1. +19 −12 build/tasks/config.js
  2. +15 −9 tests/unit/navigation/event/event_core.js
View
@@ -27,10 +27,14 @@ module.exports = function( grunt ) {
});
grunt.registerTask( 'config:test:pages', 'glob and log all possible tests', function( a, b ) {
- var test_paths = [], global_config = grunt.config.get( 'global' ), env = process.env;
+ var test_paths = [], filtered_paths = [], global_config = grunt.config.get( 'global' ), env = process.env;
// TODO move the glob to a legit config or pull the one from the qunit config
test_paths = glob.glob( 'tests/unit/*/' );
+
+ // TODO this captures a few straggling subdirectories with index based tests
+ // it could cause build failures but that will be immediately obvious
+ test_paths = test_paths.concat( glob.glob('tests/unit/*/*/index.html') );
test_paths = test_paths.concat( glob.glob('tests/unit/**/*-tests.html') );
// append the jquery version query param where defined
@@ -45,14 +49,23 @@ module.exports = function( grunt ) {
test_paths = paths_with_jquery;
}
- // if this test is not a dependency log pages
- if( this.name.indexOf('config:test:page') > -1 ) {
+ if( env.TEST_PATH ) {
test_paths.forEach(function( path ) {
- grunt.log.writeln( (env.ROOT_DOMAIN || "") + path );
+ if( path.indexOf(env.TEST_PATH) >= 0 ) {
+ filtered_paths.push( path );
+ }
});
+ } else {
+ filtered_paths = test_paths;
}
- global_config.test_paths = test_paths;
+ // if this test is not a dependency log pages
+ grunt.log.writeln( "Pages to be tested: " );
+ filtered_paths.forEach(function( path ) {
+ grunt.log.writeln( (env.ROOT_DOMAIN || "") + path );
+ });
+
+ global_config.test_paths = filtered_paths;
grunt.config.set( 'global', global_config );
});
@@ -66,13 +79,7 @@ module.exports = function( grunt ) {
// select the proper domain + paths
test_paths.forEach( function( file_path ) {
- var full_path = env.ROOT_DOMAIN + file_path;
-
- // if no test path is defined or if the path matches that specified in the env
- // add it to the config
- if( !process.env.TEST_PATH || file_path.indexOf(process.env.TEST_PATH) >= 0 ) {
- server_paths.push( full_path );
- }
+ server_paths.push( env.ROOT_DOMAIN + file_path );
});
grunt.config.set( 'qunit', { all: server_paths });
@@ -70,17 +70,23 @@ $.testHelper.setPushState();
if( $.support.pushState ) {
asyncTest( "popstate navigation events contain pushed state", function() {
- $( window ).one( "navigate", function( event, data ) {
- $( window ).one( "navigate", function( event, data ) {
- equal( data.state.foo, "bar", "state provided properly" );
- start();
- });
+ $.testHelper.eventTarget = $( window );
- window.history.back();
- });
+ $.testHelper.eventSequence( "navigate", [
+ function() {
+ window.history.replaceState({ foo: "bar" }, document.title, location.href.replace(/#.*/, "" ) + "#foo");
+ location.hash = "#foo2";
+ },
- window.history.replaceState({ foo: "bar" }, document.title, location.href.replace(/#.*/, "" ) + "#foo");
- location.hash = "#foo2";
+ function() {
+ window.history.back();
+ },
+
+ function( timedOut, data ) {
+ equal( data.state.foo, "bar", "state provided properly" );
+ start();
+ }
+ ]);
});
} else {
// Make sure the binding happends before any of the navigate bindings

0 comments on commit 0223dc2

Please sign in to comment.