Skip to content

Commit

Permalink
Fixed #28929 -- Corrected QUnit examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
weijunji authored and timgraham committed Dec 18, 2017
1 parent 4dcd772 commit 1ef8b30
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions docs/internals/contributing/writing-code/javascript.txt
Expand Up @@ -81,27 +81,27 @@ Django's JavaScript tests use `QUnit`_. Here is an example test module:

.. code-block:: javascript

module('magicTricks', {
QUnit.module('magicTricks', {
beforeEach: function() {
var $ = django.jQuery;
$('#qunit-fixture').append('<button class="button"></button>');
}
});

test('removeOnClick removes button on click', function(assert) {
QUnit.test('removeOnClick removes button on click', function(assert) {
var $ = django.jQuery;
removeOnClick('.button');
assert.equal($('.button').length === 1);
assert.equal($('.button').length, 1);
$('.button').click();
assert.equal($('.button').length === 0);
assert.equal($('.button').length, 0);
});

test('copyOnClick adds button on click', function(assert) {
QUnit.test('copyOnClick adds button on click', function(assert) {
var $ = django.jQuery;
copyOnClick('.button');
assert.equal($('.button').length === 1);
assert.equal($('.button').length, 1);
$('.button').click();
assert.equal($('.button').length === 2);
assert.equal($('.button').length, 2);
});


Expand Down

0 comments on commit 1ef8b30

Please sign in to comment.