Skip to content
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
19 changes: 19 additions & 0 deletions src/export.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
// For browser, export only select globals
if ( typeof window !== "undefined" ) {

// Deprecated
// Extend assert methods to QUnit and Global scope through Backwards compatibility
(function() {
var i,
assertions = Assert.prototype;

function applyCurrent( current ) {
return function() {
var assert = new Assert( QUnit.config.current );
current.apply( assert, arguments );
};
}

for ( i in assertions ) {
QUnit[ i ] = applyCurrent( assertions[ i ] );
}
})();

(function() {
var i, l,
keys = [
Expand Down
12 changes: 12 additions & 0 deletions test/globals.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*global ok: false, equal: false */
(function( window ) {

QUnit.module( "globals" );
Expand Down Expand Up @@ -42,6 +43,17 @@ QUnit.test( "QUnit exported methods", function( assert ) {
checkExported( assert, globals );
});

// Test deprecated exported Assert methods
QUnit.test( "Exported assertions", function() {
QUnit.expect( 4 );

QUnit.ok( true );
QUnit.equal( 2, 2 );

ok( true );
equal( 2, 2 );
});

// Get a reference to the global object, like window in browsers
}( (function() {
return this;
Expand Down