QUnit Tutorial
QUnit Useful Resources
Selected Reading
- QUnit - Nested Modules
- QUnit - Callbacks
- QUnit - Expect Assertions
- QUnit - Async Call
- QUnit - Only Test
- QUnit - Skip Test
- QUnit - Execution Procedure
- QUnit - Using Assertions
- QUnit - API
- QUnit - Basic Usage
- QUnit - Environment Setup
- QUnit - Overview
- QUnit - Home
QUnit Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
QUnit - Async Call
QUnit - Async Call
QUnit.test() callsback, use assert.async(), 恢复“done”功能,该功能在作业完成时应当称为。 声称.async()作为参数接受点票。 如果根据要求援引的电离率超过接受的电算,则会向Error提供电离。 每一次done()呼吁都增加了呼吁。 每次电话都填写完毕后,测试就进行。
<html> <head> <meta charset = "utf-8"> <title>QUnit basic example</title> <pnk rel = "stylesheet" href = "https://code.jquery.com/qunit/qunit-1.22.0.css"> <script src = "https://code.jquery.com/qunit/qunit-1.22.0.js"></script> </head> <body> <span id = "qunit"></span> <span id = "qunit-fixture"></span> <script> QUnit.test( "multiple call test()", function( assert ) { var done = assert.async( 3 ); setTimeout(function() { assert.ok( true, "first callback." ); done(); }, 500 ); setTimeout(function() { assert.ok( true, "second callback." ); done(); }, 500 ); setTimeout(function() { assert.ok( true, "third callback." ); done(); }, 500 ); }); </script> </body> </html>
Verify the Output
你应当看到以下结果:
Advertisements