Skip to content
Browse files

Tests: add tests for passing $ in handler (See #26)

  • Loading branch information...
1 parent 86a4dfb commit c8e04bb5466c1216ae8aac048e215b76e9d0a324 @rstacruz rstacruz committed
Showing with 12 additions and 1 deletion.
  1. +12 −1 spec/jquery.turbolinks_spec.coffee
View
13 spec/jquery.turbolinks_spec.coffee
@@ -30,7 +30,6 @@ describe '$ Turbolinks', ->
describe "DOM isn't ready", ->
beforeEach ->
-
$(callback1 = sinon.spy())
$(callback2 = sinon.spy())
@@ -44,6 +43,13 @@ describe '$ Turbolinks', ->
callback1.should.have.been.calledOnce
callback2.should.have.been.calledOnce
+ it 'should pass $ as the first argument to callbacks', (done) ->
+ $ ($$) ->
+ $$.fn.should.be.an.object
+ done()
+
+ $(document).trigger 'page:load'
+
describe '$.turbo.use', ->
beforeEach ->
$.turbo.use('page:load', 'page:fetch')
@@ -98,3 +104,8 @@ describe '$ Turbolinks', ->
$(document).trigger('page:load')
$(callback2 = sinon.spy())
callback2.should.have.been.calledOnce
+
+ it 'should pass $ as the first argument to callbacks', (done) ->
+ $ ($$) ->
+ $$.fn.should.be.an.object
+ done()

0 comments on commit c8e04bb

Please sign in to comment.
Something went wrong with that request. Please try again.