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
0c185209
Commit
0c185209
authored
Sep 03, 2013
by
Richard Gibson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
No ticket: Hide the testing-support jQuery from tests
parent
f66d53c8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
32 deletions
+41
-32
.jshintrc
test/.jshintrc
+2
-0
testinit.js
test/data/testinit.js
+7
-6
testrunner.js
test/data/testrunner.js
+26
-22
attributes.js
test/unit/attributes.js
+1
-1
core.js
test/unit/core.js
+4
-3
event.js
test/unit/event.js
+1
-0
No files found.
test/.jshintrc
View file @
0c185209
...
...
@@ -38,6 +38,7 @@
"ajaxTest": false,
"testIframe": false,
"testIframeWithCallback": false,
"iframeCallback": true,
"createDashboardXML": false,
"createXMLFragment": false,
"moduleTeardown": false,
...
...
@@ -54,6 +55,7 @@
"Globals": true,
"hasPHP": true,
"isLocal": true,
"supportjQuery": true,
"originaljQuery": true,
"$": true,
"original$": true,
...
...
test/data/testinit.js
View file @
0c185209
/*jshint multistr:true, quotmark:false */
var
fireNative
,
originaljQuery
=
this
.
jQuery
||
"jQuery"
,
original$
=
this
.
$
||
"$"
,
var
fireNative
,
originaljQuery
,
original$
,
supportjQuery
=
this
.
jQuery
,
// see RFC 2606
externalHost
=
"example.com"
;
this
.
hasPHP
=
true
;
this
.
isLocal
=
window
.
location
.
protocol
===
"file:"
;
// For testing .noConflict()
this
.
jQuery
=
originaljQuery
;
this
.
$
=
original$
;
// Setup global variables before loading jQuery for testing .noConflict()
supportjQuery
.
noConflict
(
true
);
originaljQuery
=
this
.
jQuery
=
undefined
;
original$
=
this
.
$
=
"replaced"
;
/**
* Returns an array of elements with the given IDs
...
...
@@ -253,3 +253,4 @@ this.testIframeWithCallback = function( title, fileName, func ) {
).
appendTo
(
"body"
);
});
};
this
.
iframeCallback
=
undefined
;
test/data/testrunner.js
View file @
0c185209
/**
* Allow the test suite to run with other libs or jQuery's.
*/
jQuery
.
noConflict
();
if
(
typeof
jQuery
!==
"undefined"
)
{
/**
* Allow the test suite to run with other libs or jQuery's.
*/
jQuery
.
noConflict
();
// Expose Sizzle for Sizzle's selector tests
// We remove Sizzle's globalization in jQuery
this
.
Sizzle
=
this
.
Sizzle
||
jQuery
.
find
;
}
// For checking globals pollution despite auto-created globals in various environments
jQuery
.
each
(
[
jQuery
.
expando
,
"getInterface"
,
"Packages"
,
"java"
,
"netscape"
],
function
(
i
,
name
)
{
support
jQuery
.
each
(
[
jQuery
.
expando
,
"getInterface"
,
"Packages"
,
"java"
,
"netscape"
],
function
(
i
,
name
)
{
window
[
name
]
=
window
[
name
];
});
// Expose Sizzle for Sizzle's selector tests
// We remove Sizzle's globalization in jQuery
var
Sizzle
=
Sizzle
||
jQuery
.
find
,
// Allow subprojects to test against their own fixtures
qunitModule
=
QUnit
.
module
,
var
qunitModule
=
QUnit
.
module
,
qunitTest
=
QUnit
.
test
;
/**
...
...
@@ -53,7 +55,7 @@ this.testSubproject = function( label, url, risTests, complete ) {
// Find test function and wrap to require subproject fixture
for
(
;
i
>=
0
;
i
--
)
{
if
(
original
jQuery
.
isFunction
(
args
[
i
]
)
)
{
if
(
support
jQuery
.
isFunction
(
args
[
i
]
)
)
{
args
[
i
]
=
requireFixture
(
args
[
i
]
);
break
;
}
...
...
@@ -64,7 +66,7 @@ this.testSubproject = function( label, url, risTests, complete ) {
// Load tests and fixture from subproject
// Test order matters, so we must be synchronous and throw an error on load failure
original
jQuery
.
ajax
(
url
,
{
support
jQuery
.
ajax
(
url
,
{
async
:
false
,
dataType
:
"html"
,
error
:
function
(
jqXHR
,
status
)
{
...
...
@@ -72,7 +74,7 @@ this.testSubproject = function( label, url, risTests, complete ) {
},
success
:
function
(
data
,
status
,
jqXHR
)
{
var
sources
=
[],
page
=
original
jQuery
.
parseHTML
(
page
=
support
jQuery
.
parseHTML
(
// replace html/head with dummy elements so they are represented in the DOM
(
data
||
""
).
replace
(
/<
\/?((
!DOCTYPE|html|head
)\b
.*
?)
>/gi
,
"[$1]"
),
document
,
...
...
@@ -82,11 +84,11 @@ this.testSubproject = function( label, url, risTests, complete ) {
if
(
!
page
||
!
page
.
length
)
{
this
.
error
(
jqXHR
,
"no data"
);
}
page
=
original
jQuery
(
page
);
page
=
support
jQuery
(
page
);
// Include subproject tests
page
.
filter
(
"script[src]"
).
add
(
page
.
find
(
"script[src]"
)
).
map
(
function
()
{
var
src
=
original
jQuery
(
this
).
attr
(
"src"
);
var
src
=
support
jQuery
(
this
).
attr
(
"src"
);
if
(
risTests
.
test
(
src
)
)
{
sources
.
push
(
src
);
}
...
...
@@ -123,7 +125,7 @@ this.testSubproject = function( label, url, risTests, complete ) {
}
// Replace the current fixture, including content outside of #qunit-fixture
var
oldFixture
=
original
jQuery
(
"#qunit-fixture"
);
var
oldFixture
=
support
jQuery
(
"#qunit-fixture"
);
while
(
oldFixture
.
length
&&
!
oldFixture
.
prevAll
(
"[id='qunit']"
).
length
)
{
oldFixture
=
oldFixture
.
parent
();
}
...
...
@@ -133,7 +135,7 @@ this.testSubproject = function( label, url, risTests, complete ) {
// WARNING: UNDOCUMENTED INTERFACE
QUnit
.
config
.
fixture
=
fixtureHTML
;
QUnit
.
reset
();
if
(
original
jQuery
(
"#qunit-fixture"
).
html
()
!==
fixtureHTML
)
{
if
(
support
jQuery
(
"#qunit-fixture"
).
html
()
!==
fixtureHTML
)
{
ok
(
false
,
"Copied subproject fixture"
);
return
;
}
...
...
@@ -153,15 +155,15 @@ this.Globals = (function() {
return
{
register
:
function
(
name
)
{
globals
[
name
]
=
true
;
jQuery
.
globalEval
(
"var "
+
name
+
" = undefined;"
);
support
jQuery
.
globalEval
(
"var "
+
name
+
" = undefined;"
);
},
cleanup
:
function
()
{
var
name
,
current
=
globals
;
globals
=
{};
for
(
name
in
current
)
{
jQuery
.
globalEval
(
"try { "
+
"delete "
+
(
jQuery
.
support
.
deleteExpando
?
"window['"
+
name
+
"']"
:
name
)
+
support
jQuery
.
globalEval
(
"try { "
+
"delete "
+
(
support
jQuery
.
support
.
deleteExpando
?
"window['"
+
name
+
"']"
:
name
)
+
"; } catch( x ) {}"
);
}
}
...
...
@@ -223,7 +225,7 @@ this.Globals = (function() {
if
(
elems
.
jquery
&&
elems
.
toArray
)
{
elems
=
elems
.
toArray
();
}
if
(
!
jQuery
.
isArray
(
elems
)
)
{
if
(
!
support
jQuery
.
isArray
(
elems
)
)
{
elems
=
[
elems
];
}
...
...
@@ -341,7 +343,7 @@ this.Globals = (function() {
QUnit
.
done
(
function
()
{
// Remove our own fixtures outside #qunit-fixture
jQuery
(
"#qunit ~ *"
).
remove
();
support
jQuery
(
"#qunit ~ *"
).
remove
();
});
// jQuery-specific QUnit.reset
...
...
@@ -349,6 +351,8 @@ this.Globals = (function() {
// Ensure jQuery events and data on the fixture are properly removed
jQuery
(
"#qunit-fixture"
).
empty
();
// ...even if the jQuery under test has a broken .empty()
supportjQuery
(
"#qunit-fixture"
).
empty
();
// Reset internal jQuery state
jQuery
.
event
.
global
=
{};
...
...
test/unit/attributes.js
View file @
0c185209
...
...
@@ -96,7 +96,7 @@ test( "attr(String)", function() {
jQuery
(
"<a id='tAnchor6' href='#5' />"
).
appendTo
(
"#qunit-fixture"
);
equal
(
jQuery
(
"#tAnchor5"
).
prop
(
"href"
),
jQuery
(
"#tAnchor6"
).
prop
(
"href"
),
"Check for absolute href prop on an anchor"
);
$
(
"<script type='jquery/test' src='#5' id='scriptSrc'></script>"
).
appendTo
(
"#qunit-fixture"
);
jQuery
(
"<script type='jquery/test' src='#5' id='scriptSrc'></script>"
).
appendTo
(
"#qunit-fixture"
);
equal
(
jQuery
(
"#tAnchor5"
).
prop
(
"href"
),
jQuery
(
"#scriptSrc"
).
prop
(
"src"
),
"Check for absolute src prop on a script"
);
// list attribute is readonly by default in browsers that support it
...
...
test/unit/core.js
View file @
0c185209
...
...
@@ -351,8 +351,9 @@ asyncTest("isPlainObject", function() {
ok
(
pass
,
"Does not throw exceptions on host objects"
);
// Objects from other windows should be matched
window
.
iframeCallback
=
function
(
otherObject
,
detail
)
{
window
.
iframeCallback
=
undefined
;
Globals
.
register
(
"iframeDone"
);
window
.
iframeDone
=
function
(
otherObject
,
detail
)
{
window
.
iframeDone
=
undefined
;
iframe
.
parentNode
.
removeChild
(
iframe
);
ok
(
jQuery
.
isPlainObject
(
new
otherObject
()),
"new otherObject"
+
(
detail
?
" - "
+
detail
:
""
)
);
start
();
...
...
@@ -362,7 +363,7 @@ asyncTest("isPlainObject", function() {
iframe
=
jQuery
(
"#qunit-fixture"
)[
0
].
appendChild
(
document
.
createElement
(
"iframe"
)
);
doc
=
iframe
.
contentDocument
||
iframe
.
contentWindow
.
document
;
doc
.
open
();
doc
.
write
(
"<body onload='window.parent.iframe
Callback
(Object);'>"
);
doc
.
write
(
"<body onload='window.parent.iframe
Done
(Object);'>"
);
doc
.
close
();
}
catch
(
e
)
{
window
.
iframeDone
(
Object
,
"iframes not supported"
);
...
...
test/unit/event.js
View file @
0c185209
...
...
@@ -2380,6 +2380,7 @@ test("focus-blur order (#12868)", function() {
// Run handlers without native method on an input
order
=
1
;
$radio
.
triggerHandler
(
"focus"
);
$text
.
off
();
start
();
},
50
);
},
50
);
...
...
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