Skip to content
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
31 changes: 31 additions & 0 deletions todo-src/animations.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* Sitch container for priority */
.animate-switch-container {
position:relative;
background:white;
border:1px solid black;
height:40px;
overflow:hidden;
}

.animate-switch {
padding:10px;
}

.animate-switch.ng-animate {
transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;

position:absolute;
top:0;
left:0;
right:0;
bottom:0;
}

.animate-switch.ng-leave.ng-leave-active,
.animate-switch.ng-enter {
top:-50px;
}
.animate-switch.ng-leave,
.animate-switch.ng-enter.ng-enter-active {
top:0;
}
15 changes: 13 additions & 2 deletions todo-src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="https://code.angularjs.org/1.4.3/angular.js"></script>
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="animations.css" />
<script src="script.js"></script>
<script src="protractor.js"></script>
</head>

<body ng-app="app">
<h1 class="text-center">My little to do app!</h1>
<h1 class="text-center">To Do</h1>

<div id="todo" class="col-xs-6 col-xs-offset-3" ng-controller="MainCtrl">

Expand All @@ -34,7 +36,16 @@ <h2>stuff i gotta do asap</h2>
<button class="btn btn-danger pull-right" type="button" ng-click="deleteItem(do)">
<span class="glyphicon glyphicon-trash " aria-hidden="true"></span>
</button>

<hr/>
<div ng-controller="ExampleController">
<select ng-model="selection" ng-options="item for item in items">
</select>
<div class="animate-switch-container pull-right" ng-switch on="selection">
<div class="animate-switch" ng-switch-when="now">top</div>
<div class="animate-switch" ng-switch-when="tomorrow">medium</div>
<div class="animate-switch" ng-switch-default>low</div>
</div>
</div>
</li>
</ul>
</div>
Expand Down
18 changes: 18 additions & 0 deletions todo-src/protractor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
var switchElem = element(by.css('[ng-switch]'));
var select = element(by.model('selection'));

it('should start in low', function () {
expect(switchElem.getText()).toMatch(/someday/);
});
it('should change to medium', function () {
select.all(by.css('option')).get(1).click();
expect(switchElem.getText()).toMatch(/tomorrow/);
});
it('should change to top', function () {
select.all(by.css('option')).get(2).click();
expect(switchElem.getText()).toMatch(/now/);
});
it('should select default', function () {
select.all(by.css('option')).get(3).click();
expect(switchElem.getText()).toMatch(/default/);
});
11 changes: 9 additions & 2 deletions todo-src/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,17 @@ myApp.controller('MainCtrl', function ($scope){
var index = $scope.todos.indexOf(item);
$scope.todos.splice(index, 1);
}



});

myApp.controller('switchExample', ['ngAnimate'])
.controller('ExampleController', ['$scope', function ($scope) {
$scope.items = ['now', 'tomorrow', 'someday'];
$scope.selection = $scope.items[0];
}]);



/*************************
* Homework (not rly):
* - "enter" button functionality instead of clicking button
Expand Down
1 change: 1 addition & 0 deletions todo-src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
body {
background: green;
}