1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Removed event handlers after JavaScript tests complete.

Fixes error "Assertion occurred after test had finished" with newer
versions of QUnit.
This commit is contained in:
Jon Dufresne 2020-03-14 15:08:03 -07:00 committed by Carlton Gibson
parent 25d450c852
commit 48d50dd53f

View File

@ -47,6 +47,7 @@ QUnit.test('add/remove form events', function(assert) {
assert.ok(true, 'event `formset:added` triggered'); assert.ok(true, 'event `formset:added` triggered');
assert.equal(true, $row.is('#first-1')); assert.equal(true, $row.is('#first-1'));
assert.equal(formsetName, 'first'); assert.equal(formsetName, 'first');
$document.off('formset:added');
}); });
addButton.click(); addButton.click();
var deletedRow = $('#first-1'); var deletedRow = $('#first-1');
@ -55,6 +56,7 @@ QUnit.test('add/remove form events', function(assert) {
assert.ok(true, 'event `formset:removed` triggered'); assert.ok(true, 'event `formset:removed` triggered');
assert.equal(true, $row.is(deletedRow)); assert.equal(true, $row.is(deletedRow));
assert.equal(formsetName, 'first'); assert.equal(formsetName, 'first');
$document.off('formset:removed');
}); });
deleteLink.trigger($.Event('click', {target: deleteLink})); deleteLink.trigger($.Event('click', {target: deleteLink}));
}); });