Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core: Remove the newly introduced global hooks until we have consensus #681

Merged
merged 1 commit into from
Oct 17, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ Test.prototype = {
};
},

// Currently only used for module level hooks, can be used to add global level ones
hooks: function( handler ) {
var hooks = [];

Expand All @@ -133,9 +134,6 @@ Test.prototype = {
return hooks;
}

if ( QUnit.objectType( config[ handler ] ) === "function" ) {
hooks.push( this.queueHook( config[ handler ], handler ) );
}
if ( this.moduleTestEnvironment && QUnit.objectType( this.moduleTestEnvironment[ handler ] ) === "function" ) {
hooks.push( this.queueHook( this.moduleTestEnvironment[ handler ], handler ) );
}
Expand Down
26 changes: 4 additions & 22 deletions test/modules.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
// Before and after each tests
QUnit.config.beforeEach = function() {
this.lastHook = "global-beforeEach";
};

QUnit.config.afterEach = function( assert ) {
if ( this.hooksTest ) {
assert.strictEqual( this.lastHook, "module-afterEach", "Global afterEach runs after module's afterEach" );
this.hooksTest = false;
}

if ( this.contextTest ) {
assert.ok( true );
this.contextTest = false;
}
};

QUnit.module( "beforeEach/afterEach", {
beforeEach: function( assert ) {
assert.strictEqual( this.lastHook, "global-beforeEach", "Global beforeEach runs before module's beforeEach" );
beforeEach: function() {
this.lastHook = "module-beforeEach";
},
afterEach: function( assert ) {
Expand All @@ -29,7 +11,7 @@ QUnit.module( "beforeEach/afterEach", {
});

QUnit.test( "hooks order", function( assert ) {
assert.expect( 4 );
assert.expect( 2 );

// This will trigger an assertion on the global and one on the module's afterEach
this.hooksTest = true;
Expand All @@ -46,14 +28,14 @@ QUnit.module( "Test context object", {
for ( key in this ) {
keys.push( key );
}
assert.deepEqual( keys, [ "helper", "lastHook" ] );
assert.deepEqual( keys, [ "helper" ] );
},
afterEach: function() {},
helper: function() {}
});

QUnit.test( "keys", function( assert ) {
assert.expect( 2 );
assert.expect( 1 );
this.contextTest = true;
});

Expand Down