summaryrefslogtreecommitdiff
path: root/spec/javascripts/application_spec.js.coffee
blob: 8af39c41f2f5a93d718050ad83e38973c37dad89 (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
#= require lib/common_utils

describe 'Application', ->
  describe 'disable buttons', ->
    fixture.preload('application.html')

    beforeEach ->
      fixture.load('application.html')

    it 'should prevent default action for disabled buttons', ->

      gl.utils.preventDisabledButtons()

      isClicked = false
      $button   = $ '#test-button'

      $button.click -> isClicked = true
      $button.trigger 'click'

      expect(isClicked).toBe false


    it 'should be on the same page if a disabled link clicked', ->

      locationBeforeLinkClick = window.location.href
      gl.utils.preventDisabledButtons()

      $('#test-link').click()

      expect(window.location.href).toBe locationBeforeLinkClick