diff --git a/app/backdrop-service.js b/app/backdrop-service.js index 9fec095..0d366ef 100644 --- a/app/backdrop-service.js +++ b/app/backdrop-service.js @@ -21,7 +21,7 @@ if(!style.sheet && !style.sheet.insertRule) { (style.styleSheet || style.sheet).addRule(name, rules); } else { - style.sheet.insertRule(name + "{" + rules + "}", 0); + style.sheet.insertRule(name + '{' + rules + '}', 0); } }()); diff --git a/app/tour-helpers.js b/app/tour-helpers.js index bba5633..b61049c 100644 --- a/app/tour-helpers.js +++ b/app/tour-helpers.js @@ -61,7 +61,7 @@ safeApply(scope, function () { resolve(scope.$eval(attrs[attrName])); }); - }) + }); }; } }); diff --git a/app/tour-step-directive.js b/app/tour-step-directive.js index 16824b4..cf6a96c 100644 --- a/app/tour-step-directive.js +++ b/app/tour-step-directive.js @@ -91,7 +91,7 @@ ctrl.removeStep(step); orderWatch(); }); - } + }; } }; diff --git a/gruntfile.js b/gruntfile.js index 662eb41..9d8e211 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -18,11 +18,20 @@ module.exports = function (grunt) { options: { jshintrc: '.jshintrc' }, - all: [ - 'Gruntfile.js', - '<%= config.app %>/**/*.js', - 'test/spec/**/*.js' - ] + all: { + options: { + ignores: [ + '<%= config.app %>/tour-templates.js' + ] + }, + files: { + src: [ + 'Gruntfile.js', + '<%= config.app %>/**/*.js', + 'test/spec/**/*.js' + ] + } + } }, karma: { @@ -150,7 +159,7 @@ module.exports = function (grunt) { grunt.registerTask('default', [ 'jshint', - 'test', - 'build' + 'build', + 'test' ]); }; diff --git a/lib/linked-list.js b/lib/linked-list.js deleted file mode 100644 index 7d0526b..0000000 --- a/lib/linked-list.js +++ /dev/null @@ -1,208 +0,0 @@ -(function (app) { - 'use strict'; - - app.factory('LinkedList', [function () { - - var LinkedList = {}; - - LinkedList.create = function (isDouble) { - var head = null, - tail = null, - length = 0; - - function createNode(data) { - var node = { - data: data, - next: null - }; - - if (isDouble) { - node.prev = null; - } - - return node; - } - - return { - getHead: function () { - return head; - }, - getTail: function () { - return tail; - }, - size: function () { - return length; - }, - push: function (data) { - var newNode = createNode(data); - if (tail) { - tail.next = newNode; - if (isDouble) { - newNode.prev = tail; - } - tail = newNode; - } else { - head = tail = newNode; - } - length += 1; - return true; - }, - pop: function () { - if (!head) return; - - //only 1 item - if (!head.next) { - head = null; - - length -= 1; - return true; - } - - var current = head; - - do { - if (current.next.next) { - current = current.next; - } else { - current.next = null; - tail = current; - - length -= 1; - return true; - } - } while (current.next); - }, - unshift: function (data) { - var newNode = createNode(data); - if (head) { - newNode.next = head; - if (isDouble) { - head.prev = newNode; - } - head = newNode; - } else { - head = tail = newNode; - } - length += 1; - return true; - }, - shift: function () { - if (!head) return; - - if (!head.next) { - head = tail = null; - } else { - if (isDouble) { - head.next.prev = null; - } - head = head.next; - } - - length -= 1; - return true; - }, - insertAt: function (index, data) { - if (index === 0 || length === 0) { - return this.unshift(data); - } - if (index >= length) { - return this.push(data); - } - - var nodeBefore = head, - newNode = createNode(data); - for (var i = 1; i < index; ++i) { - nodeBefore = nodeBefore.next; - } - if (isDouble) { - if (nodeBefore.next) { - nodeBefore.next.prev = newNode; - } - newNode.prev = nodeBefore; - } - newNode.next = nodeBefore.next; - nodeBefore.next = newNode; - - length += 1; - return true; - }, - forEach: function (iterator) { - var index = 0, - current = head, - stopped = false; - - while (current && !stopped) { - iterator(current, index, function () { stopped = true; }); - index += 1; - current = current.next; - } - }, - remove: function (data) { - if (!head) return false; - var current = head; - - //if first element - if (head.data === data) { - return this.shift(); - } - - while (current.next) { - if (current.next.data === data) { - //if last item - if (current.next === tail) { - return this.pop(); - } - - if (isDouble) { - current.next.next.prev = current; - } - current.next = current.next.next; - - length -= 1; - return true; - } - current = current.next; - } - - return false; - }, - get: function (data) { - var current = head; - - while (current) { - if (current.data === data) { - return current; - } - current = current.next; - } - - return null; - }, - contains: function (data) { - var match = false; - this.forEach(function (node) { - if (node.data === data) { - match = true; - } - }); - return match; - }, - toArray: function () { - var arr = [], - current = head; - - while (current) { - arr.push(current.data); - current = current.next; - } - - return arr; - } - } - }; - - return LinkedList; - - }]); - -}(angular.module('bm.uiTour'))); diff --git a/test/spec/config.spec.js b/test/spec/config.spec.js index 34bda52..3f72620 100644 --- a/test/spec/config.spec.js +++ b/test/spec/config.spec.js @@ -1,3 +1,5 @@ +/* global jasmine: false, inject: false, angular: false*/ + 'use strict'; describe('Tour Config', function () { diff --git a/test/spec/linked-list.spec.js b/test/spec/linked-list.spec.js deleted file mode 100644 index 241ec79..0000000 --- a/test/spec/linked-list.spec.js +++ /dev/null @@ -1,158 +0,0 @@ -'use strict'; - -describe('Linked List', function () { - var LinkedList, - startingList, - doubleList; - - beforeEach(module('bm.uiTour', 'test.templates')); - beforeEach(inject(function (_LinkedList_) { - LinkedList = _LinkedList_; - - startingList = LinkedList.create(); - startingList.push('Hello'); - startingList.push('World'); - - doubleList = LinkedList.create(true); - doubleList.push('Hello'); - doubleList.push('World'); - })); - - it('should return an array', function () { - //given - var arr = startingList.toArray(); - var dub = doubleList.toArray(); - - //then - expect(arr).toEqual(['Hello', 'World']); - expect(dub).toEqual(['Hello', 'World']); - }); - - it('should push to the end of the list', function () { - //when - startingList.push('Foo'); - doubleList.push('Foo'); - var arr = startingList.toArray(); - var dub = doubleList.toArray(); - - //then - expect(arr).toEqual(['Hello', 'World', 'Foo']); - expect(dub).toEqual(['Hello', 'World', 'Foo']); - }); - - it('should push to the beginning of the list', function () { - //when - startingList.unshift('Foo'); - doubleList.unshift('Foo'); - var arr = startingList.toArray(); - var dub = doubleList.toArray(); - - //then - expect(arr).toEqual(['Foo', 'Hello', 'World']); - expect(dub).toEqual(['Foo', 'Hello', 'World']); - }); - - it('should pop from the end of the list', function () { - //when - startingList.pop(); - doubleList.pop(); - var arr = startingList.toArray(); - var dub = doubleList.toArray(); - - //then - expect(arr).toEqual(['Hello']); - expect(dub).toEqual(['Hello']); - }); - - it('should pop from the beginning of the list', function () { - //when - startingList.shift(); - doubleList.shift(); - var arr = startingList.toArray(); - var dub = doubleList.toArray(); - - //then - expect(arr).toEqual(['World']); - expect(dub).toEqual(['World']); - }); - - it('should insert into middle of list', function () { - //when - startingList.insertAt(1, 'Foo'); - doubleList.insertAt(1, 'Foo'); - var arr = startingList.toArray(); - var dub = doubleList.toArray(); - - //then - expect(arr).toEqual(['Hello', 'Foo', 'World']); - expect(dub).toEqual(['Hello', 'Foo', 'World']); - }); - - it('should remove from beginning of list', function () { - //when - startingList.remove('Hello'); - doubleList.remove('Hello'); - var arr = startingList.toArray(); - var dub = doubleList.toArray(); - - //then - expect(arr).toEqual(['World']); - expect(dub).toEqual(['World']); - }); - - it('should remove from end of list', function () { - //when - startingList.remove('World'); - doubleList.remove('World'); - var arr = startingList.toArray(); - var dub = doubleList.toArray(); - - //then - expect(arr).toEqual(['Hello']); - expect(dub).toEqual(['Hello']); - }); - - it('should remove from middle of list', function () { - //when - startingList.insertAt(1, 'Foo'); - doubleList.insertAt(1, 'Foo'); - var arr = startingList.toArray(); - var dub = doubleList.toArray(); - - //then - expect(arr).toEqual(['Hello', 'Foo', 'World']); - expect(dub).toEqual(['Hello', 'Foo', 'World']); - - //when - startingList.remove('Foo'); - doubleList.remove('Foo'); - var arr2 = startingList.toArray(); - var dub2 = doubleList.toArray(); - - //then - expect(arr2).toEqual(['Hello', 'World']); - expect(dub2).toEqual(['Hello', 'World']); - }); - - it('should remove the only element', function () { - //when - startingList.pop(); - startingList.remove('Hello'); - doubleList.shift(); - doubleList.remove('World'); - var arr = startingList.toArray(); - var dub = doubleList.toArray(); - - //then - expect(arr).toEqual([]); - expect(dub).toEqual([]); - }); - - it('should find an existing element, shouldnt find non-exising element', function () { - expect(startingList.contains('Hello')).toBe(true); - expect(doubleList.contains('Hello')).toBe(true); - expect(startingList.contains('Blah')).toBe(false); - expect(doubleList.contains('Blah')).toBe(false); - }); - -}); diff --git a/test/spec/tour-events.spec.js b/test/spec/tour-events.spec.js index d356459..2721e5c 100644 --- a/test/spec/tour-events.spec.js +++ b/test/spec/tour-events.spec.js @@ -1,3 +1,5 @@ +/* global jasmine: false, inject: false, angular: false*/ + 'use strict'; describe('Tour Config', function () { diff --git a/test/spec/tour-step-events.js b/test/spec/tour-step-events.js index d5e04a7..eeb3c75 100644 --- a/test/spec/tour-step-events.js +++ b/test/spec/tour-step-events.js @@ -1,3 +1,5 @@ +/* global jasmine: false, inject: false, angular: false*/ + 'use strict'; describe('Tour Config', function () {