From bc3f33f92a16d3afdb8a472f60940e7c46a31564 Mon Sep 17 00:00:00 2001 From: Fatih Acet Date: Fri, 22 Jul 2016 17:01:57 +0300 Subject: JSify all the things! --- spec/javascripts/application_spec.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 spec/javascripts/application_spec.js (limited to 'spec/javascripts/application_spec.js') diff --git a/spec/javascripts/application_spec.js b/spec/javascripts/application_spec.js new file mode 100644 index 00000000000..75b891c3ef0 --- /dev/null +++ b/spec/javascripts/application_spec.js @@ -0,0 +1,28 @@ + +/*= require lib/utils/common_utils */ +describe('Application', function() { + return describe('disable buttons', function() { + fixture.preload('application.html'); + beforeEach(function() { + return fixture.load('application.html'); + }); + it('should prevent default action for disabled buttons', function() { + var $button, isClicked; + gl.utils.preventDisabledButtons(); + isClicked = false; + $button = $('#test-button'); + $button.click(function() { + return isClicked = true; + }); + $button.trigger('click'); + return expect(isClicked).toBe(false); + }); + return it('should be on the same page if a disabled link clicked', function() { + var locationBeforeLinkClick; + locationBeforeLinkClick = window.location.href; + gl.utils.preventDisabledButtons(); + $('#test-link').click(); + return expect(window.location.href).toBe(locationBeforeLinkClick); + }); + }); +}); -- cgit v1.2.1