inlines.test.js 875 B

12345678910111213141516171819202122232425262728
  1. module('admin.inlines: tabular formsets', {
  2. beforeEach: function() {
  3. var $ = django.jQuery;
  4. var that = this;
  5. this.addText = 'Add another';
  6. $('#qunit-fixture').append($('#tabular-formset').text());
  7. this.table = $('table.inline');
  8. this.inlineRow = this.table.find('tr');
  9. that.inlineRow.tabularFormset({
  10. prefix: 'first',
  11. addText: that.addText,
  12. deleteText: 'Remove'
  13. });
  14. }
  15. });
  16. test('no forms', function(assert) {
  17. assert.ok(this.inlineRow.hasClass('dynamic-first'));
  18. assert.equal(this.table.find('.add-row a').text(), this.addText);
  19. });
  20. test('add form', function(assert) {
  21. var addButton = this.table.find('.add-row a');
  22. assert.equal(addButton.text(), this.addText);
  23. addButton.click();
  24. assert.ok(this.table.find('#first-1').hasClass('row2'));
  25. });