Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-05-27 01:33:04 +0300
committerRobert Speicher <rspeicher@gmail.com>2015-06-03 03:32:07 +0300
commit456095440425f91028f218748f366bf16e5c7d4b (patch)
treed335b8799af5456c10d4d3adaaa82bfec8eaff61 /spec/javascripts
parent2313d42b37977afc884a2a2fc7e91180e0acbaf3 (diff)
Move jQuery enable/disable extensions to extensions/jquery
Removes redundant enableButton/disableButton extensions, and adds specs for the jQuery extensions.
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/extensions/jquery_spec.js.coffee34
-rw-r--r--spec/javascripts/spec_helper.coffee18
2 files changed, 43 insertions, 9 deletions
diff --git a/spec/javascripts/extensions/jquery_spec.js.coffee b/spec/javascripts/extensions/jquery_spec.js.coffee
new file mode 100644
index 00000000000..b10e16b7d01
--- /dev/null
+++ b/spec/javascripts/extensions/jquery_spec.js.coffee
@@ -0,0 +1,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')
diff --git a/spec/javascripts/spec_helper.coffee b/spec/javascripts/spec_helper.coffee
index 892a539d96b..47b41dd2c81 100644
--- a/spec/javascripts/spec_helper.coffee
+++ b/spec/javascripts/spec_helper.coffee
@@ -1,12 +1,3 @@
-# Teaspoon includes some support files, but you can use anything from your own
-# support path too.
-
-# require support/jasmine-jquery-1.7.0
-# require support/jasmine-jquery-2.0.0
-# require support/jasmine-jquery-2.1.0
-# require support/sinon
-# require support/your-support-file
-
# PhantomJS (Teaspoons default driver) doesn't have support for
# Function.prototype.bind, which has caused confusion. Use this polyfill to
# avoid the confusion.
@@ -21,6 +12,15 @@
#= require bootstrap
#= require underscore
+# Teaspoon includes some support files, but you can use anything from your own
+# support path too.
+
+# require support/jasmine-jquery-1.7.0
+# require support/jasmine-jquery-2.0.0
+#= require support/jasmine-jquery-2.1.0
+# require support/sinon
+# require support/your-support-file
+
# Deferring execution
# If you're using CommonJS, RequireJS or some other asynchronous library you can