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
5660b6df
Commit
5660b6df
authored
May 29, 2012
by
timmywil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update README to stylize docs on jQuery's test suite methods
parent
a8d9d053
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
45 deletions
+64
-45
README.md
README.md
+64
-45
No files found.
README.md
View file @
5660b6df
...
...
@@ -164,56 +164,75 @@ Following are some commands that can be used there:
[QUnit](http://docs.jquery.com/QUnit) Reference
-----------------
Test methods:
expect( numAssertions )
stop()
start()
### Test methods ###
expect( numAssertions );
stop();
start();
note: QUnit's eventual addition of an argument to stop/start is ignored in this test suite
so that start and stop can be passed as callbacks without worrying about
their parameters
Test assertions:
ok( value,
[
message
]
)
equal( actual, expected,
[
message
]
)
notEqual( actual, expected,
[
message
]
)
deepEqual( actual, expected,
[
message
]
)
notDeepEqual( actual, expected,
[
message
]
)
strictEqual( actual, expected,
[
message
]
)
notStrictEqual( actual, expected,
[
message
]
)
raises( block,
[
expected
]
,
[
message
]
)
so that start and stop can be passed as callbacks without worrying about
their parameters
### Test assertions ###
ok( value, [message] )
;
equal( actual, expected, [message] )
;
notEqual( actual, expected, [message] )
;
deepEqual( actual, expected, [message] )
;
notDeepEqual( actual, expected, [message] )
;
strictEqual( actual, expected, [message] )
;
notStrictEqual( actual, expected, [message] )
;
raises( block, [expected], [message] )
;
Test Suite Convenience Methods Reference (See [test/data/testinit.js](https://github.com/jquery/jquery/blob/master/test/data/testinit.js))
------------------------------
q( ... );
Returns an array of elements with the given IDs
@example q("main", "foo", "bar") =>
[
<div id="main">, <span id="foo">, <input id="bar">
]
t( testName, selector,
[
"#array", "#of", "#ids"
]
);
Asserts that a select matches the given IDs
@example t("Check for something", "//
[
a
]
",
[
"foo", "baar"
]
);
fireNative( node, eventType );
Fires a native DOM event without going through jQuery
@example fireNative( jQuery("#elem")
[
0
]
, "click" );
url( "some/url.php" );
Add random number to url to stop caching
@example url("data/test.html") => "data/test.html?10538358428943"
@example url("data/test.php?foo=bar") => "data/test.php?foo=bar&10538358345554"
testIframe( fileName, testName, callback );
Loads a given page constructing a url with fileName: "./data/" + fileName + ".html"
and fires the given callback on jQuery ready (using the jQuery loading from that page)
and passes the iFrame's jQuery to the callback.
Callback arguments:
callback( jQueryFromIFrame, iFrameWindow, iFrameDocument )
testIframeWithCallback( testName, fileName, callback )
Loads a given page constructing a url with fileName: "./data/" + fileName + ".html"
The given callback is fired when window.iframeCallback is called by the page
The arguments passed to the callback are the same as the
arguments passed to window.iframeCallback, whatever that may be
### Returns an array of elements with the given IDs ###
q( ... );
@example
`q("main", "foo", "bar")`
=>
[
`<div id="main">`, `<span id="foo">`, `input id="bar">`
]
### Asserts that a select matches the given IDs ###
t( testName, selector, [ "#array", "#of", "#ids" ] );
@example
`t("Check for something", "//[a]", ["foo", "baar"]);`
### Fires a native DOM event without going through jQuery ###
fireNative( node, eventType );
@example
`fireNative( jQuery("#elem")[0], "click" );`
### Add random number to url to stop caching ###
url( "some/url.php" );
@example
`url("data/test.html")`
=>
`"data/test.html?10538358428943"`
@example
`url("data/test.php?foo=bar")`
=>
`"data/test.php?foo=bar&10538358345554"`
### Load tests in an iframe ###
Loads a given page constructing a url with fileName:
`"./data/" + fileName + ".html"`
and fires the given callback on jQuery ready (using the jQuery loading from that page)
and passes the iFrame's jQuery to the callback.
testIframe( fileName, testName, callback );
Callback arguments:
callback( jQueryFromIFrame, iFrameWindow, iFrameDocument )
### Load tests in an iframe (window.iframeCallback) ###
Loads a given page constructing a url with fileName:
`"./data/" + fileName + ".html"`
The given callback is fired when window.iframeCallback is called by the page
The arguments passed to the callback are the same as the
arguments passed to window.iframeCallback, whatever that may be
testIframeWithCallback( testName, fileName, callback )
Questions?
----------
...
...
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