Fixed #26811 -- Added addButton option to admin inlines JavaScript.

This commit is contained in:
David Sanders 2016-06-28 12:19:53 -07:00 committed by Tim Graham
parent 52a991d976
commit 7ca6007bd2
3 changed files with 46 additions and 23 deletions

View file

@ -51,3 +51,21 @@ test('add/remove form events', function(assert) {
});
deleteLink.click();
});
test('existing add button', function(assert) {
var $ = django.jQuery;
$('#qunit-fixture').empty(); // Clear the table added in beforeEach
$('#qunit-fixture').append($('#tabular-formset').text());
this.table = $('table.inline');
this.inlineRow = this.table.find('tr');
this.table.append('<i class="add-button"></i>');
var addButton = this.table.find('.add-button');
this.inlineRow.tabularFormset({
prefix: 'first',
deleteText: 'Remove',
addButton: addButton
});
assert.equal(this.table.find('.add-row a').length, 0);
addButton.click();
assert.ok(this.table.find('#first-1').hasClass('row2'));
});