From dee433d09b51c1460c7ec19aa444781a0dd51388 Mon Sep 17 00:00:00 2001 From: vegim qehaja Date: Mon, 1 Feb 2016 13:15:29 +0000 Subject: [PATCH 1/3] adds whole project transfered from old repo --- .gitignore | 2 + bower.json | 25 ++++++++++++ index.html | 47 +++++++++++++++++++++++ js/app.js | 1 + js/toDoListController.js | 19 +++++++++ package.json | 25 ++++++++++++ test/e2e/conf.js | 5 +++ test/e2e/toDoListFeature.js | 26 +++++++++++++ test/karma.conf.js | 68 +++++++++++++++++++++++++++++++++ test/toDoListController.spec.js | 33 ++++++++++++++++ 10 files changed, 251 insertions(+) create mode 100644 .gitignore create mode 100644 bower.json create mode 100644 index.html create mode 100644 js/app.js create mode 100644 js/toDoListController.js create mode 100644 package.json create mode 100644 test/e2e/conf.js create mode 100644 test/e2e/toDoListFeature.js create mode 100644 test/karma.conf.js create mode 100644 test/toDoListController.spec.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..7bf6eb18 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +bower_components +node_modules diff --git a/bower.json b/bower.json new file mode 100644 index 00000000..8a0636e6 --- /dev/null +++ b/bower.json @@ -0,0 +1,25 @@ +{ + "name": "todo_list_week8_challenge_ma", + "description": "", + "main": "", + "moduleType": [], + "license": "MIT", + "homepage": "", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ], + "dependencies": { + "jquery": "^2.2.0", + "bootstrap": "^3.3.6", + "angular": "^1.4.9", + "angular-resource": "^1.4.9" + }, + "devDependencies": { + "angular-mocks": "^1.4.9", + "angular-route": "^1.4.9" + } +} diff --git a/index.html b/index.html new file mode 100644 index 00000000..cf1d1d21 --- /dev/null +++ b/index.html @@ -0,0 +1,47 @@ + + + + + To Do List + + + + + + + + + +

What Needs To Be Done?

+
+ +
+ + + +
+
+ +
+
+ + + + +
+ + diff --git a/js/app.js b/js/app.js new file mode 100644 index 00000000..f929f8f2 --- /dev/null +++ b/js/app.js @@ -0,0 +1 @@ +var toDoList = angular.module('toDoList', ['ngResource']); diff --git a/js/toDoListController.js b/js/toDoListController.js new file mode 100644 index 00000000..dbabc4a4 --- /dev/null +++ b/js/toDoListController.js @@ -0,0 +1,19 @@ +toDoList.controller('toDoListController', [function() { + + var self = this; + + self.tasks = [ + + ] + + self.newTask = function() { + self.tasks.push(self.addTask); + }; + + self.remove = function(item) { + var index = self.tasks.indexOf(item); + self.tasks.splice(index, 1); + } + + +}]); diff --git a/package.json b/package.json new file mode 100644 index 00000000..1965667d --- /dev/null +++ b/package.json @@ -0,0 +1,25 @@ +{ + "name": "todo_challenge", + "version": "1.0.0", + "description": "* Deadline: submit completed pull request by 9am on Monday * You may use whatever level of JavaScript you feel comfortable with - pure JS, jQuery, Angular, or whatever weird and wonderful framework you want to try. Extra points for DogeScript", + "main": "index.js", + "directories": { + "doc": "docs" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/gimi-q/todo_challenge.git" + }, + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/gimi-q/todo_challenge/issues" + }, + "homepage": "https://github.com/gimi-q/todo_challenge#readme", + "devDependencies": { + "protractor": "^3.0.0" + } +} diff --git a/test/e2e/conf.js b/test/e2e/conf.js new file mode 100644 index 00000000..ccb656ba --- /dev/null +++ b/test/e2e/conf.js @@ -0,0 +1,5 @@ +exports.config = { + seleniumAddress: 'http://localhost:4444/wd/hub', + baseUrl: 'http://localhost:8081', + specs: ['toDoListFeature.js'] +} diff --git a/test/e2e/toDoListFeature.js b/test/e2e/toDoListFeature.js new file mode 100644 index 00000000..817634dd --- /dev/null +++ b/test/e2e/toDoListFeature.js @@ -0,0 +1,26 @@ +describe('To Do List', function() { + it('has a title', function() { + browser.get('http://localhost:8081'); + + expect(browser.getTitle()).toEqual('To Do List'); + }); + + it('add tasks', function() { + + element(by.model('toDoListCtrl.addTask')).sendKeys('Walk Cat'); + element(by.id('newTask')).click(); + + expect(element(by.binding('task')).getText()). + toContain('Walk Cat'); + }); + + xit('can delete tasks', function() { + + element(by.model('toDoListCtrl.addTask')).sendKeys('Walk Cat'); + element(by.id('newTask')).click(); + element(by.id('deleteTask')).click(); + + expect(element(by.binding('task')).getText()). + toContain('Walk Cat'); + }); +}); diff --git a/test/karma.conf.js b/test/karma.conf.js new file mode 100644 index 00000000..e0998aef --- /dev/null +++ b/test/karma.conf.js @@ -0,0 +1,68 @@ +// Karma configuration +// Generated on Thu Nov 27 2014 10:43:21 GMT+0000 (GMT) + +module.exports = function(config) { + config.set({ + + // base path that will be used to resolve all patterns (eg. files, exclude) + basePath: '../', + + + // frameworks to use + // available frameworks: https://npmjs.org/browse/keyword/karma-adapter + frameworks: ['jasmine'], + + + // list of files / patterns to load in the browser + files: [ + 'bower_components/angular/angular.js', + 'bower_components/angular-route/angular-route.js', + 'bower_components/angular-resource/angular-resource.js', + 'bower_components/angular-mocks/angular-mocks.js', + 'js/**/*.js', + 'test/**/*.spec.js' + ], + + + // list of files to exclude + exclude: [], + + + // preprocess matching files before serving them to the browser + // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor + preprocessors: {}, + + + // test results reporter to use + // possible values: 'dots', 'progress' + // available reporters: https://npmjs.org/browse/keyword/karma-reporter + reporters: ['progress'], + + + // web server port + port: 9876, + + + // enable / disable colors in the output (reporters and logs) + colors: true, + + + // level of logging + // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG + logLevel: config.LOG_INFO, + + + // enable / disable watching file and executing tests whenever any file changes + autoWatch: true, + + + // start these browsers + // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher + browsers: ['PhantomJS'], + + + // Continuous Integration mode + // if true, Karma captures browsers, runs the tests and exits + singleRun: false + }); +}; diff --git a/test/toDoListController.spec.js b/test/toDoListController.spec.js new file mode 100644 index 00000000..ceb6a219 --- /dev/null +++ b/test/toDoListController.spec.js @@ -0,0 +1,33 @@ +describe('toDoListController', function() { + beforeEach(module('toDoList')); + + var ctrl; + + beforeEach(inject(function($controller) { + ctrl = $controller('toDoListController'); + })); + + it('initialises with an empty to do input field', function() { + expect(ctrl.toDoListInput).toBeUndefined(); + + }); + + describe('when adding a to do task', function() { + + var tasks = + { + "task": "Walk Dog" + + } + + + + it('displays the new to do task', function() { + ctrl.addTask = 'Walk Dog' + ctrl.newTask(); + expect(ctrl.tasks).toEqual(tasks); + }); +}); + + +}); From 89bc6be8ef276ad4a9dab9b460b6a26a189d593d Mon Sep 17 00:00:00 2001 From: Vegim Qehaja Date: Mon, 7 Mar 2016 09:39:14 +0000 Subject: [PATCH 2/3] Update README.md --- README.md | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/README.md b/README.md index 29dc834e..d2ec7255 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,62 @@ + +Todo Challenge Build Status +A Todo list as a mini Angular.js front-end application (builded with a TDD approach). + +User Stories + +As a forgetful person +I want to store my tasks +So that I don't forget them + +As a person with limited time +I want to instantly be able to update my todo list (adding and changing entries) +So that I have more time to think about other things + +As a person who actually gets stuff done +I want to mark my tasks as done +So that I don't do them twice + +As a person with a lot of tasks +I want to be able to filter my tasks by "All", "Active", "Complete" +So that I only see the relevant tasks + +As a person who doesn't like counting by hand +I want to see a total number of tasks +So that I don't have to count + +As someone who has done lots of stuff +I want to be able to clear my completed tasks +So I never see them again +Installation + + + +Testing + +To run tests: + +$ npm test +To run e2e tests: + +$ grunt e2e +To run unit tests: + +$ grunt karma + +Technologies + +Node.js +Angular.js +Express +Karma +Protractor +Jasmine +Grunt + + + + + # Todo Challenge * Deadline: submit completed pull request by 9am on Monday From 3f1353a62b6e365b702e09787e9e53bbe60de983 Mon Sep 17 00:00:00 2001 From: Vegim Qehaja Date: Mon, 7 Mar 2016 09:39:53 +0000 Subject: [PATCH 3/3] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d2ec7255..b335f793 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Todo Challenge Build Status A Todo list as a mini Angular.js front-end application (builded with a TDD approach). -User Stories +##User Stories As a forgetful person I want to store my tasks @@ -31,7 +31,7 @@ Installation -Testing +##Testing To run tests: @@ -43,7 +43,7 @@ To run unit tests: $ grunt karma -Technologies +##Technologies Node.js Angular.js