mirror of
https://github.com/twbs/bootstrap.git
synced 2022-11-09 12:25:43 -05:00
Update js/tests/README.md (#24281)
This commit is contained in:
parent
ebc82db8ef
commit
1aea9d7517
1 changed files with 4 additions and 4 deletions
|
@ -24,7 +24,7 @@ To run the unit test suite via a real web browser, open `index.html` in the brow
|
||||||
|
|
||||||
* Each test should have a unique name clearly stating what unit is being tested.
|
* Each test should have a unique name clearly stating what unit is being tested.
|
||||||
* Each test should test only one unit per test, although one test can include several assertions. Create multiple tests for multiple units of functionality.
|
* Each test should test only one unit per test, although one test can include several assertions. Create multiple tests for multiple units of functionality.
|
||||||
* Each test should begin with [`assert.expect`](https://api.qunitjs.com/expect/) to ensure that the expected assertions are run.
|
* Each test should begin with [`assert.expect`](https://api.qunitjs.com/assert/expect/) to ensure that the expected assertions are run.
|
||||||
* Each test should follow the project's [JavaScript Code Guidelines](https://github.com/twbs/bootstrap/blob/master/CONTRIBUTING.md#js)
|
* Each test should follow the project's [JavaScript Code Guidelines](https://github.com/twbs/bootstrap/blob/master/CONTRIBUTING.md#js)
|
||||||
|
|
||||||
### Example tests
|
### Example tests
|
||||||
|
@ -33,16 +33,16 @@ To run the unit test suite via a real web browser, open `index.html` in the brow
|
||||||
// Synchronous test
|
// Synchronous test
|
||||||
QUnit.test('should describe the unit being tested', function (assert) {
|
QUnit.test('should describe the unit being tested', function (assert) {
|
||||||
assert.expect(1)
|
assert.expect(1)
|
||||||
var templateHTML = '<div class="alert alert-danger fade in">'
|
var templateHTML = '<div class="alert alert-danger fade show">'
|
||||||
+ '<a class="close" href="#" data-dismiss="alert">×</a>'
|
+ '<a class="close" href="#" data-dismiss="alert">×</a>'
|
||||||
+ '<p><strong>Template necessary for the test.</p>'
|
+ '<p><strong>Template necessary for the test.</p>'
|
||||||
+ '</div>'
|
+ '</div>'
|
||||||
var $alert = $(templateHTML).appendTo('#qunit-fixture').bootstrapAlert()
|
var $alert = $(templateHTML).appendTo('#qunit-fixture').bootstrapAlert()
|
||||||
|
|
||||||
$alert.find('.close').click()
|
$alert.find('.close').trigger('click')
|
||||||
|
|
||||||
// Make assertion
|
// Make assertion
|
||||||
assert.strictEqual($alert.hasClass('in'), false, 'remove .in class on .close click')
|
assert.strictEqual($alert.hasClass('show'), false, 'remove .show class on .close click')
|
||||||
})
|
})
|
||||||
|
|
||||||
// Asynchronous test
|
// Asynchronous test
|
||||||
|
|
Loading…
Reference in a new issue