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
f8b7d391
Commit
f8b7d391
authored
Sep 29, 2009
by
John Resig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved some jQuery-specific test methods into the core module.
parent
8df82d2b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
0 deletions
+43
-0
testinit.js
test/data/testinit.js
+43
-0
No files found.
test/data/testinit.js
View file @
f8b7d391
...
@@ -2,3 +2,46 @@ var jQuery = this.jQuery || "jQuery", // For testing .noConflict()
...
@@ -2,3 +2,46 @@ var jQuery = this.jQuery || "jQuery", // For testing .noConflict()
$
=
this
.
$
||
"$"
,
$
=
this
.
$
||
"$"
,
originaljQuery
=
jQuery
,
originaljQuery
=
jQuery
,
original$
=
$
;
original$
=
$
;
/**
* Returns an array of elements with the given IDs, eg.
* @example q("main", "foo", "bar")
* @result [<div id="main">, <span id="foo">, <input id="bar">]
*/
function
q
()
{
var
r
=
[];
for
(
var
i
=
0
;
i
<
arguments
.
length
;
i
++
)
{
r
.
push
(
document
.
getElementById
(
arguments
[
i
]
)
);
}
return
r
;
}
/**
* Asserts that a select matches the given IDs * @example t("Check for something", "//[a]", ["foo", "baar"]);
* @result returns true if "//[a]" return two elements with the IDs 'foo' and 'baa
r'
*/
function
t
(
a
,
b
,
c
)
{
var
f
=
jQuery
(
b
),
s
=
""
;
for
(
var
i
=
0
;
i
<
f
.
length
;
i
++
)
{
s
+=
(
s
&&
","
)
+
'"'
+
f
[
i
].
id
+
'"'
;
}
isSet
(
f
,
q
.
apply
(
q
,
c
),
a
+
" ("
+
b
+
")"
);
}
/**
* Add random number to url to stop IE from caching
*
* @example url("data/test.html")
* @result "data/test.html?10538358428943"
*
* @example url("data/test.php?foo=bar")
* @result "data/test.php?foo=bar&10538358345554"
*/
function
url
(
value
)
{
return
value
+
(
/
\?
/
.
test
(
value
)
?
"&"
:
"?"
)
+
new
Date
().
getTime
()
+
""
+
parseInt
(
Math
.
random
()
*
100000
);
}
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