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
d4e666d4
Commit
d4e666d4
authored
Jan 08, 2013
by
jaubourg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
strengthens and dries 304 unit tests
parent
ce426c5d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
52 deletions
+34
-52
ajax.js
test/unit/ajax.js
+34
-52
No files found.
test/unit/ajax.js
View file @
d4e666d4
...
@@ -973,55 +973,35 @@ module( "ajax", {
...
@@ -973,55 +973,35 @@ module( "ajax", {
},
},
function
(
label
,
cache
)
{
function
(
label
,
cache
)
{
// Support: Opera 12.0
// Support: Opera 12.0
// Old Opera's XHR doesn't support 304/If-Modified-Since/If-None-Match
// In Opera 12.0, XHR doesn't notify 304 back to the user properly
var
isOpera
=
!!
window
.
opera
;
var
opera
=
window
.
opera
&&
window
.
opera
.
version
();
asyncTest
(
"jQuery.ajax() - If-Modified-Since support"
+
label
,
3
,
function
()
{
jQuery
.
each
(
var
url
=
"data/if_modified_since.php?ts="
+
ifModifiedNow
++
;
{
jQuery
.
ajax
({
"If-Modified-Since"
:
"if_modified_since.php"
,
url
:
url
,
"Etag"
:
"etag.php"
ifModified
:
true
,
cache
:
cache
,
success
:
function
(
data
,
status
)
{
strictEqual
(
status
,
"success"
);
jQuery
.
ajax
({
url
:
url
,
ifModified
:
true
,
cache
:
cache
,
success
:
function
(
data
,
status
)
{
if
(
status
===
"success"
)
{
ok
(
isOpera
,
"Old Opera is incapable of doing .setRequestHeader('If-Modified-Since')."
);
ok
(
isOpera
,
"Old Opera is incapable of doing .setRequestHeader('If-Modified-Since')."
);
}
else
{
strictEqual
(
status
,
"notmodified"
);
ok
(
data
==
null
,
"response body should be empty"
);
}
},
},
complete
:
function
()
{
function
(
type
,
url
)
{
start
();
url
=
"data/"
+
url
+
"?ts="
+
ifModifiedNow
++
;
}
asyncTest
(
"jQuery.ajax() - "
+
type
+
" support"
+
label
,
4
,
function
()
{
});
}
});
});
asyncTest
(
"jQuery.ajax() - Etag support"
+
label
,
3
,
function
()
{
var
url
=
"data/etag.php?ts="
+
ifModifiedNow
++
;
jQuery
.
ajax
({
jQuery
.
ajax
({
url
:
url
,
url
:
url
,
ifModified
:
true
,
ifModified
:
true
,
cache
:
cache
,
cache
:
cache
,
success
:
function
(
data
,
status
)
{
success
:
function
(
_
,
status
)
{
strictEqual
(
status
,
"success
"
);
strictEqual
(
status
,
"success"
,
"Initial status is 'success'
"
);
jQuery
.
ajax
({
jQuery
.
ajax
({
url
:
url
,
url
:
url
,
ifModified
:
true
,
ifModified
:
true
,
cache
:
cache
,
cache
:
cache
,
success
:
function
(
data
,
status
)
{
success
:
function
(
data
,
status
,
jqXHR
)
{
if
(
status
===
"success"
)
{
if
(
status
===
"success"
&&
opera
===
"12.00"
)
{
ok
(
isOpera
,
"Old Opera is incapable of doing .setRequestHeader('If-None-Match')."
);
strictEqual
(
status
,
"success"
,
"Opera 12.0: Following status is 'success'"
);
ok
(
isOpera
,
"Old Opera is incapable of doing .setRequestHeader('If-None-Match')."
);
strictEqual
(
jqXHR
.
status
,
200
,
"Opera 12.0: XHR status is 200, not 304"
);
strictEqual
(
data
,
""
,
"Opera 12.0: response body is empty"
);
}
else
{
}
else
{
strictEqual
(
status
,
"notmodified"
);
strictEqual
(
status
,
"notmodified"
,
"Following status is 'notmodified'"
);
ok
(
data
==
null
,
"response body should be empty"
);
strictEqual
(
jqXHR
.
status
,
304
,
"XHR status is 304"
);
equal
(
data
,
null
,
"no response body is given"
);
}
}
},
},
complete
:
function
()
{
complete
:
function
()
{
...
@@ -1032,6 +1012,8 @@ module( "ajax", {
...
@@ -1032,6 +1012,8 @@ module( "ajax", {
});
});
});
});
}
}
);
}
/* jQuery.each arguments end */
/* jQuery.each arguments end */
);
);
...
...
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