Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds whole project transfered from old repo #162

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bower_components
node_modules
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
25 changes: 25 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
47 changes: 47 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!doctype html>
<html lang="en" ng-app="toDoList">
<head>
<meta charset="utf-8">
<title>To Do List</title>
<link href="bower_components/bootstrap/dist/css/bootstrap.css" rel="stylesheet">
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-resource/angular-resource.js"></script>
<script src="js/app.js"></script>
<script src="js/toDoListController.js"></script>
</head>

<body ng-controller="toDoListController as toDoListCtrl">
<h1>What Needs To Be Done?</h1>
<section>

<form>
<label for="newToDo">New ToDo:</label>
<input class="form-control" id="newToDo" ng-model="toDoListCtrl.addTask" type="text">
<input class="btn btn-primary submit" id="newTask" ng-click="toDoListCtrl.newTask()" type="submit" value="submit">
</form>
</section>
<ul class="list-group">
<li ng-repeat="task in toDoListCtrl.tasks">

<p>
<span><input type="checkbox" value=""></span>{{task}}
<span class="pull-right">
<button class="btn btn-xs btn-info" ng-click="this.value='Complete'">Active</button>
<button class="btn btn-xs btn-info">Edit</button>
<button class="btn btn-xs btn-warning" ng-click="toDoListCtrl.remove(item)">
<span class="glyphicon glyphicon-trash"></span>
</button>
</span>
</p>
</li>
</ul>
<div></div>
<div class="btn-group">
<button class="btn btn-primary" type="button">All</button>
<button class="btn btn-primary" type="button">Active</button>
<button class="btn btn-primary" type="button">Complete</button>
<button class="btn btn-primary" type="button">Clear All</button>
</div>
</body>
</html>
1 change: 1 addition & 0 deletions js/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var toDoList = angular.module('toDoList', ['ngResource']);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'angular' is not defined.

19 changes: 19 additions & 0 deletions js/toDoListController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
toDoList.controller('toDoListController', [function() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'toDoList' is not defined.


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);
}


}]);
25 changes: 25 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
5 changes: 5 additions & 0 deletions test/e2e/conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
baseUrl: 'http://localhost:8081',
specs: ['toDoListFeature.js']
}
26 changes: 26 additions & 0 deletions test/e2e/toDoListFeature.js
Original file line number Diff line number Diff line change
@@ -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');
});
});
68 changes: 68 additions & 0 deletions test/karma.conf.js
Original file line number Diff line number Diff line change
@@ -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
});
};
33 changes: 33 additions & 0 deletions test/toDoListController.spec.js
Original file line number Diff line number Diff line change
@@ -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);
});
});


});