mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Build: fix tests in AMD mode
This commit is contained in:
parent
58c2460821
commit
6051609df3
@ -26,7 +26,7 @@ module.exports = function( grunt ) {
|
||||
skipSemiColonInsertion: true,
|
||||
wrap: {
|
||||
startFile: "src/intro.js",
|
||||
endFile: "src/outro.js"
|
||||
endFile: [ "src/exports/global.js", "src/outro.js" ]
|
||||
},
|
||||
paths: {
|
||||
sizzle: "../external/sizzle/dist/sizzle"
|
||||
@ -61,13 +61,10 @@ module.exports = function( grunt ) {
|
||||
|
||||
} else {
|
||||
|
||||
// Ignore jQuery's exports (the only necessary one)
|
||||
if ( name !== "jquery" ) {
|
||||
contents = contents
|
||||
.replace( /\s*return\s+[^\}]+(\}\);[^\w\}]*)$/, "$1" )
|
||||
// Multiple exports
|
||||
.replace( /\s*exports\.\w+\s*=\s*\w+;/g, "" );
|
||||
}
|
||||
|
||||
// Remove define wrappers, closure ends, and empty declarations
|
||||
contents = contents
|
||||
|
@ -1,6 +1,8 @@
|
||||
define([
|
||||
"../core",
|
||||
"./var/rsingleTag",
|
||||
"./support",
|
||||
|
||||
"../manipulation" // buildFragment
|
||||
], function( jQuery, rsingleTag, support ) {
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
define([
|
||||
"../var/support"
|
||||
], function( jQuery, support ) {
|
||||
], function( support ) {
|
||||
// window.document is used here as it's before the sandboxed document
|
||||
support.createHTMLDocument = !!window.document.implementation.createHTMLDocument;
|
||||
|
||||
return support;
|
||||
});
|
||||
|
@ -1,7 +1,3 @@
|
||||
define([
|
||||
"../core"
|
||||
], function( jQuery ) {
|
||||
|
||||
var
|
||||
// Map over jQuery in case of overwrite
|
||||
_jQuery = window.jQuery,
|
||||
@ -27,5 +23,3 @@ jQuery.noConflict = function( deep ) {
|
||||
if ( !noGlobal ) {
|
||||
window.jQuery = window.$ = jQuery;
|
||||
}
|
||||
|
||||
});
|
||||
|
5
src/jquery.js
vendored
5
src/jquery.js
vendored
@ -28,10 +28,9 @@ define([
|
||||
"./offset",
|
||||
"./dimensions",
|
||||
"./deprecated",
|
||||
"./exports/amd",
|
||||
"./exports/global"
|
||||
"./exports/amd"
|
||||
], function( jQuery ) {
|
||||
|
||||
return jQuery;
|
||||
return (window.jQuery = window.$ = jQuery);
|
||||
|
||||
});
|
||||
|
@ -1 +1,2 @@
|
||||
return jQuery;
|
||||
}));
|
||||
|
@ -301,7 +301,9 @@ this.loadTests = function() {
|
||||
/**
|
||||
* Run in noConflict mode
|
||||
*/
|
||||
if (jQuery.noConflict) {
|
||||
jQuery.noConflict();
|
||||
}
|
||||
|
||||
// Load the TestSwarm listener if swarmURL is in the address.
|
||||
if ( loadSwarm ) {
|
||||
|
@ -234,6 +234,8 @@ test( "globalEval execution after script injection (#7862)", 1, function() {
|
||||
ok( window.strictEvalTest - now < 500, "Code executed synchronously" );
|
||||
});
|
||||
|
||||
// This is not run in AMD mode
|
||||
if (jQuery.noConflict) {
|
||||
test("noConflict", function() {
|
||||
expect(7);
|
||||
|
||||
@ -252,6 +254,7 @@ test("noConflict", function() {
|
||||
|
||||
window["jQuery"] = jQuery = $$;
|
||||
});
|
||||
}
|
||||
|
||||
test("trim", function() {
|
||||
expect(13);
|
||||
|
Loading…
Reference in New Issue
Block a user