bespoke-bullets
Advanced tools
Comparing version 1.0.0 to 1.1.0
{ | ||
"name": "bespoke-bullets", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"main": "./dist/bespoke-bullets.js", | ||
@@ -5,0 +5,0 @@ "ignore": [ |
/*! | ||
* bespoke-bullets v1.0.0 | ||
* bespoke-bullets v1.1.0 | ||
* | ||
@@ -56,2 +56,8 @@ * Copyright 2014, Mark Dalgleish | ||
} | ||
if (s === slideIndex && b === bulletIndex) { | ||
bullet.classList.add('bespoke-bullet-current'); | ||
} else { | ||
bullet.classList.remove('bespoke-bullet-current'); | ||
} | ||
}); | ||
@@ -58,0 +64,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
/*! bespoke-bullets v1.0.0 © 2014 Mark Dalgleish, MIT License */ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;"undefined"!=typeof window?n=window:"undefined"!=typeof global?n=global:"undefined"!=typeof self&&(n=self);var t=n;t=t.bespoke||(t.bespoke={}),t=t.plugins||(t.plugins={}),t.bullets=e()}}(function(){return function e(n,t,o){function i(u,f){if(!t[u]){if(!n[u]){var l="function"==typeof require&&require;if(!f&&l)return l(u,!0);if(r)return r(u,!0);throw new Error("Cannot find module '"+u+"'")}var s=t[u]={exports:{}};n[u][0].call(s.exports,function(e){var t=n[u][1][e];return i(t?t:e)},s,s.exports,e,n,t,o)}return t[u].exports}for(var r="function"==typeof require&&require,u=0;u<o.length;u++)i(o[u]);return i}({1:[function(e,n){n.exports=function(e){return function(n){var t,o,i=n.slides.map(function(n){return[].slice.call(n.querySelectorAll("string"==typeof e?e:"[data-bespoke-bullet]"),0)}),r=function(){var e=t+1;return l(1)?(f(t,o+1),!1):void(i[e]&&f(e,0))},u=function(){var e=t-1;return l(-1)?(f(t,o-1),!1):void(i[e]&&f(e,i[e].length-1))},f=function(e,n){t=e,o=n,i.forEach(function(t,o){t.forEach(function(t,i){t.classList.add("bespoke-bullet"),e>o||o===e&&n>=i?(t.classList.add("bespoke-bullet-active"),t.classList.remove("bespoke-bullet-inactive")):(t.classList.add("bespoke-bullet-inactive"),t.classList.remove("bespoke-bullet-active"))})})},l=function(e){return void 0!==i[t][o+e]};n.on("next",r),n.on("prev",u),n.on("slide",function(e){f(e.index,0)}),f(0,0)}}},{}]},{},[1])(1)}); | ||
/*! bespoke-bullets v1.1.0 © 2014 Mark Dalgleish, MIT License */ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;"undefined"!=typeof window?n=window:"undefined"!=typeof global?n=global:"undefined"!=typeof self&&(n=self);var t=n;t=t.bespoke||(t.bespoke={}),t=t.plugins||(t.plugins={}),t.bullets=e()}}(function(){return function e(n,t,o){function r(u,l){if(!t[u]){if(!n[u]){var s="function"==typeof require&&require;if(!l&&s)return s(u,!0);if(i)return i(u,!0);throw new Error("Cannot find module '"+u+"'")}var f=t[u]={exports:{}};n[u][0].call(f.exports,function(e){var t=n[u][1][e];return r(t?t:e)},f,f.exports,e,n,t,o)}return t[u].exports}for(var i="function"==typeof require&&require,u=0;u<o.length;u++)r(o[u]);return r}({1:[function(e,n){n.exports=function(e){return function(n){var t,o,r=n.slides.map(function(n){return[].slice.call(n.querySelectorAll("string"==typeof e?e:"[data-bespoke-bullet]"),0)}),i=function(){var e=t+1;return s(1)?(l(t,o+1),!1):void(r[e]&&l(e,0))},u=function(){var e=t-1;return s(-1)?(l(t,o-1),!1):void(r[e]&&l(e,r[e].length-1))},l=function(e,n){t=e,o=n,r.forEach(function(t,o){t.forEach(function(t,r){t.classList.add("bespoke-bullet"),e>o||o===e&&n>=r?(t.classList.add("bespoke-bullet-active"),t.classList.remove("bespoke-bullet-inactive")):(t.classList.add("bespoke-bullet-inactive"),t.classList.remove("bespoke-bullet-active")),o===e&&r===n?t.classList.add("bespoke-bullet-current"):t.classList.remove("bespoke-bullet-current")})})},s=function(e){return void 0!==r[t][o+e]};n.on("next",i),n.on("prev",u),n.on("slide",function(e){l(e.index,0)}),l(0,0)}}},{}]},{},[1])(1)}); |
@@ -47,2 +47,8 @@ module.exports = function(options) { | ||
} | ||
if (s === slideIndex && b === bulletIndex) { | ||
bullet.classList.add('bespoke-bullet-current'); | ||
} else { | ||
bullet.classList.remove('bespoke-bullet-current'); | ||
} | ||
}); | ||
@@ -49,0 +55,0 @@ }); |
{ | ||
"name": "bespoke-bullets", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Bullet Lists for Bespoke.js", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -58,2 +58,6 @@ [![Build Status](https://secure.travis-ci.org/markdalgleish/bespoke-bullets.png?branch=master)](https://travis-ci.org/markdalgleish/bespoke-bullets) [![Coverage Status](https://coveralls.io/repos/markdalgleish/bespoke-bullets/badge.png)](https://coveralls.io/r/markdalgleish/bespoke-bullets) | ||
</tr> | ||
<tr> | ||
<td><b>bespoke-bullet-current</b></td> | ||
<td>The current bullet</td> | ||
</tr> | ||
</table> | ||
@@ -60,0 +64,0 @@ |
@@ -69,4 +69,5 @@ Function.prototype.bind = Function.prototype.bind || require('function-bind'); | ||
it("should add a 'bespoke-bullet-active' class to the first bullet", function() { | ||
it("should add 'bespoke-bullet-active' and 'bespoke-bullet-current' classes to the first bullet", function() { | ||
expect(getBullet(deck, 0, 0).classList.contains('bespoke-bullet-active')).toBe(true); | ||
expect(getBullet(deck, 0, 0).classList.contains('bespoke-bullet-current')).toBe(true); | ||
expect(getBullet(deck, 0, 0).classList.contains('bespoke-bullet-inactive')).toBe(false); | ||
@@ -99,2 +100,7 @@ }); | ||
it("should move the 'bespoke-bullet-current' class to the second bullet", function() { | ||
expect(getBullet(deck, 0, 0).classList.contains('bespoke-bullet-current')).toBe(false); | ||
expect(getBullet(deck, 0, 1).classList.contains('bespoke-bullet-current')).toBe(true); | ||
}); | ||
}); | ||
@@ -129,5 +135,12 @@ | ||
expect(getBullet(deck, 1, 0).classList.contains('bespoke-bullet-active')).toBe(true); | ||
expect(getBullet(deck, 1, 0).classList.contains('bespoke-bullet-current')).toBe(true); | ||
expect(getBullet(deck, 1, 0).classList.contains('bespoke-bullet-inactive')).toBe(false); | ||
}); | ||
it("not have a current bullet on the previous slide", function() { | ||
expect(getBullet(deck, 0, 0).classList.contains('bespoke-bullet-current')).toBe(false); | ||
expect(getBullet(deck, 0, 1).classList.contains('bespoke-bullet-current')).toBe(false); | ||
expect(getBullet(deck, 0, 2).classList.contains('bespoke-bullet-current')).toBe(false); | ||
}); | ||
}); | ||
@@ -149,2 +162,3 @@ | ||
expect(getBullet(deck, 0, 0).classList.contains('bespoke-bullet-active')).toBe(true); | ||
expect(getBullet(deck, 0, 0).classList.contains('bespoke-bullet-current')).toBe(true); | ||
}); | ||
@@ -171,4 +185,10 @@ | ||
expect(getBullet(deck, 0, 1).classList.contains('bespoke-bullet-active')).toBe(true); | ||
expect(getBullet(deck, 0, 1).classList.contains('bespoke-bullet-current')).toBe(true); | ||
}); | ||
it("should deactivate the previously selected bullet", function() { | ||
expect(getBullet(deck, 0, 2).classList.contains('bespoke-bullet-active')).toBe(false); | ||
expect(getBullet(deck, 0, 2).classList.contains('bespoke-bullet-current')).toBe(false); | ||
}); | ||
}); | ||
@@ -198,4 +218,10 @@ | ||
expect(getBullet(deck, 0, 2).classList.contains('bespoke-bullet-active')).toBe(true); | ||
expect(getBullet(deck, 0, 2).classList.contains('bespoke-bullet-current')).toBe(true); | ||
}); | ||
it("should deactivate the bullets of the 2nd slide", function() { | ||
expect(getBullet(deck, 1, 0).classList.contains('bespoke-bullet-inactive')).toBe(true); | ||
expect(getBullet(deck, 1, 0).classList.contains('bespoke-bullet-current')).toBe(false); | ||
}); | ||
}); | ||
@@ -202,0 +228,0 @@ |
Sorry, the diff of this file is not supported yet
27649
455
108