jquery-turbolinks 0.2.1 → 1.0.0.rc

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,2 +1,3 @@
1
1
  node_modules
2
2
  *.gem
3
+ Gemfile.lock
data/README.md CHANGED
@@ -36,6 +36,15 @@ $.setReadyEvent('page:change');
36
36
 
37
37
  This project uses [Semantic Versioning](http://semver.org/) for release numbering.
38
38
 
39
+ ## 1.0.0-rc (November 8, 2012)
40
+
41
+ * Add turbolinks as dependency (kudos to [@gbchaosmaster](https://github.com/gbchaosmaster));
42
+ * run callback after adding to waiting list if `$.isReady` [#6](https://github.com/kossnocorp/jquery.turbolinks/issues/6).
43
+
44
+ ## 0.2.1 (October 15, 2012)
45
+
46
+ * Pass jQuery object to each callback [#4](https://github.com/kossnocorp/jquery.turbolinks/issues/4)
47
+
39
48
  ## 0.2.0 (October 10, 2012)
40
49
 
41
50
  * Change event: `page:change` -> `page:load` (kudos to [@davydotcom](https://github.com/davydotcom));
data/Rakefile CHANGED
@@ -2,6 +2,30 @@ require 'rubygems'
2
2
  require 'open3'
3
3
  require 'talks'
4
4
 
5
+ $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
6
+ require 'jquery-turbolinks/version'
7
+
8
+ namespace :gem do
9
+ task :build do
10
+ system 'gem build jquery-turbolinks.gemspec'
11
+ end
12
+
13
+ task release: :build do
14
+ system "gem push jquery-turbolinks-#{JqueryTurbolinks::VERSION}.gem"
15
+ end
16
+ end
17
+
18
+ namespace :js do
19
+ task :build do
20
+ command = [
21
+ './node_modules/coffee-script/bin/coffee',
22
+ '--compile',
23
+ '--output ./vendor/assets/javascripts/ ./src/jquery.turbolinks.coffee'
24
+ ]
25
+ system command.join(' ')
26
+ end
27
+ end
28
+
5
29
  task :test do
6
30
  stdin, stdout, stderr = Open3.popen3 \
7
31
  './node_modules/mocha/bin/mocha ./spec/*_spec.coffee --compilers coffee:coffee-script -R spec -c'
@@ -36,7 +60,3 @@ task :test do
36
60
  `bundle exec terminal-notifier -message '#{message}' -title 'Test results' -remove TEST_RESULTS -group TEST_RESULTS`
37
61
  Talks.say message, detach: true
38
62
  end
39
-
40
- task :build do
41
- `./node_modules/coffee-script/bin/coffee --compile --output ./vendor/assets/javascripts/ ./src/jquery.turbolinks.coffee`
42
- end
@@ -26,4 +26,5 @@ Gem::Specification.new do |gem|
26
26
  gem.rubygems_version = '1.8.15'
27
27
 
28
28
  gem.add_dependency 'rails', '>= 3.1.0'
29
+ gem.add_dependency 'turbolinks'
29
30
  end
@@ -1,3 +1,3 @@
1
1
  module JqueryTurbolinks
2
- VERSION = '0.2.1'
2
+ VERSION = '1.0.0.rc'
3
3
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jquery.turbolinks",
3
- "version": "0.2.0",
3
+ "version": "1.0.0-rc",
4
4
  "author": "Sasha Koss <koss@nocorp.me>",
5
5
  "description": "jQuery plugin for drop-in fix binded events problem caused by Turbolinks",
6
6
 
@@ -17,41 +17,57 @@ describe '$ Turbolinks', ->
17
17
 
18
18
  callback1 = callback2 = null
19
19
 
20
- beforeEach ->
21
- $(callback1 = sinon.spy())
22
- $(callback2 = sinon.spy())
20
+ describe "DOM isn't ready", ->
23
21
 
24
- it '''
25
- should trigger callbacks passed to
26
- `$()` and `$.ready()` when page:load
27
- event fired
28
- ''', ->
29
- $(document).trigger('page:load')
22
+ beforeEach ->
23
+ $.isReady = false
30
24
 
31
- callback1.should.have.been.calledOnce
32
- callback2.should.have.been.calledOnce
25
+ $(callback1 = sinon.spy())
26
+ $(callback2 = sinon.spy())
33
27
 
34
- it 'should pass jQuery object to callbacks', ->
35
- $(document).trigger('page:load')
28
+ it '''
29
+ should trigger callbacks passed to
30
+ `$()` and `$.ready()` when page:load
31
+ event fired
32
+ ''', ->
33
+ $(document).trigger('page:load')
36
34
 
37
- callback1.should.have.been.calledWith($)
35
+ callback1.should.have.been.calledOnce
36
+ callback2.should.have.been.calledOnce
38
37
 
39
- describe '$.setReadyEvent', ->
38
+ it 'should pass jQuery object to callbacks', ->
39
+ $(document).trigger('page:load')
40
40
 
41
- it 'should unbind default (page:load) event', ->
42
- $.setReadyEvent('random_event_name')
41
+ callback1.should.have.been.calledWith($)
43
42
 
44
- $(document).trigger('page:load')
43
+ describe '$.setReadyEvent', ->
45
44
 
46
- callback1.should.have.not.been.called
47
- callback2.should.have.not.been.called
45
+ it 'should unbind default (page:load) event', ->
46
+ $.setReadyEvent('random_event_name')
48
47
 
49
- it 'should bind ready to passed function', ->
50
- $.setReadyEvent('page:change')
48
+ $(document).trigger('page:load')
51
49
 
52
- $(document)
53
- .trigger('page:load')
54
- .trigger('page:change')
50
+ callback1.should.have.not.been.called
51
+ callback2.should.have.not.been.called
55
52
 
56
- callback1.should.have.been.calledOnce
57
- callback2.should.have.been.calledOnce
53
+ it 'should bind ready to passed function', ->
54
+ $.setReadyEvent('page:change')
55
+
56
+ $(document)
57
+ .trigger('page:load')
58
+ .trigger('page:change')
59
+
60
+ callback1.should.have.been.calledOnce
61
+ callback2.should.have.been.calledOnce
62
+
63
+ describe "DOM is ready", ->
64
+
65
+ beforeEach ->
66
+ $.isReady = true
67
+
68
+ $(callback1 = sinon.spy())
69
+ $(callback2 = sinon.spy())
70
+
71
+ it 'should call trigger right after add to waiting list', ->
72
+ callback1.should.have.been.calledOnce
73
+ callback2.should.have.been.calledOnce
@@ -1,5 +1,5 @@
1
1
  ###
2
- jquery.turbolinks.js ~ v0.2.1 ~ https://github.com/kossnocorp/jquery.turbolinks
2
+ jquery.turbolinks.js ~ v1.0.0-rc ~ https://github.com/kossnocorp/jquery.turbolinks
3
3
 
4
4
  jQuery plugin for drop-in fix binded events problem caused by Turbolinks
5
5
 
@@ -23,6 +23,7 @@ $(ready)
23
23
  # Store callbacks in list on `$` and `$.ready`
24
24
  $.fn.ready = (callback) ->
25
25
  callbacks.push(callback)
26
+ callback($) if $.isReady
26
27
 
27
28
  # Bind ready to passed event
28
29
  $.setReadyEvent = (event) ->
@@ -1,7 +1,7 @@
1
1
  // Generated by CoffeeScript 1.3.3
2
2
 
3
3
  /*
4
- jquery.turbolinks.js ~ v0.2.1 ~ https://github.com/kossnocorp/jquery.turbolinks
4
+ jquery.turbolinks.js ~ v1.0.0-rc ~ https://github.com/kossnocorp/jquery.turbolinks
5
5
 
6
6
  jQuery plugin for drop-in fix binded events problem caused by Turbolinks
7
7
 
@@ -31,7 +31,10 @@
31
31
  $(ready);
32
32
 
33
33
  $.fn.ready = function(callback) {
34
- return callbacks.push(callback);
34
+ callbacks.push(callback);
35
+ if ($.isReady) {
36
+ return callback($);
37
+ }
35
38
  };
36
39
 
37
40
  $.setReadyEvent = function(event) {
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jquery-turbolinks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
5
- prerelease:
4
+ version: 1.0.0.rc
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Sasha Koss
@@ -27,6 +27,22 @@ dependencies:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: 3.1.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: turbolinks
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
30
46
  description: jQuery plugin for drop-in fix binded events problem caused by Turbolinks
31
47
  email: koss@nocorp.me
32
48
  executables: []
@@ -35,7 +51,6 @@ extra_rdoc_files: []
35
51
  files:
36
52
  - .gitignore
37
53
  - Gemfile
38
- - Gemfile.lock
39
54
  - Guardfile
40
55
  - LICENSE.md
41
56
  - README.md
@@ -64,9 +79,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
64
79
  required_rubygems_version: !ruby/object:Gem::Requirement
65
80
  none: false
66
81
  requirements:
67
- - - ! '>='
82
+ - - ! '>'
68
83
  - !ruby/object:Gem::Version
69
- version: '0'
84
+ version: 1.3.1
70
85
  requirements: []
71
86
  rubyforge_project: jquery-turbolinks
72
87
  rubygems_version: 1.8.23
data/Gemfile.lock DELETED
@@ -1,34 +0,0 @@
1
- GEM
2
- remote: https://rubygems.org/
3
- specs:
4
- ffi (1.1.0)
5
- guard (1.2.3)
6
- listen (>= 0.4.2)
7
- thor (>= 0.14.6)
8
- guard-rake (0.0.7)
9
- guard
10
- rake
11
- listen (0.4.7)
12
- rb-fchange (~> 0.0.5)
13
- rb-fsevent (~> 0.9.1)
14
- rb-inotify (~> 0.8.8)
15
- notifier (0.2.1)
16
- rake (0.9.2.2)
17
- rb-fchange (0.0.5)
18
- ffi
19
- rb-fsevent (0.9.1)
20
- rb-inotify (0.8.8)
21
- ffi (>= 0.5.0)
22
- talks (0.4.0)
23
- notifier
24
- terminal-notifier (1.3.0)
25
- thor (0.15.4)
26
-
27
- PLATFORMS
28
- ruby
29
-
30
- DEPENDENCIES
31
- guard
32
- guard-rake
33
- talks (= 0.4.0)
34
- terminal-notifier