diff --git a/.travis.yml b/.travis.yml index c2b1833..b43f640 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,2 +1,2 @@ language: node_js -node_js: ["0.10"] +node_js: ["5.7"] diff --git a/Gemfile b/Gemfile index e4632c6..0b47667 100644 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,6 @@ group :development do gem 'uglifier' gem 'guard' gem 'guard-rake' - gem 'talks', '0.4.0' + gem 'talks', '0.4.1' gem 'terminal-notifier' end diff --git a/lib/jquery-turbolinks/version.rb b/lib/jquery-turbolinks/version.rb index e09644b..41f562e 100644 --- a/lib/jquery-turbolinks/version.rb +++ b/lib/jquery-turbolinks/version.rb @@ -1,3 +1,3 @@ module JqueryTurbolinks - VERSION = '2.1.0' + VERSION = '3.0.0' end diff --git a/package.json b/package.json index 5c59fee..c4d0773 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jquery.turbolinks", - "version": "2.1.0", + "version": "3.0.0", "authors": [ "Sasha Koss ", "Rico Sta. Cruz " @@ -13,14 +13,14 @@ "chai": "~1.9.1", "sinon": "~1.10.3", "sinon-chai": "~2.5.0", - "jquery": "~2.1.1", - "jsdom": "~1.0.0-pre.4" + "jquery": "~2.2.2", + "jsdom": "~8.1.0" }, "license": "MIT", "engine": { - "node": ">=0.4" + "node": ">=4.4" }, "scripts": { diff --git a/spec/jquery.turbolinks_spec.coffee b/spec/jquery.turbolinks_spec.coffee index a4fde06..501ef45 100644 --- a/spec/jquery.turbolinks_spec.coffee +++ b/spec/jquery.turbolinks_spec.coffee @@ -32,7 +32,7 @@ describe '$ Turbolinks', -> # Simulate a reset. beforeEach -> $.turbo.isReady = false - $.turbo.use 'page:load', 'page:fetch' + $.turbo.use 'turbolinks:load', 'turbolinks:request-start' $(document).off('turbo:ready') describe "DOM isn't ready", -> @@ -43,10 +43,10 @@ describe '$ Turbolinks', -> it ''' should trigger callbacks passed to - `$()` and `$.ready()` when page:load + `$()` and `$.ready()` when turbolinks:load event fired ''', -> - $(document).trigger('page:load') + $(document).trigger('turbolinks:load') callback1.should.have.been.calledOnce callback2.should.have.been.calledOnce @@ -56,23 +56,24 @@ describe '$ Turbolinks', -> $$.fn.should.be.an.object done() - $(document).trigger 'page:load' + $(document).trigger 'turbolinks:load' describe '$.turbo.use', -> + beforeEach -> - $.turbo.use('page:load', 'page:fetch') + $.turbo.use('turbolinks:load', 'turbolinks:request-start') - it 'should unbind default (page:load) event', -> + it 'should unbind default (turbolinks:load) event', -> $.turbo.use('other1', 'other2') - $(document).trigger('page:load') + $(document).trigger('turbolinks:load') callback1.should.have.not.been.called callback2.should.have.not.been.called it 'should bind ready to passed function', -> $(document) - .trigger('page:load') + .trigger('turbolinks:load') .trigger('page:change') callback1.should.have.been.calledOnce @@ -81,45 +82,45 @@ describe '$ Turbolinks', -> describe '$.setFetchEvent', -> beforeEach -> - $.turbo.use('page:load', 'page:fetch') + $.turbo.use('turbolinks:load', 'turbolinks:request-start') $.turbo.isReady = true - it 'should unbind default (page:fetch) event', -> - $.turbo.use('page:load', 'random_event_name') - $(document).trigger('page:fetch') + it 'should unbind default (turbolinks:request-start) event', -> + $.turbo.use('turbolinks:load', 'random_event_name') + $(document).trigger('turbolinks:request-start') $.turbo.isReady.should.to.be.true it 'should bind passed fetch event', -> - $.turbo.use('page:load', 'page:loading') - $(document).trigger('page:loading') + $.turbo.use('turbolinks:load', 'turbolinks:loading') + $(document).trigger('turbolinks:loading') $.turbo.isReady.should.to.be.false describe 'DOM is ready', -> beforeEach -> - $.turbo.use('page:load', 'page:fetch') + $.turbo.use('turbolinks:load', 'turbolinks:request-start') $.turbo.isReady = true it 'should call trigger right after add to waiting list', -> $(callback = sinon.spy()) callback.should.have.been.calledOnce - it 'should not call trigger after page:fetch and before page:load', -> - $(document).trigger('page:fetch') + it 'should not call trigger after turbolinks:request-start and before turbolinks:load', -> + $(document).trigger('turbolinks:request-start') $(callback1 = sinon.spy()) callback1.should.have.not.been.called - $(document).trigger('page:load') + $(document).trigger('turbolinks:load') $(callback2 = sinon.spy()) callback2.should.have.been.calledOnce - it 'should call trigger after a subsequent page:fetch and before page:load', -> - $(document).trigger('page:fetch') - $(document).trigger('page:load') + it 'should call trigger after a subsequent turbolinks:request-start and before turbolinks:load', -> + $(document).trigger('turbolinks:request-start') + $(document).trigger('turbolinks:load') $(callback1 = sinon.spy()) callback1.should.have.been.calledOnce - $(document).trigger('page:fetch') - $(document).trigger('page:load') + $(document).trigger('turbolinks:request-start') + $(document).trigger('turbolinks:load') callback1.should.have.been.calledTwice it 'should pass $ as the first argument to callbacks', (done) -> diff --git a/src/jquery.turbolinks.coffee b/src/jquery.turbolinks.coffee index 5b8977a..5ec7cad 100644 --- a/src/jquery.turbolinks.coffee +++ b/src/jquery.turbolinks.coffee @@ -10,7 +10,7 @@ $ = window.jQuery or require?('jquery') $document = $(document) $.turbo = - version: '2.1.0' + version: '3.0.0' isReady: false @@ -46,4 +46,4 @@ $.turbo = # Use with Turbolinks. $.turbo.register() -$.turbo.use('page:load', 'page:fetch') +$.turbo.use('turbolinks:load', 'turbolinks:request-start') diff --git a/vendor/assets/javascripts/jquery.turbolinks.js b/vendor/assets/javascripts/jquery.turbolinks.js index fd6e95e..265afa1 100644 --- a/vendor/assets/javascripts/jquery.turbolinks.js +++ b/vendor/assets/javascripts/jquery.turbolinks.js @@ -16,7 +16,7 @@ Copyright (c) 2012-2013 Sasha Koss & Rico Sta. Cruz $document = $(document); $.turbo = { - version: '2.1.0', + version: '3.0.0', isReady: false, use: function(load, fetch) { return $document.off('.turbo').on("" + load + ".turbo", this.onLoad).on("" + fetch + ".turbo", this.onFetch); @@ -44,6 +44,6 @@ Copyright (c) 2012-2013 Sasha Koss & Rico Sta. Cruz $.turbo.register(); - $.turbo.use('page:load', 'page:fetch'); + $.turbo.use('turbolinks:load', 'turbolinks:request-start'); }).call(this); diff --git a/vendor/assets/javascripts/jquery.turbolinks.min.js b/vendor/assets/javascripts/jquery.turbolinks.min.js index 81291e1..ba7c9c0 100644 --- a/vendor/assets/javascripts/jquery.turbolinks.min.js +++ b/vendor/assets/javascripts/jquery.turbolinks.min.js @@ -1 +1 @@ -(function(){var r,t;r=window.jQuery||("function"==typeof require?require("jquery"):void 0),t=r(document),r.turbo={version:"2.1.0",isReady:!1,use:function(r,o){return t.off(".turbo").on(""+r+".turbo",this.onLoad).on(""+o+".turbo",this.onFetch)},addCallback:function(o){return r.turbo.isReady&&o(r),t.on("turbo:ready",function(){return o(r)})},onLoad:function(){return r.turbo.isReady=!0,t.trigger("turbo:ready")},onFetch:function(){return r.turbo.isReady=!1},register:function(){return r(this.onLoad),r.fn.ready=this.addCallback}},r.turbo.register(),r.turbo.use("page:load","page:fetch")}).call(this); \ No newline at end of file +(function(){var r,t;r=window.jQuery||("function"==typeof require?require("jquery"):void 0),t=r(document),r.turbo={version:"3.0.0",isReady:!1,use:function(r,o){return t.off(".turbo").on(""+r+".turbo",this.onLoad).on(""+o+".turbo",this.onFetch)},addCallback:function(o){return r.turbo.isReady&&o(r),t.on("turbo:ready",function(){return o(r)})},onLoad:function(){return r.turbo.isReady=!0,t.trigger("turbo:ready")},onFetch:function(){return r.turbo.isReady=!1},register:function(){return r(this.onLoad),r.fn.ready=this.addCallback}},r.turbo.register(),r.turbo.use("turbolinks:load","turbolinks:request-start")}).call(this); \ No newline at end of file