Skip to content

Commit

Permalink
Fix: onUninstall should always cancel reference to track #22
Browse files Browse the repository at this point in the history
  • Loading branch information
danielalves committed Mar 10, 2015
1 parent e226f46 commit dadc90d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
7 changes: 6 additions & 1 deletion spec/javascripts/PluginBulletNavigatorSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,16 @@ describe("SilverTrack.Plugins.BulletNavigator", function() {
});

it("should remove all created bullets", function() {
plugin.onUninstall();
plugin.onUninstall(track);
var bullets = getBullets(plugin, track);
expect(bullets.length).toBe(0);
});

it("should remove track reference", function() {
plugin.onUninstall(track);
expect(plugin.track).toBe(null);
});

});

describe("bullet creation", function() {
Expand Down
5 changes: 5 additions & 0 deletions spec/javascripts/PluginNavigatorSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ describe("SilverTrack.Plugins.Navigator", function() {
expect(plugin.next.hasClass(plugin.options.disabledClass)).toBe(false);
});

it("remove track reference", function() {
plugin.onUninstall(track);
expect(plugin.track).toBe(null);
});

});

describe("when configuring the items", function() {
Expand Down
1 change: 1 addition & 0 deletions src/plugins/jquery.silver_track.bullet_navigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

onUninstall: function(track) {
this._clearBullets();
this.track = null;
},

afterStart: function() {
Expand Down
1 change: 1 addition & 0 deletions src/plugins/jquery.silver_track.navigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
this.next.off("click");
this._enable(this.prev);
this._enable(this.next);
this.track = null;
},

afterStart: function() {
Expand Down

0 comments on commit dadc90d

Please sign in to comment.