summaryrefslogtreecommitdiff
path: root/spec/javascripts/extensions/jquery_spec.js
blob: 87581f24031a8f20809ffbe1f6e58cf8f929fe57 (plain)
1
2
3
4
5
6
7
8
9
10
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

/*= require extensions/jquery */
describe('jQuery extensions', function() {
  describe('disable', function() {
    beforeEach(function() {
      return fixture.set('<input type="text" />');
    });
    it('adds the disabled attribute', function() {
      var $input;
      $input = $('input').first();
      $input.disable();
      return expect($input).toHaveAttr('disabled', 'disabled');
    });
    return it('adds the disabled class', function() {
      var $input;
      $input = $('input').first();
      $input.disable();
      return expect($input).toHaveClass('disabled');
    });
  });
  return describe('enable', function() {
    beforeEach(function() {
      return fixture.set('<input type="text" disabled="disabled" class="disabled" />');
    });
    it('removes the disabled attribute', function() {
      var $input;
      $input = $('input').first();
      $input.enable();
      return expect($input).not.toHaveAttr('disabled');
    });
    return it('removes the disabled class', function() {
      var $input;
      $input = $('input').first();
      $input.enable();
      return expect($input).not.toHaveClass('disabled');
    });
  });
});