From 1c8fd60595134b8501fa1b4d07dcc11d6ec65d8c Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Sat, 24 Aug 2013 10:52:35 -0400 Subject: [PATCH] add test task, avoid attempt to run tests in unrelated html files --- Gruntfile.js | 5 ++++- package.json | 2 +- test/test.js | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 5daa4e56..4df3181e 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -17,7 +17,7 @@ module.exports = function(grunt) { // Tests will be added soon qunit: { - files: [ 'test/**/*.html' ] + files: [ 'test/*.html' ] }, uglify: { @@ -130,4 +130,7 @@ module.exports = function(grunt) { // Serve presentation locally grunt.registerTask( 'serve', [ 'connect', 'watch' ] ); + // Run tests + grunt.registerTask( 'test', [ 'jshint', 'qunit' ] ); + }; diff --git a/package.json b/package.json index 2c7036eb..caef3f9d 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "homepage": "http://lab.hakim.se/reveal-js", "subdomain": "revealjs", "scripts": { - "test": "grunt jshint qunit", + "test": "grunt test", "start": "" }, "author": { diff --git a/test/test.js b/test/test.js index 08c5c37e..00c96227 100644 --- a/test/test.js +++ b/test/test.js @@ -206,7 +206,6 @@ Reveal.addEventListener( 'ready', function() { asyncTest( 'fragmentshown event', function() { expect( 2 ); - start(); var _onEvent = function( event ) { ok( true, 'event fired' ); @@ -221,6 +220,8 @@ Reveal.addEventListener( 'ready', function() { Reveal.next(); Reveal.prev(); // shouldn't fire fragmentshown + start(); + Reveal.removeEventListener( 'fragmentshown', _onEvent ); });