diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-09-09 15:57:10 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-09-09 15:57:18 +0200 |
commit | 2824b43b7332e847810f042c4183ce95ee90e852 (patch) | |
tree | 9a10f31c8acbf01d72336d3d065f8c8fda4b83c5 /js/vendor/angular-ui/templates/test/templateSpec.js | |
parent | f0abeddd07fcf21e30c95d58885416ef40d65391 (diff) |
use bower for managing deps
Diffstat (limited to 'js/vendor/angular-ui/templates/test/templateSpec.js')
-rw-r--r-- | js/vendor/angular-ui/templates/test/templateSpec.js | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/js/vendor/angular-ui/templates/test/templateSpec.js b/js/vendor/angular-ui/templates/test/templateSpec.js new file mode 100644 index 000000000..6eff729e1 --- /dev/null +++ b/js/vendor/angular-ui/templates/test/templateSpec.js @@ -0,0 +1,58 @@ +/* + * sample unit testing for sample templates and implementations + */ +describe('uiTemplate', function () { + + // declare these up here to be global to all tests + var $rootScope, $compile; + + beforeEach(module('ui.directives')); + beforeEach(module('ui.filters')); + + // inject in angular constructs. Injector knows about leading/trailing underscores and does the right thing + // otherwise, you would need to inject these into each test + beforeEach(inject(function (_$rootScope_, _$compile_) { + $rootScope = _$rootScope_; + $compile = _$compile_; + })); + + // reset the ui.config after each test + afterEach(function () { + angular.module('ui.config').value('ui.config', {}); + }); + + // optional grouping of tests + describe('filter', function () { + + // we're doing filter tests so globally define here for this subset of tests + var $filter; + beforeEach(inject(function (_$filter_) { + $filter = _$filter_; + })); + + // very simple boilerplate setup of test for a custom filter + var tmpl; + beforeEach(function () { + tmpl = $filter('filterTmpl'); + }); + + it('should exist when provided', function () { + expect(tmpl).toBeDefined(); + }); + + it('should return exactly what interesting thing the filter is doing to input', function () { + expect(tmpl('text')).toEqual('text'); + }); + + }); + + // optional grouping of tests + describe('directive', function () { + var element; + it('should create an element if using element-style', function () { + element = $compile('<ui-directive-tmpl ng-model="a"></ui-directive-tmpl>')($rootScope); + expect(element).toBeDefined(); + }); + }); + +}); |