summaryrefslogtreecommitdiff
path: root/spec/javascripts/extensions/jquery_spec.js.coffee
blob: b10e16b7d01353db9df47e695279cf63f4347aff (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
#= require extensions/jquery

describe 'jQuery extensions', ->
  describe 'disable', ->
    beforeEach ->
      fixture.set '<input type="text" />'

    it 'adds the disabled attribute', ->
      $input = $('input').first()

      $input.disable()
      expect($input).toHaveAttr('disabled', 'disabled')

    it 'adds the disabled class', ->
      $input = $('input').first()

      $input.disable()
      expect($input).toHaveClass('disabled')

  describe 'enable', ->
    beforeEach ->
      fixture.set '<input type="text" disabled="disabled" class="disabled" />'

    it 'removes the disabled attribute', ->
      $input = $('input').first()

      $input.enable()
      expect($input).not.toHaveAttr('disabled')

    it 'removes the disabled class', ->
      $input = $('input').first()

      $input.enable()
      expect($input).not.toHaveClass('disabled')