Skip to content

Commit 08ffd65

Browse files
committed
test fixes
1 parent fe5ca13 commit 08ffd65

File tree

4 files changed

+61
-45
lines changed

4 files changed

+61
-45
lines changed

test/unit/ajax.js

Lines changed: 55 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -70,52 +70,68 @@ test("jQuery.ajax() - success callbacks - (url, options) syntax", function() {
7070
}, 13);
7171
});
7272

73-
ajaxTest( "jQuery.ajax() - do not execute js (crossOrigin)", 2, function( assert ) {
74-
return {
75-
create: function( options ) {
76-
options.crossDomain = true;
77-
return jQuery.ajax( url( "data/script.php?header=ecma" ), options );
78-
},
79-
success: function() {
80-
assert.ok( true, "success" );
81-
},
82-
complete: function() {
83-
assert.ok( true, "complete" );
84-
}
85-
};
86-
} );
73+
test( "jQuery.ajax() - do not execute js (crossOrigin) 1", 2, function() {
8774

88-
ajaxTest( "jQuery.ajax() - execute js for crossOrigin when dataType option is provided", 3,
89-
function( assert ) {
90-
return {
91-
create: function( options ) {
92-
options.crossDomain = true;
93-
options.dataType = "script";
94-
return jQuery.ajax( url( "data/script.php?header=ecma" ), options );
75+
jQuery.ajaxSetup({ timeout: 0 });
76+
77+
stop();
78+
79+
setTimeout(function(){
80+
jQuery.ajax({
81+
url: url( "data/script.php?header=ecma" ),
82+
crossDomain: true,
83+
success: function() {
84+
ok( true, "success" );
9585
},
86+
complete: function() {
87+
ok( true, "complete" );
88+
start();
89+
}
90+
});
91+
}, 13);
92+
} );
93+
94+
test( "jQuery.ajax() - execute js for crossOrigin when dataType option is provided", 3, function() {
95+
96+
jQuery.ajaxSetup({ timeout: 0 });
97+
98+
stop();
99+
100+
setTimeout(function(){
101+
jQuery.ajax({
102+
url: url( "data/script.php?header=ecma" ),
103+
crossDomain: true,
104+
dataType: "script",
96105
success: function() {
97-
assert.ok( true, "success" );
106+
ok( true, "success" );
98107
},
99108
complete: function() {
100-
assert.ok( true, "complete" );
109+
ok( true, "complete" );
110+
start();
101111
}
102-
};
103-
}
104-
);
112+
});
113+
}, 13);
114+
} );
105115

106-
ajaxTest( "jQuery.ajax() - do not execute js (crossOrigin)", 2, function( assert ) {
107-
return {
108-
create: function( options ) {
109-
options.crossDomain = true;
110-
return jQuery.ajax( url( "data/script.php" ), options );
111-
},
112-
success: function() {
113-
assert.ok( true, "success" );
114-
},
115-
complete: function() {
116-
assert.ok( true, "complete" );
117-
}
118-
};
116+
test( "jQuery.ajax() - do not execute js (crossOrigin) 2", 2, function() {
117+
118+
jQuery.ajaxSetup({ timeout: 0 });
119+
120+
stop();
121+
122+
setTimeout(function(){
123+
jQuery.ajax({
124+
url: url( "data/script.php" ),
125+
crossDomain: true,
126+
success: function() {
127+
ok( true, "success" );
128+
},
129+
complete: function() {
130+
ok( true, "complete" );
131+
start();
132+
}
133+
});
134+
}, 13);
119135
} );
120136

121137
test("jQuery.ajax() - success callbacks (late binding)", function() {

test/unit/core.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ test("Basic requirements", function() {
1212
});
1313

1414
test("jQuery()", function() {
15-
expect(29);
15+
expect(25);
1616

1717
// Basic constructor's behavior
1818

@@ -56,7 +56,7 @@ test("jQuery()", function() {
5656
var img = jQuery("<img/>");
5757
equals( img.length, 1, "Correct number of elements generated for img" );
5858
equals( img.parent().length, 0, "Make sure that the generated HTML has no parent." );
59-
var div = jQuery("<div/><hr/><code/><b/>");
59+
var div = jQuery("<div></div><hr><code></code><b></b>");
6060
equals( div.length, 4, "Correct number of elements generated for div hr code b" );
6161
equals( div.parent().length, 0, "Make sure that the generated HTML has no parent." );
6262

@@ -855,10 +855,10 @@ test("jQuery.extend(Object, Object)", function() {
855855
});
856856

857857
QUnit.test( "jQuery.extend( true, ... ) Object.prototype pollution", function( assert ) {
858-
assert.expect( 1 );
858+
expect( 1 );
859859

860860
jQuery.extend( true, {}, JSON.parse( "{\"__proto__\": {\"devMode\": true}}" ) );
861-
assert.ok( !( "devMode" in {} ), "Object.prototype not polluted" );
861+
ok( !( "devMode" in {} ), "Object.prototype not polluted" );
862862
} );
863863

864864
test("jQuery.each(Object,Function)", function() {

test/unit/css.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ test("css(String|Hash)", function() {
2323
equals( div.css("width"), "4px", "Width on disconnected node." );
2424
equals( div.css("height"), "4px", "Height on disconnected node." );
2525

26-
var div2 = jQuery( "<div style='display:none;'><input type='text' style='height:20px;'/><textarea style='height:20px;'/><div style='height:20px;'></div></div>").appendTo("body");
26+
var div2 = jQuery( "<div style='display:none;'><input type='text' style='height:20px;'/><textarea style='height:20px;'></textarea><div style='height:20px;'></div></div>").appendTo("body");
2727

2828
equals( div2.find("input").css("height"), "20px", "Height on hidden input." );
2929
equals( div2.find("textarea").css("height"), "20px", "Height on hidden textarea." );

test/unit/manipulation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,7 @@ var testHtml = function(valueObj) {
11291129
}
11301130
ok( pass, "Set HTML" );
11311131

1132-
div = jQuery("<div/>").html( valueObj("<div id='parent_1'><div id='child_1'/></div><div id='parent_2'/>") );
1132+
div = jQuery("<div>").html( valueObj("<div id='parent_1'><div id='child_1'></div></div><div id='parent_2'></div>") );
11331133

11341134
equals( div.children().length, 2, "Make sure two child nodes exist." );
11351135
equals( div.children().children().length, 1, "Make sure that a grandchild exists." );

0 commit comments

Comments
 (0)