Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohann-S <johann.servoire@gmail.com>2018-03-10 01:17:57 +0300
committerJohann-S <johann.servoire@gmail.com>2018-03-13 17:37:11 +0300
commit4d5c5923fae8a4f85462708a2b87c0698cd06b79 (patch)
tree374eab823a62bdce4d6c0e4800aa4c1ec8d7a265 /js/tests/README.md
parentc98ece549001f35e0e75fb59ff2236a9c1a97b9d (diff)
Add Sinon to do better unit test
Diffstat (limited to 'js/tests/README.md')
-rw-r--r--js/tests/README.md14
1 files changed, 9 insertions, 5 deletions
diff --git a/js/tests/README.md b/js/tests/README.md
index 23c5ff39df..3f033e1dc4 100644
--- a/js/tests/README.md
+++ b/js/tests/README.md
@@ -1,9 +1,9 @@
## How does Bootstrap's test suite work?
-Bootstrap uses [QUnit](https://qunitjs.com/), a powerful, easy-to-use JavaScript unit test framework. Each plugin has a file dedicated to its tests in `unit/<plugin-name>.js`.
+Bootstrap uses [QUnit](https://qunitjs.com/) and [Sinon](http://sinonjs.org/). Each plugin has a file dedicated to its tests in `unit/<plugin-name>.js`.
* `unit/` contains the unit test files for each Bootstrap plugin.
-* `vendor/` contains third-party testing-related code (QUnit and jQuery).
+* `vendor/` contains third-party testing-related code (QUnit, jQuery and Sinon).
* `visual/` contains "visual" tests which are run interactively in real browsers and require manual verification by humans.
To run the unit test suite via [Karma](http://karma-runner.github.io/), run `npm run js-test`.
@@ -51,13 +51,17 @@ QUnit.test('should describe the unit being tested', function (assert) {
// Asynchronous test
QUnit.test('should describe the unit being tested', function (assert) {
- assert.expect(1)
+ assert.expect(2)
var done = assert.async()
- $('<div title="tooltip title"></div>')
- .appendTo('#qunit-fixture')
+ var $tooltip = $('<div title="tooltip title"></div>').bootstrapTooltip()
+ var tooltipInstance = $tooltip.data('bs.tooltip')
+ var spyShow = sinon.spy(tooltipInstance, 'show')
+
+ $tooltip.appendTo('#qunit-fixture')
.on('shown.bs.tooltip', function () {
assert.ok(true, '"shown" event was fired after calling "show"')
+ assert.ok(spyShow.called, 'show called')
done()
})
.bootstrapTooltip('show')