qunitjs / api.qunitjs.com Goto Github PK
View Code? Open in Web Editor NEWMoved to https://github.com/qunitjs/qunit/tree/main/docs
Home Page: https://api.qunitjs.com
License: Other
Moved to https://github.com/qunitjs/qunit/tree/main/docs
Home Page: https://api.qunitjs.com
License: Other
The example here is problematic: http://api.qunitjs.com/QUnit.module/
I've tried to run this test by adding a function Maker() {}
in front. Executing that correctly throws an error "TypeError: object is not a function". We need to either make this.maker
a function itself or change the calls to use a property of this.maker
.
Originally posted here: qunitjs/qunit#388 (comment)
On this page in the documentation: http://api.qunitjs.com/QUnit.moduleDone/
The code snippet looks like this;
QUnit.moduleStart(function( details ) {
console.log( "Finished running: ", details.name, "Failed/total: ", details.failed, details.total );
});
Shouldn't it be this:
QUnit.moduleDone(function( details ) {
console.log( "Finished running: ", details.name, "Failed/total: ", details.failed, details.total );
});
Will be deprecated eventually, but since we documented this on the old API site, we need to document here as well.
Stuff like requireExpect, reorder needs to be documented as well. Should probably go into a single document, with each config option as an <option> element.
We have a neat method of sharing code and objects between tests that existed for a long time, but was never documented:
QUnit.module( "setup test", {
setup: function() {
this.prop = "foo";
},
method: function() {
return "bar";
}
});
QUnit.test( "module with setup", function( assert ) {
assert.ok( this.prop );
assert.ok( this.method() );
});
In ember-qunit, this is used to provide helpers via moduleForComponent
and other methods. We should document this, at least as part of QUnit.module
.
When set to false, user must call QUnit.init()
and start()
manually. Provide an example with AMD integration, something like this:
QUnit.config.autostart = false;
require(["test1", 'test2"], function() {
QUnit.init();
QUnit.start();
});
See qunitjs/qunit#655.
QUnit.log
also provides the module and test names, via module
and name
. This is missing in entries/QUnit.log.xml
.
@leobalter wanna look into this?
No example here: http://api.qunitjs.com/QUnit.moduleStart/
http://api.qunitjs.com/throws/
Sample: --> http://jsfiddle.net/legends77/3DVbS/
The last two throws fail.
First one:
assert.throws(
function () {
throw new CustomError("some error description");
},
new CustomError("some error description")
,
"raised error instance matches the CustomError instance"
);
breaks here:
Died on test #4:
else if (actual instanceof expected) [QUnit line: 1645]
^ TypeError: Expecting a function in instanceof check, but got [object Object]
Perhaps we can reuse the isEqual
method from Underscore.js to check if these two objects are equal ?
Or did I misunderstand something?
The next release makes the depth for QUnit.dump.parse
configurable via QUnit.dump.maxDepth
.
The lifecycle arguments. Also document the testEnviroment thingy, where properties added to this
inside setup are available inside tests and teardown.
Example: The QUnit.assert
type link in the signature of QUnit.test( name, test )
on http://api.qunitjs.com/QUnit.test/. It leads to http://api.jquery.com/Types/#QUnit.assert but there is no documentation of that type there.
Basically need to move the stuff that tells people how to contribute. Use this as a reference, if needed: https://github.com/jquery/jquery/blob/master/CONTRIBUTING.md
Depends on jquery/grunt-jquery-content#54
Based on #55.
In the example at the bottom of http://api.qunitjs.com/equal/ the tests line 2 and 5 appear identical to me... However, one says: "Zero; equal succeeds", while the other one says: "Zero, Zero; equal succeeds".
It looks like QUnit.extend
and QUnit.jsDump
could stay in a different category called Utilities.
Grunt 0.3.17 now requires any project that is linting the gruntfile to include a "use strict" pragma as the first line, we should add one to any project that's linting the gruntfile (or all of them, really). @ronchalant offered to take care of this :)
current code:
QUnit.moduleStart(function( details ) {
console.log( "Now running: ", details.module );
});
right code:
QUnit.moduleStart(function( details ) {
console.log( "Now running: ", details.name);
});
The expected
parameter is optional and supports more types than Error
.
We already export the API as XML. Ping a few people to see what would have to happen to get the QUnit API into intellisense.
The comment in parentheses looks strange, and I'm not sure it's supposed to be there... It needs to be fixed or removed.
https://github.com/jquery/api.qunitjs.com/blob/master/entries/QUnit.begin.xml#L11
Old API site has this description:
Initialize the test runner (if the runner has already run it'll be re-initialized, effectively resetting it). This method does not need to be called in the normal use of QUnit.
This is useful for being able to use the test runner for multiple batches of dynamically-loaded tests (load a batch of tests, get the results, re-init, load a new batch, etc.).
Something about the containing box for the npm/bower install lines on the top page makes the last few characters get cut off, as in this screenshot (Chrome/OSX):
If you copy-paste everything's fine, but just looking at it will give the wrong package name.
Edit: Attached image from imgur.com to the issue directly. โ@Krinkle
As the title says.
I added documentation for QUnit.test
's support for Promises via PR #84 but neglected to document the same capability for the beforeEach
/afterEach
hooks in QUnit.module
.
Tried this just now and getting weird xsl transformation errors. Apparently files written to entries_tmp are empty, so the next transformation step fails. I have no idea why those files get written empty though.
Maybe @rdworth can take a look at this.
See qunitjs/qunit#317. cc @jzaefferer
See qunitjs/qunit#656.
Needs details and examples.
@bboyle at qunitjs/qunitjs.com#48:
"A non-strict comparison assertion, checking for inequality"
Shouldn't this say:
"A strict comparison assertion, checking for inequality"
Given QUnit.jsDump.parse
's utility in defining custom assertions (and the unit tests backing its behavior [1] [2] [3]), the method appears to be part of the public API. Can someone on the team confirm this?
If so, then the documentation should be extended to describe its usage.
[1] https://github.com/jquery/qunit/blob/81d499b0fb06970b5f52185b8153416341c0d49e/test/test.js#L394-L402
[2] https://github.com/jquery/qunit/blob/81d499b0fb06970b5f52185b8153416341c0d49e/test/test.js#L667-L685
[3] https://github.com/jquery/qunit/blob/81d499b0fb06970b5f52185b8153416341c0d49e/test/test.js#L702-L728
setup
and teardown
were renamed to beforeEach
and afterEach
former methods still exists but are now deprecated, the API documentation should mention that
Also needs description for what the argument does. And a proper link to stop(). Which does this properly.
See qunitjs/qunit#456.
See qunitjs/qunit#655.
Document the object along with its interesting properties like testName
.
See qunitjs/qunit#293 for usecase.
The index page should provide an overview of the docs, mention which version the docs apply to, where to find older versions, link to intro tutorials on the learn site, etc.
On https://api.qunitjs.com/ , there is the linked text:
view the full listing of entries
which links to https://api.qunitjs.com/category/all/ , which leads to a 404 page.
QUnit.skip
is about to land on qunitjs/qunit#652 and we should document it before it's release.
Usage:
QUnit.skip( "test name here"[, callback] );
For the logs it does affect the testDone
callback, inserting a skipped: true
detail.
The docs for assert.expect
still show up under the "test" category (which used to be correct, sort of) instead of the "assert" category. We should move that to the proper place.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.