diff options
Diffstat (limited to 'framework/src/onos/web/gui/src/test/webapp/_sdh/ng-examples/js/ch03-controllerSpec.js')
-rw-r--r-- | framework/src/onos/web/gui/src/test/webapp/_sdh/ng-examples/js/ch03-controllerSpec.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/framework/src/onos/web/gui/src/test/webapp/_sdh/ng-examples/js/ch03-controllerSpec.js b/framework/src/onos/web/gui/src/test/webapp/_sdh/ng-examples/js/ch03-controllerSpec.js new file mode 100644 index 00000000..b2d4947b --- /dev/null +++ b/framework/src/onos/web/gui/src/test/webapp/_sdh/ng-examples/js/ch03-controllerSpec.js @@ -0,0 +1,35 @@ +// Jasmine unit tests for ch03-controller.js + +describe('Controller: ListCtrl', function () { + // instantiate a new version of my module before each test + beforeEach(module('notesApp')); + + var ctrl; + + // before each unit test, instantiate a new instance of the controller + beforeEach(inject(function ($controller) { + ctrl = $controller('ListCtrl'); + })); + + it('should have items available on load', function () { + expect(ctrl.items).toEqual([ + {id: 1, label: 'First', done: true}, + {id: 2, label: 'Second', done: false} + ]); + }); + + it('should have highlight items based on state', function () { + var item = {id: 1, label: 'First', done: true}; + + var actualClass = ctrl.getDoneClass(item); + expect(actualClass.finished).toBeTruthy(); + expect(actualClass.unfinished).toBeFalsy(); + + item.done = false; + + actualClass = ctrl.getDoneClass(item); + expect(actualClass.finished).toBeFalsy(); + expect(actualClass.unfinished).toBeTruthy(); + }); + +});
\ No newline at end of file |