bootstrap_jquery_spec.js 1.17 KB
Newer Older
1
/* eslint-disable no-var */
Fatih Acet's avatar
Fatih Acet committed
2

3
import $ from 'jquery';
4
import '~/commons/bootstrap';
Fatih Acet's avatar
Fatih Acet committed
5

Mike Greiling's avatar
Mike Greiling committed
6 7 8 9
describe('Bootstrap jQuery extensions', function() {
  describe('disable', function() {
    beforeEach(function() {
      return setFixtures('<input type="text" />');
Fatih Acet's avatar
Fatih Acet committed
10
    });
Mike Greiling's avatar
Mike Greiling committed
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44

    it('adds the disabled attribute', function() {
      var $input;
      $input = $('input').first();
      $input.disable();

      expect($input).toHaveAttr('disabled', 'disabled');
    });
    return it('adds the disabled class', function() {
      var $input;
      $input = $('input').first();
      $input.disable();

      expect($input).toHaveClass('disabled');
    });
  });
  return describe('enable', function() {
    beforeEach(function() {
      return setFixtures('<input type="text" disabled="disabled" class="disabled" />');
    });

    it('removes the disabled attribute', function() {
      var $input;
      $input = $('input').first();
      $input.enable();

      expect($input).not.toHaveAttr('disabled');
    });
    return it('removes the disabled class', function() {
      var $input;
      $input = $('input').first();
      $input.enable();

      expect($input).not.toHaveClass('disabled');
Fatih Acet's avatar
Fatih Acet committed
45 46
    });
  });
Mike Greiling's avatar
Mike Greiling committed
47
});