diff options
| author | Peter Bacon Darwin | 2014-02-12 22:47:42 +0000 |
|---|---|---|
| committer | Peter Bacon Darwin | 2014-02-16 19:03:41 +0000 |
| commit | 389d4879da4aa620ee95d789b19ff9be44eb730a (patch) | |
| tree | 93352ddc8738a975904a1774d51b93d585ca1075 /docs/component-spec/errorDisplaySpec.js | |
| parent | a564160511bf1bbed5a4fe5d2981fae1bb664eca (diff) | |
| download | angular.js-389d4879da4aa620ee95d789b19ff9be44eb730a.tar.bz2 | |
chore(doc-gen): new docs
chore(doc-gen): implement dgeni
Diffstat (limited to 'docs/component-spec/errorDisplaySpec.js')
| -rw-r--r-- | docs/component-spec/errorDisplaySpec.js | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/docs/component-spec/errorDisplaySpec.js b/docs/component-spec/errorDisplaySpec.js deleted file mode 100644 index 9549e220..00000000 --- a/docs/component-spec/errorDisplaySpec.js +++ /dev/null @@ -1,76 +0,0 @@ -describe("errorDisplay", function () { - - var $location, compileHTML; - - beforeEach(module('docsApp')); - - beforeEach(inject(function ($injector) { - var $rootScope = $injector.get('$rootScope'), - $compile = $injector.get('$compile'); - - $location = $injector.get('$location'); - - compileHTML = function (code) { - var elm = angular.element(code); - $compile(elm)($rootScope); - $rootScope.$digest(); - return elm; - }; - - this.addMatchers({ - toInterpolateTo: function (expected) { - // Given a compiled DOM node with a minerr-display attribute, - // assert that its interpolated string matches the expected text. - return this.actual.text() === expected; - } - }); - })); - - it('should interpolate a template with no parameters', function () { - var elm; - - spyOn($location, 'search').andReturn({}); - elm = compileHTML('<div error-display="This is a test"></div>'); - expect(elm).toInterpolateTo('This is a test'); - }); - - it('should interpolate a template with no parameters when search parameters are present', function () { - var elm; - - spyOn($location, 'search').andReturn({ p0: 'foobaz' }); - elm = compileHTML('<div error-display="This is a test"></div>'); - expect(elm).toInterpolateTo('This is a test'); - }); - - it('should correctly interpolate search parameters', function () { - var elm; - - spyOn($location, 'search').andReturn({ p0: '42' }); - elm = compileHTML('<div error-display="The answer is {0}"></div>'); - expect(elm).toInterpolateTo('The answer is 42'); - }); - - it('should interpolate parameters in the specified order', function () { - var elm; - - spyOn($location, 'search').andReturn({ p0: 'second', p1: 'first' }); - elm = compileHTML('<div error-display="{1} {0}"></div>'); - expect(elm).toInterpolateTo('first second'); - }); - - it('should preserve interpolation markers when fewer arguments than needed are provided', function () { - var elm; - - spyOn($location, 'search').andReturn({ p0: 'Fooooo' }); - elm = compileHTML('<div error-display="This {0} is {1} on {2}"></div>'); - expect(elm).toInterpolateTo('This Fooooo is {1} on {2}'); - }); - - it('should correctly handle the empty string as an interpolation parameter', function () { - var elm; - - spyOn($location, 'search').andReturn({ p0: 'test', p1: '' }); - elm = compileHTML('<div error-display="This {0} is a {1}"></div>'); - expect(elm).toInterpolateTo('This test is a '); - }); -});
\ No newline at end of file |
