mirror of
https://github.com/django/django.git
synced 2025-09-13 05:57:52 +00:00
DEP 0003 -- Added JavaScript unit tests.
Setup QUnit, added tests, and measured test coverage. Thanks to Nick Sanford for the initial tests.
This commit is contained in:
parent
3bbaf84d65
commit
2d0dead224
19 changed files with 4716 additions and 2 deletions
28
js_tests/admin/inlines.test.js
Normal file
28
js_tests/admin/inlines.test.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
module('admin.inlines: tabular formsets', {
|
||||
beforeEach: function() {
|
||||
var $ = django.jQuery;
|
||||
var that = this;
|
||||
this.addText = 'Add another';
|
||||
|
||||
$('#qunit-fixture').append($('#tabular-formset').text());
|
||||
this.table = $('table.inline');
|
||||
this.inlineRow = this.table.find('tr');
|
||||
that.inlineRow.tabularFormset({
|
||||
prefix: 'first',
|
||||
addText: that.addText,
|
||||
deleteText: 'Remove'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
test('no forms', function(assert) {
|
||||
assert.ok(this.inlineRow.hasClass('dynamic-first'));
|
||||
assert.equal(this.table.find('.add-row a').text(), this.addText);
|
||||
});
|
||||
|
||||
test('add form', function(assert) {
|
||||
var addButton = this.table.find('.add-row a');
|
||||
assert.equal(addButton.text(), this.addText);
|
||||
addButton.click();
|
||||
assert.ok(this.table.find('#first-1').hasClass('row2'));
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue