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

todo_challenge solution #163

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/bower_components
/node_modules
/**/.DS_Store
26 changes: 26 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "todo_challenge",
"homepage": "https://github.com/Jeremy-Barrass/todo_challenge",
"description": "",
"main": "",
"moduleType": [],
"license": "MIT",
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"devDependencies": {
"angular-mocks": "^1.5.0",
"angular-route": "^1.5.0"
},
"dependencies": {
"jquery": "^2.2.1",
"bootstrap": "^3.3.6",
"angular": "^1.5.0",
"angular-resource": "^1.5.0"
}
}
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.

3 changes: 3 additions & 0 deletions js/toDoListController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
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.


}]);
32 changes: 32 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "todo_challenge",
"version": "1.0.0",
"description": "\"Makers Academy weekend challenge\"",
"main": "index.js",
"directories": {
"doc": "docs"
},
"scripts": {
"test": "test"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Jeremy-Barrass/todo_challenge.git"
},
"author": "Jeremy Barrass",
"license": "ISC",
"bugs": {
"url": "https://github.com/Jeremy-Barrass/todo_challenge/issues"
},
"homepage": "https://github.com/Jeremy-Barrass/todo_challenge#readme",
"devDependencies": {
"karma": "^0.13.22",
"karma-chrome-launcher": "^0.2.2",
"karma-jasmine": "^0.3.7",
"karma-phantomjs-launcher": "^1.0.0"
},
"dependencies": {
"jasmine": "^2.4.1",
"phantomjs-prebuilt": "^2.1.5"
}
}
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
});
};
14 changes: 14 additions & 0 deletions test/toDoListController.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
describe('ToDoListController', function(){
beforeEach(module('ToDoList'));

var ctrl;

beforeEach(inject(function($controller){
ctrl = $controller('ToDoListController');
}));

it('initialises with an empty task entry and an empty task list', function(){
expect(ctrl.newTask).toBeUndefined();
expect(ctrl.taskList).toBeUndefined();
});
});
28 changes: 28 additions & 0 deletions views/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!doctype html>
<html lang="en" ng-app="ToDoList">
<head>
<meta charset="utf-8">
<title>Todo List</title>
<link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap.css">
<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 listCtrl">
<section class="todo-list">
<form class="task-entry">
<input type="text">
<button class="add">Add</button>
</form>
<ul class="task-list">
<li class="task-item">Sort out weekend challenge</li>
<li class="task-item">Have tea at Michael's</li>
<li class="task-item">Make dinner</li>
<li class="task-item">Hang laundry</li>
</ul>
</section>
</body>
</html>