input.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. describe('input', function() {
  2. beforeEach(function(done) {
  3. $([
  4. '<form class="form-horizontal" id="inputForm">',
  5. '<div class="form-group">',
  6. '<textarea name="text" data-bv-notempty placeholder="Text" />',
  7. '</div>',
  8. '<div class="form-group">',
  9. '<input type="text" name="input1" data-bv-notempty placeholder="Text" />',
  10. '</div>',
  11. '<div class="form-group">',
  12. '<input type="text" name="input2" data-bv-notempty placeholder="Text" />',
  13. '</div>',
  14. '</form>'
  15. ].join('\n')).appendTo('body');
  16. $('#inputForm').bootstrapValidator();
  17. this.bv = $('#inputForm').data('bootstrapValidator');
  18. this.$text = this.bv.getFieldElements('text');
  19. this.$input1 = this.bv.getFieldElements('input1');
  20. this.$input2 = this.bv.getFieldElements('input2');
  21. setTimeout(done, 0);
  22. });
  23. afterEach(function() {
  24. $('#inputForm').bootstrapValidator('destroy').remove();
  25. });
  26. // #1040, #1041
  27. it('Fields should not be validated on init', function() {
  28. expect(this.bv.getMessages(this.$text)).toEqual([]);
  29. expect(this.bv.getMessages(this.$input1)).toEqual([]);
  30. expect(this.bv.getMessages(this.$input2)).toEqual([]);
  31. });
  32. });