Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jquery
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
jquery
Commits
20608b35
Commit
20608b35
authored
Dec 05, 2012
by
Richard Gibson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
228ab3dd
followup 1: fix test failures. Close gh-1056.
parent
44370027
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
89 deletions
+86
-89
testinit.js
test/data/testinit.js
+4
-4
ajax.js
test/unit/ajax.js
+82
-85
No files found.
test/data/testinit.js
View file @
20608b35
...
@@ -64,11 +64,11 @@ function createComplexHTML() {
...
@@ -64,11 +64,11 @@ function createComplexHTML() {
testFoo = "foo"; jQuery("#foo").html("foo");
\
testFoo = "foo"; jQuery("#foo").html("foo");
\
ok( true, "inline script executed" );
\
ok( true, "inline script executed" );
\
/* ]]> */</script>
\
/* ]]> */</script>
\
<script src="'
+
service
(
"echo"
,
{
<script src="'
+
service
(
"echo
/
"
,
{
content
:
'var testBar = "bar";
\
content
:
'var testBar = "bar";
\
jQuery("#ap").html("bar");
\
jQuery("#ap").html("bar");
\
ok( true, "remote script executed");'
ok( true, "remote script executed");'
})
+
'"></script>
\
})
.
replace
(
/&/g
,
"&"
)
+
'"></script>
\
blabla'
;
blabla'
;
}
}
...
@@ -158,10 +158,10 @@ function url( value ) {
...
@@ -158,10 +158,10 @@ function url( value ) {
}
}
function
service
(
value
,
data
)
{
function
service
(
value
,
data
)
{
var
fragment
=
url
(
"data/ajax/"
+
(
value
||
""
)
);
var
fragment
=
url
(
"data/ajax/"
+
value
);
if
(
data
)
{
if
(
data
)
{
if
(
typeof
data
!==
"string"
)
{
if
(
typeof
data
!==
"string"
)
{
data
=
jQuery
.
param
(
data
);
data
=
jQuery
.
param
(
data
,
false
);
}
}
fragment
+=
"&"
+
data
;
fragment
+=
"&"
+
data
;
}
}
...
...
test/unit/ajax.js
View file @
20608b35
...
@@ -32,7 +32,7 @@ module( "ajax", {
...
@@ -32,7 +32,7 @@ module( "ajax", {
ajaxTest
(
"jQuery.ajax() - GET"
,
1
,
{
ajaxTest
(
"jQuery.ajax() - GET"
,
1
,
{
type
:
"GET"
,
type
:
"GET"
,
url
:
service
(
"echo"
),
url
:
service
(
"echo
/
"
),
data
:
{
data
:
{
content
:
"bar"
content
:
"bar"
},
},
...
@@ -63,7 +63,7 @@ module( "ajax", {
...
@@ -63,7 +63,7 @@ module( "ajax", {
ajaxTest
(
"jQuery.ajax() - success"
,
8
,
{
ajaxTest
(
"jQuery.ajax() - success"
,
8
,
{
setup
:
addGlobalEvents
(
"ajaxStart ajaxStop ajaxSend ajaxComplete ajaxSuccess"
),
setup
:
addGlobalEvents
(
"ajaxStart ajaxStop ajaxSend ajaxComplete ajaxSuccess"
),
url
:
service
(
"echo"
),
url
:
service
(
"echo
/
"
),
beforeSend
:
function
()
{
beforeSend
:
function
()
{
ok
(
true
,
"beforeSend"
);
ok
(
true
,
"beforeSend"
);
},
},
...
@@ -78,7 +78,7 @@ module( "ajax", {
...
@@ -78,7 +78,7 @@ module( "ajax", {
ajaxTest
(
"jQuery.ajax() - success - (url, options)"
,
8
,
{
ajaxTest
(
"jQuery.ajax() - success - (url, options)"
,
8
,
{
setup
:
addGlobalEvents
(
"ajaxStart ajaxStop ajaxSend ajaxComplete ajaxSuccess"
),
setup
:
addGlobalEvents
(
"ajaxStart ajaxStop ajaxSend ajaxComplete ajaxSuccess"
),
create
:
function
(
options
)
{
create
:
function
(
options
)
{
return
jQuery
.
ajax
(
service
(
"echo"
),
options
);
return
jQuery
.
ajax
(
service
(
"echo
/
"
),
options
);
},
},
beforeSend
:
function
()
{
beforeSend
:
function
()
{
ok
(
true
,
"beforeSend"
);
ok
(
true
,
"beforeSend"
);
...
@@ -93,7 +93,7 @@ module( "ajax", {
...
@@ -93,7 +93,7 @@ module( "ajax", {
ajaxTest
(
"jQuery.ajax() - success - late binding"
,
8
,
{
ajaxTest
(
"jQuery.ajax() - success - late binding"
,
8
,
{
setup
:
addGlobalEvents
(
"ajaxStart ajaxStop ajaxSend ajaxComplete ajaxSuccess"
),
setup
:
addGlobalEvents
(
"ajaxStart ajaxStop ajaxSend ajaxComplete ajaxSuccess"
),
url
:
service
(
"echo"
),
url
:
service
(
"echo
/
"
),
beforeSend
:
function
()
{
beforeSend
:
function
()
{
ok
(
true
,
"beforeSend"
);
ok
(
true
,
"beforeSend"
);
},
},
...
@@ -111,7 +111,7 @@ module( "ajax", {
...
@@ -111,7 +111,7 @@ module( "ajax", {
ajaxTest
(
"jQuery.ajax() - success - oncomplete binding"
,
8
,
{
ajaxTest
(
"jQuery.ajax() - success - oncomplete binding"
,
8
,
{
setup
:
addGlobalEvents
(
"ajaxStart ajaxStop ajaxSend ajaxComplete ajaxSuccess"
),
setup
:
addGlobalEvents
(
"ajaxStart ajaxStop ajaxSend ajaxComplete ajaxSuccess"
),
url
:
service
(
"echo"
),
url
:
service
(
"echo
/
"
),
beforeSend
:
function
()
{
beforeSend
:
function
()
{
ok
(
true
,
"beforeSend"
);
ok
(
true
,
"beforeSend"
);
},
},
...
@@ -129,7 +129,7 @@ module( "ajax", {
...
@@ -129,7 +129,7 @@ module( "ajax", {
ajaxTest
(
"jQuery.ajax() - error"
,
8
,
{
ajaxTest
(
"jQuery.ajax() - error"
,
8
,
{
setup
:
addGlobalEvents
(
"ajaxStart ajaxStop ajaxSend ajaxComplete ajaxError"
),
setup
:
addGlobalEvents
(
"ajaxStart ajaxStop ajaxSend ajaxComplete ajaxError"
),
url
:
service
(
"error"
),
url
:
service
(
"error
/
"
),
beforeSend
:
function
()
{
beforeSend
:
function
()
{
ok
(
true
,
"beforeSend"
);
ok
(
true
,
"beforeSend"
);
},
},
...
@@ -143,7 +143,7 @@ module( "ajax", {
...
@@ -143,7 +143,7 @@ module( "ajax", {
ajaxTest
(
"jQuery.ajax() - abort - textStatus and errorThrown values"
,
4
,
[
ajaxTest
(
"jQuery.ajax() - abort - textStatus and errorThrown values"
,
4
,
[
{
{
url
:
service
(
"echo"
),
url
:
service
(
"echo
/
"
),
data
:
{
data
:
{
delay
:
1
delay
:
1
},
},
...
@@ -156,7 +156,7 @@ module( "ajax", {
...
@@ -156,7 +156,7 @@ module( "ajax", {
}
}
},
},
{
{
url
:
service
(
"echo"
),
url
:
service
(
"echo
/
"
),
data
:
{
data
:
{
delay
:
1
delay
:
1
},
},
...
@@ -171,7 +171,7 @@ module( "ajax", {
...
@@ -171,7 +171,7 @@ module( "ajax", {
]);
]);
ajaxTest
(
"jQuery.ajax() - error - responseText"
,
1
,
{
ajaxTest
(
"jQuery.ajax() - error - responseText"
,
1
,
{
url
:
service
(
"echo"
),
url
:
service
(
"echo
/
"
),
data
:
{
data
:
{
status
:
400
,
status
:
400
,
content
:
"plain text message"
content
:
"plain text message"
...
@@ -185,7 +185,7 @@ module( "ajax", {
...
@@ -185,7 +185,7 @@ module( "ajax", {
var
previousUrl
,
var
previousUrl
,
firstTime
=
true
;
firstTime
=
true
;
jQuery
.
ajax
({
jQuery
.
ajax
({
url
:
service
(
"error"
),
url
:
service
(
"error
/
"
),
error
:
function
()
{
error
:
function
()
{
if
(
firstTime
)
{
if
(
firstTime
)
{
firstTime
=
false
;
firstTime
=
false
;
...
@@ -193,7 +193,7 @@ module( "ajax", {
...
@@ -193,7 +193,7 @@ module( "ajax", {
}
else
{
}
else
{
ok
(
true
,
"Test retrying with jQuery.ajax(this) works"
);
ok
(
true
,
"Test retrying with jQuery.ajax(this) works"
);
jQuery
.
ajax
({
jQuery
.
ajax
({
url
:
service
(
"error"
),
url
:
service
(
"error
/
"
),
data
:
{
data
:
{
"x"
:
1
"x"
:
1
},
},
...
@@ -221,7 +221,7 @@ module( "ajax", {
...
@@ -221,7 +221,7 @@ module( "ajax", {
xhr
.
setRequestHeader
(
"ajax-send"
,
"test"
);
xhr
.
setRequestHeader
(
"ajax-send"
,
"test"
);
});
});
},
},
url
:
service
(
"headers/request"
),
url
:
service
(
"headers/request
/
"
),
data
:
{
data
:
{
headers
:
"siMPle,SometHing-elsE,OthEr,ajax-send"
headers
:
"siMPle,SometHing-elsE,OthEr,ajax-send"
},
},
...
@@ -251,7 +251,7 @@ module( "ajax", {
...
@@ -251,7 +251,7 @@ module( "ajax", {
xhr
.
setRequestHeader
(
"ajax-send"
,
"test"
);
xhr
.
setRequestHeader
(
"ajax-send"
,
"test"
);
});
});
},
},
url
:
service
(
"headers/response"
),
url
:
service
(
"headers/response
/
"
),
data
:
{
data
:
{
"Sample-Header"
:
"sample value"
,
"Sample-Header"
:
"sample value"
,
"Sample-Header2"
:
"sample value 2"
,
"Sample-Header2"
:
"sample value 2"
,
...
@@ -271,7 +271,7 @@ module( "ajax", {
...
@@ -271,7 +271,7 @@ module( "ajax", {
});
});
ajaxTest
(
"jQuery.ajax() - headers - Accept"
,
1
,
{
ajaxTest
(
"jQuery.ajax() - headers - Accept"
,
1
,
{
url
:
service
(
"headers/request"
),
url
:
service
(
"headers/request
/
"
),
data
:
{
data
:
{
headers
:
"accept"
headers
:
"accept"
},
},
...
@@ -288,7 +288,7 @@ module( "ajax", {
...
@@ -288,7 +288,7 @@ module( "ajax", {
ajaxTest
(
"jQuery.ajax() - headers - contentType option"
,
2
,
[
ajaxTest
(
"jQuery.ajax() - headers - contentType option"
,
2
,
[
{
{
url
:
service
(
"headers/request"
),
url
:
service
(
"headers/request
/
"
),
data
:
{
data
:
{
headers
:
"content-type"
headers
:
"content-type"
},
},
...
@@ -298,7 +298,7 @@ module( "ajax", {
...
@@ -298,7 +298,7 @@ module( "ajax", {
}
}
},
},
{
{
url
:
service
(
"headers/request"
),
url
:
service
(
"headers/request
/
"
),
data
:
{
data
:
{
headers
:
"content-type"
headers
:
"content-type"
},
},
...
@@ -404,7 +404,7 @@ module( "ajax", {
...
@@ -404,7 +404,7 @@ module( "ajax", {
ajaxTest
(
"jQuery.ajax() - abort"
,
9
,
{
ajaxTest
(
"jQuery.ajax() - abort"
,
9
,
{
setup
:
addGlobalEvents
(
"ajaxStart ajaxStop ajaxSend ajaxError ajaxComplete"
),
setup
:
addGlobalEvents
(
"ajaxStart ajaxStop ajaxSend ajaxError ajaxComplete"
),
url
:
service
(
"echo"
),
url
:
service
(
"echo
/
"
),
data
:
{
data
:
{
delay
:
1
delay
:
1
},
},
...
@@ -452,12 +452,12 @@ module( "ajax", {
...
@@ -452,12 +452,12 @@ module( "ajax", {
},
0
);
},
0
);
},
},
requests
:
[{
requests
:
[{
url
:
service
(
"echo"
),
url
:
service
(
"echo
/
"
),
beforeSend
:
callback
(
"beforeSend"
),
beforeSend
:
callback
(
"beforeSend"
),
success
:
callback
(
"success"
),
success
:
callback
(
"success"
),
complete
:
callback
(
"complete"
)
complete
:
callback
(
"complete"
)
},
{
},
{
url
:
service
(
"error"
),
url
:
service
(
"error
/
"
),
beforeSend
:
callback
(
"beforeSend"
),
beforeSend
:
callback
(
"beforeSend"
),
error
:
callback
(
"error"
),
error
:
callback
(
"error"
),
complete
:
callback
(
"complete"
)
complete
:
callback
(
"complete"
)
...
@@ -472,7 +472,7 @@ module( "ajax", {
...
@@ -472,7 +472,7 @@ module( "ajax", {
};
};
}
}
return
{
return
{
url
:
service
(
"error"
),
url
:
service
(
"error
/
"
),
beforeSend
:
nocallback
(
"beforeSend"
),
beforeSend
:
nocallback
(
"beforeSend"
),
error
:
nocallback
(
"error"
),
error
:
nocallback
(
"error"
),
complete
:
nocallback
(
"complete"
)
complete
:
nocallback
(
"complete"
)
...
@@ -480,7 +480,7 @@ module( "ajax", {
...
@@ -480,7 +480,7 @@ module( "ajax", {
});
});
ajaxTest
(
"jQuery.ajax() - context - modification"
,
1
,
{
ajaxTest
(
"jQuery.ajax() - context - modification"
,
1
,
{
url
:
service
(
"error"
),
url
:
service
(
"error
/
"
),
context
:
{},
context
:
{},
beforeSend
:
function
()
{
beforeSend
:
function
()
{
this
.
test
=
"foo"
;
this
.
test
=
"foo"
;
...
@@ -501,12 +501,12 @@ module( "ajax", {
...
@@ -501,12 +501,12 @@ module( "ajax", {
strictEqual
(
jQuery
.
ajaxSettings
.
context
,
obj
,
"Make sure the context is properly set in ajaxSettings."
);
strictEqual
(
jQuery
.
ajaxSettings
.
context
,
obj
,
"Make sure the context is properly set in ajaxSettings."
);
},
},
requests
:
[{
requests
:
[{
url
:
service
(
"error"
),
url
:
service
(
"error
/
"
),
error
:
function
()
{
error
:
function
()
{
strictEqual
(
this
,
obj
,
"Make sure the original object is maintained."
);
strictEqual
(
this
,
obj
,
"Make sure the original object is maintained."
);
}
}
},
{
},
{
url
:
service
(
"error"
),
url
:
service
(
"error
/
"
),
context
:
{},
context
:
{},
error
:
function
()
{
error
:
function
()
{
ok
(
this
!==
obj
,
"Make sure overidding context is possible."
);
ok
(
this
!==
obj
,
"Make sure overidding context is possible."
);
...
@@ -518,7 +518,7 @@ module( "ajax", {
...
@@ -518,7 +518,7 @@ module( "ajax", {
ajaxTest
(
"jQuery.ajax() - events - disable"
,
3
,
{
ajaxTest
(
"jQuery.ajax() - events - disable"
,
3
,
{
setup
:
addGlobalEvents
(
""
),
setup
:
addGlobalEvents
(
""
),
global
:
false
,
global
:
false
,
url
:
service
(
"echo"
),
url
:
service
(
"echo
/
"
),
beforeSend
:
function
()
{
beforeSend
:
function
()
{
ok
(
true
,
"beforeSend"
);
ok
(
true
,
"beforeSend"
);
},
},
...
@@ -531,7 +531,7 @@ module( "ajax", {
...
@@ -531,7 +531,7 @@ module( "ajax", {
});
});
ajaxTest
(
"jQuery.ajax() - xml - non-namespace elements inside namespaced elements"
,
3
,
{
ajaxTest
(
"jQuery.ajax() - xml - non-namespace elements inside namespaced elements"
,
3
,
{
url
:
service
(
"echo"
),
url
:
service
(
"echo
/
"
),
data
:
{
data
:
{
contentType
:
"text/xml"
,
contentType
:
"text/xml"
,
content
:
createWithFriesXML
(
true
)
content
:
createWithFriesXML
(
true
)
...
@@ -544,7 +544,7 @@ module( "ajax", {
...
@@ -544,7 +544,7 @@ module( "ajax", {
});
});
ajaxTest
(
"jQuery.ajax() - xml - non-namespace elements inside namespaced elements (over JSONP)"
,
3
,
{
ajaxTest
(
"jQuery.ajax() - xml - non-namespace elements inside namespaced elements (over JSONP)"
,
3
,
{
url
:
service
(
"echo"
),
url
:
service
(
"echo
/
"
),
data
:
{
data
:
{
content
:
createWithFriesXML
(
true
)
content
:
createWithFriesXML
(
true
)
},
},
...
@@ -557,7 +557,7 @@ module( "ajax", {
...
@@ -557,7 +557,7 @@ module( "ajax", {
});
});
ajaxTest
(
"jQuery.ajax() - atom+xml"
,
2
,
{
ajaxTest
(
"jQuery.ajax() - atom+xml"
,
2
,
{
url
:
service
(
"echo"
),
url
:
service
(
"echo
/
"
),
data
:
{
data
:
{
content
:
"<root><element /></root>"
,
content
:
"<root><element /></root>"
,
contentType
:
"atom+xml"
contentType
:
"atom+xml"
...
@@ -588,7 +588,7 @@ module( "ajax", {
...
@@ -588,7 +588,7 @@ module( "ajax", {
});
});
ajaxTest
(
"jQuery.ajax() - beforeSend"
,
1
,
{
ajaxTest
(
"jQuery.ajax() - beforeSend"
,
1
,
{
url
:
service
(
"error"
),
url
:
service
(
"error
/
"
),
beforeSend
:
function
(
xml
)
{
beforeSend
:
function
(
xml
)
{
this
.
check
=
true
;
this
.
check
=
true
;
},
},
...
@@ -600,7 +600,7 @@ module( "ajax", {
...
@@ -600,7 +600,7 @@ module( "ajax", {
ajaxTest
(
"jQuery.ajax() - beforeSend, cancel request manually"
,
2
,
{
ajaxTest
(
"jQuery.ajax() - beforeSend, cancel request manually"
,
2
,
{
create
:
function
()
{
create
:
function
()
{
return
jQuery
.
ajax
({
return
jQuery
.
ajax
({
url
:
service
(
"error"
),
url
:
service
(
"error
/
"
),
beforeSend
:
function
(
xhr
)
{
beforeSend
:
function
(
xhr
)
{
ok
(
true
,
"beforeSend got called, canceling"
);
ok
(
true
,
"beforeSend got called, canceling"
);
xhr
.
abort
();
xhr
.
abort
();
...
@@ -627,7 +627,7 @@ module( "ajax", {
...
@@ -627,7 +627,7 @@ module( "ajax", {
Globals
.
register
(
"testBar"
);
Globals
.
register
(
"testBar"
);
},
},
dataType
:
"html"
,
dataType
:
"html"
,
url
:
service
(
"echo"
),
url
:
service
(
"echo
/
"
),
data
:
{
data
:
{
content
:
createComplexHTML
()
content
:
createComplexHTML
()
},
},
...
@@ -640,7 +640,7 @@ module( "ajax", {
...
@@ -640,7 +640,7 @@ module( "ajax", {
});
});
ajaxTest
(
"jQuery.ajax() - synchronous request"
,
1
,
{
ajaxTest
(
"jQuery.ajax() - synchronous request"
,
1
,
{
url
:
service
(
"echo"
),
url
:
service
(
"echo
/
"
),
data
:
{
data
:
{
content
:
"hello world"
content
:
"hello world"
},
},
...
@@ -653,7 +653,7 @@ module( "ajax", {
...
@@ -653,7 +653,7 @@ module( "ajax", {
});
});
ajaxTest
(
"jQuery.ajax() - synchronous request - callbacks"
,
2
,
{
ajaxTest
(
"jQuery.ajax() - synchronous request - callbacks"
,
2
,
{
url
:
service
(
"echo"
),
url
:
service
(
"echo
/
"
),
data
:
{
data
:
{
content
:
"hello world"
content
:
"hello world"
},
},
...
@@ -687,12 +687,12 @@ module( "ajax", {
...
@@ -687,12 +687,12 @@ module( "ajax", {
start
();
start
();
});
});
ok
(
jQuery
.
get
(
service
(
"echo"
),
success
),
"get"
);
ok
(
jQuery
.
get
(
service
(
"echo
/
"
),
success
),
"get"
);
ok
(
jQuery
.
post
(
service
(
"echo"
),
success
),
"post"
);
ok
(
jQuery
.
post
(
service
(
"echo
/
"
),
success
),
"post"
);
ok
(
jQuery
.
getScript
(
service
(
"echo"
),
success
),
"script"
);
ok
(
jQuery
.
getScript
(
service
(
"echo
/
"
),
success
),
"script"
);
ok
(
jQuery
.
getJSON
(
service
(
"echo?content=0"
),
success
),
"json"
);
ok
(
jQuery
.
getJSON
(
service
(
"echo
/
?content=0"
),
success
),
"json"
);
ok
(
jQuery
.
ajax
({
ok
(
jQuery
.
ajax
({
url
:
service
(
"echo"
),
url
:
service
(
"echo
/
"
),
success
:
success
success
:
success
}),
"generic"
);
}),
"generic"
);
});
});
...
@@ -759,7 +759,7 @@ module( "ajax", {
...
@@ -759,7 +759,7 @@ module( "ajax", {
strictEqual
(
data
,
"041275"
,
"JSON results returned - "
+
this
.
type
+
" - "
+
options
.
title
);
strictEqual
(
data
,
"041275"
,
"JSON results returned - "
+
this
.
type
+
" - "
+
options
.
title
);
}
}
},
options
);
},
options
);
tmp
.
url
=
service
(
"echo"
+
(
options
.
url
||
""
)
);
tmp
.
url
=
service
(
"echo
/
"
+
(
options
.
url
||
""
)
);
return
tmp
;
return
tmp
;
}
}
...
@@ -774,11 +774,11 @@ module( "ajax", {
...
@@ -774,11 +774,11 @@ module( "ajax", {
}),
}),
request
({
request
({
title
:
"REST-like"
,
title
:
"REST-like"
,
url
:
"
/
index.php/??"
url
:
"index.php/??"
}),
}),
request
({
request
({
title
:
"REST-like (with param)"
,
title
:
"REST-like (with param)"
,
url
:
"
/
index.php/???content=
\"
041275
\"
"
,
url
:
"index.php/???content=
\"
041275
\"
"
,
beforeSend
:
function
()
{
beforeSend
:
function
()
{
delete
this
.
data
;
delete
this
.
data
;
}
}
...
@@ -848,19 +848,16 @@ module( "ajax", {
...
@@ -848,19 +848,16 @@ module( "ajax", {
ajaxTest
(
"jQuery.ajax() - JSONP - POST"
+
label
,
3
,
[
ajaxTest
(
"jQuery.ajax() - JSONP - POST"
+
label
,
3
,
[
request
({
request
({
title
:
"no callback"
,
title
:
"no callback"
,
type
:
"POST"
,
type
:
"POST"
url
:
"/"
}),
}),
request
({
request
({
title
:
"data callback"
,
title
:
"data callback"
,
type
:
"POST"
,
type
:
"POST"
,
url
:
"/"
,
data
:
"content=041275&callback=?"
data
:
"content=041275&callback=?"
}),
}),
request
({
request
({
title
:
"data obj callback"
,
title
:
"data obj callback"
,
type
:
"POST"
,
type
:
"POST"
,
url
:
"/"
,
jsonp
:
"callback"
jsonp
:
"callback"
})
})
]);
]);
...
@@ -929,7 +926,7 @@ module( "ajax", {
...
@@ -929,7 +926,7 @@ module( "ajax", {
});
});
ajaxTest
(
"jQuery.ajax() - malformed JSON"
,
2
,
{
ajaxTest
(
"jQuery.ajax() - malformed JSON"
,
2
,
{
url
:
service
(
"echo"
),
url
:
service
(
"echo
/
"
),
data
:
{
data
:
{
content
:
"{bad: toTheBone}"
content
:
"{bad: toTheBone}"
},
},
...
@@ -947,7 +944,7 @@ module( "ajax", {
...
@@ -947,7 +944,7 @@ module( "ajax", {
return
42
;
return
42
;
}
}
},
},
url
:
service
(
"headers/response/
index.php
"
),
url
:
service
(
"headers/response/"
),
data
:
{
data
:
{
"Content-Type"
:
"application/json"
"Content-Type"
:
"application/json"
},
},
...
@@ -962,7 +959,7 @@ module( "ajax", {
...
@@ -962,7 +959,7 @@ module( "ajax", {
ok
(
false
,
"content-type detected"
);
ok
(
false
,
"content-type detected"
);
}
}
},
},
url
:
service
(
"headers/response/
index.php
"
),
url
:
service
(
"headers/response/"
),
data
:
{
data
:
{
"Content-Type"
:
"application/json"
"Content-Type"
:
"application/json"
},
},
...
@@ -975,7 +972,7 @@ module( "ajax", {
...
@@ -975,7 +972,7 @@ module( "ajax", {
});
});
ajaxTest
(
"jQuery.ajax() - JSON - empty"
,
1
,
{
ajaxTest
(
"jQuery.ajax() - JSON - empty"
,
1
,
{
url
:
service
(
"echo"
),
url
:
service
(
"echo
/
"
),
dataType
:
"json"
,
dataType
:
"json"
,
error
:
function
(
_
,
__
,
error
)
{
error
:
function
(
_
,
__
,
error
)
{
strictEqual
(
typeof
error
,
"object"
,
"error object for empty json response"
);
strictEqual
(
typeof
error
,
"object"
,
"error object for empty json response"
);
...
@@ -1037,7 +1034,7 @@ module( "ajax", {
...
@@ -1037,7 +1034,7 @@ module( "ajax", {
ajaxTest
(
"jQuery.ajax() - statusText"
,
4
,
[
ajaxTest
(
"jQuery.ajax() - statusText"
,
4
,
[
{
{
url
:
service
(
"echo"
),
url
:
service
(
"echo
/
"
),
data
:
{
data
:
{
status
:
200
,
status
:
200
,
statusText
:
"Hello"
statusText
:
"Hello"
...
@@ -1048,7 +1045,7 @@ module( "ajax", {
...
@@ -1048,7 +1045,7 @@ module( "ajax", {
}
}
},
},
{
{
url
:
service
(
"echo"
),
url
:
service
(
"echo
/
"
),
data
:
{
data
:
{
status
:
404
,
status
:
404
,
statusText
:
"Hello"
statusText
:
"Hello"
...
@@ -1060,7 +1057,7 @@ module( "ajax", {
...
@@ -1060,7 +1057,7 @@ module( "ajax", {
}
}
]);
]);
jQuery
.
each
(
[
"error"
,
service
(
"echo
"
)
],
function
(
isSuccess
,
url
)
{
jQuery
.
each
(
[
service
(
"error/"
),
service
(
"echo/
"
)
],
function
(
isSuccess
,
url
)
{
function
statusCodes
(
title
)
{
function
statusCodes
(
title
)
{
return
{
return
{
200
:
function
()
{
200
:
function
()
{
...
@@ -1102,7 +1099,7 @@ module( "ajax", {
...
@@ -1102,7 +1099,7 @@ module( "ajax", {
dataType
=
srcType
+
" "
+
dataType
;
dataType
=
srcType
+
" "
+
dataType
;
}
}
return
{
return
{
url
:
service
(
"echo"
),
url
:
service
(
"echo
/
"
),
data
:
{
data
:
{
content
:
"
\"
041275
\"
"
content
:
"
\"
041275
\"
"
},
},
...
@@ -1124,7 +1121,7 @@ module( "ajax", {
...
@@ -1124,7 +1121,7 @@ module( "ajax", {
ajaxTest
(
"jQuery.ajax() - overrideMimeType"
,
2
,
[
ajaxTest
(
"jQuery.ajax() - overrideMimeType"
,
2
,
[
{
{
url
:
service
(
"echo"
),
url
:
service
(
"echo
/
"
),
data
:
{
data
:
{
content
:
"42"
content
:
"42"
},
},
...
@@ -1136,7 +1133,7 @@ module( "ajax", {
...
@@ -1136,7 +1133,7 @@ module( "ajax", {
}
}
},
},
{
{
url
:
service
(
"echo"
),
url
:
service
(
"echo
/
"
),
data
:
{
data
:
{
content
:
"42"
content
:
"42"
},
},
...
@@ -1171,7 +1168,7 @@ module( "ajax", {
...
@@ -1171,7 +1168,7 @@ module( "ajax", {
});
});
ajaxTest
(
"#2806 - jQuery.ajax() - data option - evaluate function values"
,
1
,
{
ajaxTest
(
"#2806 - jQuery.ajax() - data option - evaluate function values"
,
1
,
{
url
:
service
(
"echo"
),
url
:
service
(
"echo
/
"
),
data
:
{
data
:
{
content
:
function
()
{
content
:
function
()
{
return
"value"
;
return
"value"
;
...
@@ -1219,7 +1216,7 @@ module( "ajax", {
...
@@ -1219,7 +1216,7 @@ module( "ajax", {
},
},
{
{
create
:
function
()
{
create
:
function
()
{
return
jQuery
.
ajax
(
service
(
"echo"
)
);
return
jQuery
.
ajax
(
service
(
"echo
/
"
)
);
},
},
done
:
function
()
{
done
:
function
()
{
ok
(
true
,
"With only string URL argument"
);
ok
(
true
,
"With only string URL argument"
);
...
@@ -1227,7 +1224,7 @@ module( "ajax", {
...
@@ -1227,7 +1224,7 @@ module( "ajax", {
},
},
{
{
create
:
function
()
{
create
:
function
()
{
return
jQuery
.
ajax
(
service
(
"echo"
),
{});
return
jQuery
.
ajax
(
service
(
"echo
/
"
),
{});
},
},
done
:
function
()
{
done
:
function
()
{
ok
(
true
,
"With string URL param and map"
);
ok
(
true
,
"With string URL param and map"
);
...
@@ -1237,7 +1234,7 @@ module( "ajax", {
...
@@ -1237,7 +1234,7 @@ module( "ajax", {
create
:
function
(
options
)
{
create
:
function
(
options
)
{
return
jQuery
.
ajax
(
options
);
return
jQuery
.
ajax
(
options
);
},
},
url
:
service
(
"echo"
),
url
:
service
(
"echo
/
"
),
success
:
function
()
{
success
:
function
()
{
ok
(
true
,
"With only map"
);
ok
(
true
,
"With only map"
);
}
}
...
@@ -1246,7 +1243,7 @@ module( "ajax", {
...
@@ -1246,7 +1243,7 @@ module( "ajax", {
jQuery
.
each
(
[
" - Same Domain"
,
" - Cross Domain"
],
function
(
crossDomain
,
label
)
{
jQuery
.
each
(
[
" - Same Domain"
,
" - Cross Domain"
],
function
(
crossDomain
,
label
)
{
ajaxTest
(
"#8205 - jQuery.ajax() - JSONP - re-use callbacks name"
+
label
,
2
,
{
ajaxTest
(
"#8205 - jQuery.ajax() - JSONP - re-use callbacks name"
+
label
,
2
,
{
url
:
service
(
"echo"
),
url
:
service
(
"echo
/
"
),
data
:
{
data
:
{
content
:
"42"
content
:
"42"
},
},
...
@@ -1321,7 +1318,7 @@ module( "ajax", {
...
@@ -1321,7 +1318,7 @@ module( "ajax", {
test
(
"#11743 - jQuery.ajax() - script, throws exception"
,
1
,
function
()
{
test
(
"#11743 - jQuery.ajax() - script, throws exception"
,
1
,
function
()
{
raises
(
function
()
{
raises
(
function
()
{
jQuery
.
ajax
({
jQuery
.
ajax
({
url
:
service
(
"echo"
),
url
:
service
(
"echo
/
"
),
data
:
{
data
:
{
content
:
"SYNTAX ERROR"
content
:
"SYNTAX ERROR"
},
},
...
@@ -1345,7 +1342,7 @@ module( "ajax", {
...
@@ -1345,7 +1342,7 @@ module( "ajax", {
function
request
(
option
)
{
function
request
(
option
)
{
var
options
=
{
var
options
=
{
url
:
service
(
"echo/
index.php
"
),
url
:
service
(
"echo/"
),
data
:
{
data
:
{
requestArray
:
"POST"
,
requestArray
:
"POST"
,
content
:
"hello"
content
:
"hello"
...
@@ -1401,7 +1398,7 @@ module( "ajax", {
...
@@ -1401,7 +1398,7 @@ module( "ajax", {
asyncTest
(
"jQuery.ajaxSetup()"
,
1
,
function
()
{
asyncTest
(
"jQuery.ajaxSetup()"
,
1
,
function
()
{
jQuery
.
ajaxSetup
({
jQuery
.
ajaxSetup
({
url
:
service
(
"echo"
),
url
:
service
(
"echo
/
"
),
data
:
{
data
:
{
content
:
"bar"
content
:
"bar"
},
},
...
@@ -1420,7 +1417,7 @@ module( "ajax", {
...
@@ -1420,7 +1417,7 @@ module( "ajax", {
timeout
:
50
timeout
:
50
});
});
},
},
url
:
service
(
"echo?delay=1"
),
url
:
service
(
"echo
/
?delay=1"
),
error
:
function
(
_
,
status
)
{
error
:
function
(
_
,
status
)
{
strictEqual
(
status
,
"timeout"
,
"timed out"
);
strictEqual
(
status
,
"timeout"
,
"timed out"
);
}
}
...
@@ -1434,7 +1431,7 @@ module( "ajax", {
...
@@ -1434,7 +1431,7 @@ module( "ajax", {
},
},
type
:
"GET"
,
type
:
"GET"
,
timeout
:
15000
,
timeout
:
15000
,
url
:
service
(
"echo?delay=1"
),
url
:
service
(
"echo
/
?delay=1"
),
success
:
function
()
{
success
:
function
()
{
ok
(
true
,
"Check for local timeout"
);
ok
(
true
,
"Check for local timeout"
);
}
}
...
@@ -1451,14 +1448,14 @@ module( "ajax", {
...
@@ -1451,14 +1448,14 @@ module( "ajax", {
ok
(
false
,
"Global event triggered"
);
ok
(
false
,
"Global event triggered"
);
});
});
jQuery
(
"#qunit-fixture"
).
append
(
"<script src='"
+
service
(
"echo"
,
{
jQuery
(
"#qunit-fixture"
).
append
(
"<script src='"
+
service
(
"echo
/
"
,
{
requestArray
:
"GET"
,
requestArray
:
"GET"
,
content
:
"ok( true,
\"
script executed
\"
);"
content
:
"ok( true,
\"
script executed
\"
);"
})
+
"'></script>"
);
})
+
"'></script>"
);
});
});
asyncTest
(
"#11402 - jQuery.domManip() - script in comments are properly evaluated"
,
2
,
function
()
{
asyncTest
(
"#11402 - jQuery.domManip() - script in comments are properly evaluated"
,
2
,
function
()
{
jQuery
(
"#qunit-fixture"
).
load
(
service
(
"echo"
,
{
jQuery
(
"#qunit-fixture"
).
load
(
service
(
"echo
/
"
,
{
content
:
content
:
"<script>
\n
<!--
\n
ok( true,
\"
script within html comments executed
\"
);
\n
-->
\n
</script>
\n
"
+
"<script>
\n
<!--
\n
ok( true,
\"
script within html comments executed
\"
);
\n
-->
\n
</script>
\n
"
+
"<script>
\n
<![CDATA[
\n
ok( true,
\"
script within CDATA executed
\"
);
\n
]]>
\n
</script>"
"<script>
\n
<![CDATA[
\n
ok( true,
\"
script within CDATA executed
\"
);
\n
]]>
\n
</script>"
...
@@ -1469,7 +1466,7 @@ module( "ajax", {
...
@@ -1469,7 +1466,7 @@ module( "ajax", {
asyncTest
(
"jQuery.get( String, Hash, Function ) - parse xml and use text() on nodes"
,
2
,
function
()
{
asyncTest
(
"jQuery.get( String, Hash, Function ) - parse xml and use text() on nodes"
,
2
,
function
()
{
var
tabs
=
[
"blabla"
,
"blublu"
];
var
tabs
=
[
"blabla"
,
"blublu"
];
jQuery
.
get
(
service
(
"echo"
,
{
jQuery
.
get
(
service
(
"echo
/
"
,
{
contentType
:
"text/xml"
,
contentType
:
"text/xml"
,
content
:
createDashboardXML
(
true
)
content
:
createDashboardXML
(
true
)
}),
function
(
xml
)
{
}),
function
(
xml
)
{
...
@@ -1486,7 +1483,7 @@ module( "ajax", {
...
@@ -1486,7 +1483,7 @@ module( "ajax", {
content
:
"helloworld"
content
:
"helloworld"
}
}
});
});
jQuery
.
get
(
service
(
"echo"
),
function
(
data
)
{
jQuery
.
get
(
service
(
"echo
/
"
),
function
(
data
)
{
strictEqual
(
data
,
"helloworld"
,
"Data from ajaxSettings was used"
);
strictEqual
(
data
,
"helloworld"
,
"Data from ajaxSettings was used"
);
start
();
start
();
});
});
...
@@ -1496,7 +1493,7 @@ module( "ajax", {
...
@@ -1496,7 +1493,7 @@ module( "ajax", {
asyncTest
(
"jQuery.getJSON( String, Hash, Function ) - JSON array"
,
1
,
function
()
{
asyncTest
(
"jQuery.getJSON( String, Hash, Function ) - JSON array"
,
1
,
function
()
{
jQuery
.
getJSON
(
jQuery
.
getJSON
(
service
(
"echo"
),
service
(
"echo
/
"
),
{
{
"content"
:
"[{
\"
name
\"
:
\"
John
\"
,
\"
age
\"
: 21 }, {
\"
name
\"
:
\"
Peter
\"
,
\"
age
\"
: 25 }]"
"content"
:
"[{
\"
name
\"
:
\"
John
\"
,
\"
age
\"
: 21 }, {
\"
name
\"
:
\"
Peter
\"
,
\"
age
\"
: 25 }]"
},
},
...
@@ -1514,7 +1511,7 @@ module( "ajax", {
...
@@ -1514,7 +1511,7 @@ module( "ajax", {
});
});
asyncTest
(
"jQuery.getJSON( String, Function ) - JSON object"
,
1
,
function
()
{
asyncTest
(
"jQuery.getJSON( String, Function ) - JSON object"
,
1
,
function
()
{
jQuery
.
getJSON
(
service
(
"echo"
,
{
jQuery
.
getJSON
(
service
(
"echo
/
"
,
{
content
:
"{
\"
data
\"
: {
\"
lang
\"
:
\"
en
\"
,
\"
length
\"
: 25 } }"
content
:
"{
\"
data
\"
: {
\"
lang
\"
:
\"
en
\"
,
\"
length
\"
: 25 } }"
}),
function
(
json
)
{
}),
function
(
json
)
{
deepEqual
(
json
,
{
deepEqual
(
json
,
{
...
@@ -1540,14 +1537,14 @@ module( "ajax", {
...
@@ -1540,14 +1537,14 @@ module( "ajax", {
return
true
;
return
true
;
}
}
};
};
jQuery
.
getJSON
(
service
(
"echo"
),
function
(
json
)
{
jQuery
.
getJSON
(
service
(
"echo
/
"
),
function
(
json
)
{
strictEqual
(
json
,
true
,
"Verifying return value"
);
strictEqual
(
json
,
true
,
"Verifying return value"
);
start
();
start
();
});
});
});
});
asyncTest
(
"jQuery.getJSON( String, Function ) - JSON object with absolute url to local content"
,
1
,
function
()
{
asyncTest
(
"jQuery.getJSON( String, Function ) - JSON object with absolute url to local content"
,
1
,
function
()
{
jQuery
.
getJSON
(
window
.
location
.
href
.
replace
(
/
[^\/]
*$/
,
""
)
+
service
(
"echo"
,
{
jQuery
.
getJSON
(
window
.
location
.
href
.
replace
(
/
[^\/]
*$/
,
""
)
+
service
(
"echo
/
"
,
{
content
:
"{
\"
data
\"
: {
\"
lang
\"
:
\"
en
\"
,
\"
length
\"
: 25 } }"
content
:
"{
\"
data
\"
: {
\"
lang
\"
:
\"
en
\"
,
\"
length
\"
: 25 } }"
}),
function
(
json
)
{
}),
function
(
json
)
{
deepEqual
(
json
,
{
deepEqual
(
json
,
{
...
@@ -1564,7 +1561,7 @@ module( "ajax", {
...
@@ -1564,7 +1561,7 @@ module( "ajax", {
asyncTest
(
"jQuery.getScript( String, Function ) - with callback"
,
2
,
function
()
{
asyncTest
(
"jQuery.getScript( String, Function ) - with callback"
,
2
,
function
()
{
Globals
.
register
(
"testBar"
);
Globals
.
register
(
"testBar"
);
jQuery
.
getScript
(
service
(
"echo"
,
{
jQuery
.
getScript
(
service
(
"echo
/
"
,
{
content
:
"var testBar =
\"
bar
\"
; ok( true,
\"
script executed
\"
);"
content
:
"var testBar =
\"
bar
\"
; ok( true,
\"
script executed
\"
);"
}),
function
(
data
,
_
,
jqXHR
)
{
}),
function
(
data
,
_
,
jqXHR
)
{
strictEqual
(
testBar
,
"bar"
,
"Check if script was evaluated"
);
strictEqual
(
testBar
,
"bar"
,
"Check if script was evaluated"
);
...
@@ -1574,14 +1571,14 @@ module( "ajax", {
...
@@ -1574,14 +1571,14 @@ module( "ajax", {
asyncTest
(
"jQuery.getScript( String, Function ) - no callback"
,
1
,
function
()
{
asyncTest
(
"jQuery.getScript( String, Function ) - no callback"
,
1
,
function
()
{
Globals
.
register
(
"testBar"
);
Globals
.
register
(
"testBar"
);
jQuery
.
getScript
(
service
(
"echo"
,
{
jQuery
.
getScript
(
service
(
"echo
/
"
,
{
content
:
"var testBar =
\"
bar
\"
; ok( true,
\"
script executed
\"
);"
content
:
"var testBar =
\"
bar
\"
; ok( true,
\"
script executed
\"
);"
})
).
done
(
start
);
})
).
done
(
start
);
});
});
asyncTest
(
"#8082 - jQuery.getScript( String, Function ) - source as responseText"
,
2
,
function
()
{
asyncTest
(
"#8082 - jQuery.getScript( String, Function ) - source as responseText"
,
2
,
function
()
{
Globals
.
register
(
"testBar"
);
Globals
.
register
(
"testBar"
);
jQuery
.
getScript
(
service
(
"echo"
,
{
jQuery
.
getScript
(
service
(
"echo
/
"
,
{
content
:
"var testBar =
\"
bar
\"
; ok( true,
\"
script executed
\"
);"
content
:
"var testBar =
\"
bar
\"
; ok( true,
\"
script executed
\"
);"
}),
function
(
data
,
_
,
jqXHR
)
{
}),
function
(
data
,
_
,
jqXHR
)
{
strictEqual
(
data
,
jqXHR
.
responseText
,
"Same-domain script requests returns the source of the script"
);
strictEqual
(
data
,
jqXHR
.
responseText
,
"Same-domain script requests returns the source of the script"
);
...
@@ -1598,7 +1595,7 @@ module( "ajax", {
...
@@ -1598,7 +1595,7 @@ module( "ajax", {
strictEqual
(
this
.
type
,
"GET"
,
"no data means GET request"
);
strictEqual
(
this
.
type
,
"GET"
,
"no data means GET request"
);
}
}
});
});
jQuery
(
"#first"
).
load
(
service
(
"echo"
,
{
jQuery
(
"#first"
).
load
(
service
(
"echo
/
"
,
{
content
:
"<script>ok( true,
\"
html injected
\"
)</script>"
content
:
"<script>ok( true,
\"
html injected
\"
)</script>"
}),
start
);
}),
start
);
});
});
...
@@ -1618,7 +1615,7 @@ module( "ajax", {
...
@@ -1618,7 +1615,7 @@ module( "ajax", {
strictEqual
(
this
.
type
,
"GET"
,
"null data means GET request"
);
strictEqual
(
this
.
type
,
"GET"
,
"null data means GET request"
);
}
}
});
});
jQuery
(
"#first"
).
load
(
service
(
"echo"
,
{
jQuery
(
"#first"
).
load
(
service
(
"echo
/
"
,
{
content
:
"<script>ok( true,
\"
html injected
\"
)</script>"
content
:
"<script>ok( true,
\"
html injected
\"
)</script>"
}),
null
,
start
);
}),
null
,
start
);
});
});
...
@@ -1630,14 +1627,14 @@ module( "ajax", {
...
@@ -1630,14 +1627,14 @@ module( "ajax", {
strictEqual
(
this
.
type
,
"GET"
,
"undefined data means GET request"
);
strictEqual
(
this
.
type
,
"GET"
,
"undefined data means GET request"
);
}
}
});
});
jQuery
(
"#first"
).
load
(
service
(
"echo"
,
{
jQuery
(
"#first"
).
load
(
service
(
"echo
/
"
,
{
content
:
"<script>ok( true,
\"
html injected
\"
)</script>"
content
:
"<script>ok( true,
\"
html injected
\"
)</script>"
}),
undefined
,
start
);
}),
undefined
,
start
);
});
});
// check if load can be called with only url
// check if load can be called with only url
asyncTest
(
"jQuery.fn.load( URL_SELECTOR )"
,
1
,
function
()
{
asyncTest
(
"jQuery.fn.load( URL_SELECTOR )"
,
1
,
function
()
{
jQuery
(
"#first"
).
load
(
service
(
"echo"
,
{
jQuery
(
"#first"
).
load
(
service
(
"echo
/
"
,
{
content
:
"<div class=
\"
user
\"
></div><div class=
\"
user
\"
></div><div></div>"
content
:
"<div class=
\"
user
\"
></div><div class=
\"
user
\"
></div><div></div>"
})
+
" div.user"
,
function
()
{
})
+
" div.user"
,
function
()
{
strictEqual
(
jQuery
(
this
).
children
(
"div"
).
length
,
2
,
"Verify that specific elements were injected"
);
strictEqual
(
jQuery
(
this
).
children
(
"div"
).
length
,
2
,
"Verify that specific elements were injected"
);
...
@@ -1646,7 +1643,7 @@ module( "ajax", {
...
@@ -1646,7 +1643,7 @@ module( "ajax", {
});
});
asyncTest
(
"jQuery.fn.load( String, Function ) - simple: inject text into DOM"
,
2
,
function
()
{
asyncTest
(
"jQuery.fn.load( String, Function ) - simple: inject text into DOM"
,
2
,
function
()
{
jQuery
(
"#first"
).
load
(
service
(
"echo"
,
{
jQuery
(
"#first"
).
load
(
service
(
"echo
/
"
,
{
content
:
"INJECTED<script>ok( true,
\"
html injected
\"
)</script>"
content
:
"INJECTED<script>ok( true,
\"
html injected
\"
)</script>"
}),
function
()
{
}),
function
()
{
ok
(
/^INJECTED/
.
test
(
jQuery
(
"#first"
).
text
()),
"Check if content was injected into the DOM"
);
ok
(
/^INJECTED/
.
test
(
jQuery
(
"#first"
).
text
()),
"Check if content was injected into the DOM"
);
...
@@ -1664,7 +1661,7 @@ module( "ajax", {
...
@@ -1664,7 +1661,7 @@ module( "ajax", {
Globals
.
register
(
"testFoo"
);
Globals
.
register
(
"testFoo"
);
Globals
.
register
(
"testBar"
);
Globals
.
register
(
"testBar"
);
jQuery
(
"#first"
).
load
(
service
(
"echo"
,
{
jQuery
(
"#first"
).
load
(
service
(
"echo
/
"
,
{
content
:
createComplexHTML
()
content
:
createComplexHTML
()
}),
function
()
{
}),
function
()
{
ok
(
jQuery
(
"#first"
).
html
().
match
(
/^html text/
),
"Check content after loading html"
);
ok
(
jQuery
(
"#first"
).
html
().
match
(
/^html text/
),
"Check content after loading html"
);
...
@@ -1675,7 +1672,7 @@ module( "ajax", {
...
@@ -1675,7 +1672,7 @@ module( "ajax", {
});
});
asyncTest
(
"jQuery.fn.load( String, Function ) - check file with only a script tag"
,
3
,
function
()
{
asyncTest
(
"jQuery.fn.load( String, Function ) - check file with only a script tag"
,
3
,
function
()
{
jQuery
(
"#first"
).
load
(
service
(
"echo"
,
{
jQuery
(
"#first"
).
load
(
service
(
"echo
/
"
,
{
content
:
"<script>var testFoo =
\"
foo
\"
; jQuery(
\"
#foo
\"
).html(
\"
foo
\"
); ok( true,
\"
script executed
\"
);</script>"
content
:
"<script>var testFoo =
\"
foo
\"
; jQuery(
\"
#foo
\"
).html(
\"
foo
\"
); ok( true,
\"
script executed
\"
);</script>"
}),
function
()
{
}),
function
()
{
strictEqual
(
jQuery
(
"#foo"
).
html
(),
"foo"
,
"Check if script evaluation has modified DOM"
);
strictEqual
(
jQuery
(
"#foo"
).
html
(),
"foo"
,
"Check if script evaluation has modified DOM"
);
...
@@ -1690,7 +1687,7 @@ module( "ajax", {
...
@@ -1690,7 +1687,7 @@ module( "ajax", {
return
"Hello World"
;
return
"Hello World"
;
}
}
});
});
jQuery
(
"<div/>"
).
load
(
service
(
"echo"
),
function
(
responseText
)
{
jQuery
(
"<div/>"
).
load
(
service
(
"echo
/
"
),
function
(
responseText
)
{
strictEqual
(
jQuery
(
this
).
html
(),
"Hello World"
,
"Test div was filled with filtered data"
);
strictEqual
(
jQuery
(
this
).
html
(),
"Hello World"
,
"Test div was filled with filtered data"
);
strictEqual
(
responseText
,
"Hello World"
,
"Test callback receives filtered data"
);
strictEqual
(
responseText
,
"Hello World"
,
"Test callback receives filtered data"
);
start
();
start
();
...
@@ -1735,7 +1732,7 @@ module( "ajax", {
...
@@ -1735,7 +1732,7 @@ module( "ajax", {
jQuery
.
map
([
jQuery
.
map
([
{
{
type
:
"success"
,
type
:
"success"
,
url
:
service
(
"echo"
)
url
:
service
(
"echo
/
"
)
},
},
{
{
type
:
"error"
,
type
:
"error"
,
...
@@ -1765,7 +1762,7 @@ module( "ajax", {
...
@@ -1765,7 +1762,7 @@ module( "ajax", {
strictEqual
(
s
.
dataType
,
"html"
,
"Verify the load() dataType was html"
);
strictEqual
(
s
.
dataType
,
"html"
,
"Verify the load() dataType was html"
);
start
();
start
();
});
});
jQuery
(
"#first"
).
load
(
service
(
"echo"
)
);
jQuery
(
"#first"
).
load
(
service
(
"echo
/
"
)
);
});
});
test
(
"#10524 - jQuery.fn.load() - data specified in ajaxSettings is merged in"
,
1
,
function
()
{
test
(
"#10524 - jQuery.fn.load() - data specified in ajaxSettings is merged in"
,
1
,
function
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment