diff options
| author | Misko Hevery | 2011-11-03 15:59:18 -0700 |
|---|---|---|
| committer | Misko Hevery | 2011-11-14 20:31:09 -0800 |
| commit | cb6f832f38b11499a6d1dd2caf14d15e68211635 (patch) | |
| tree | adb837d60cb080712319122d3a7103e20e07c2e0 /test/service/parseSpec.js | |
| parent | 6022f3df399a5d98830dfe7904f0ad2baaa308c7 (diff) | |
| download | angular.js-cb6f832f38b11499a6d1dd2caf14d15e68211635.tar.bz2 | |
refactor(filter): filters are now injectable and services
BREAK:
- removed CSS support from filters
Diffstat (limited to 'test/service/parseSpec.js')
| -rw-r--r-- | test/service/parseSpec.js | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/test/service/parseSpec.js b/test/service/parseSpec.js index 5045ec9e..506d3373 100644 --- a/test/service/parseSpec.js +++ b/test/service/parseSpec.js @@ -191,24 +191,19 @@ describe('parser', function() { expect(scope.$eval("'a' + 'b c'")).toEqual("ab c"); }); - it('should parse filters', function() { - angular.filter.substring = function(input, start, end) { + it('should parse filters', inject(function($provide) { + $provide.filter('substring', valueFn(function(input, start, end) { return input.substring(start, end); - }; - - angular.filter.upper = {_case: function(input) { - return input.toUpperCase(); - }}; + })); expect(function() { - scope.$eval("1|nonExistant"); - }).toThrow(new Error("Syntax Error: Token 'nonExistant' should be a function at column 3 of the expression [1|nonExistant] starting at [nonExistant].")); + scope.$eval("1|nonexistent"); + }).toThrow(new Error("Unknown provider for 'nonexistent$Filter'.")); scope.offset = 3; - expect(scope.$eval("'abcd'|upper._case")).toEqual("ABCD"); expect(scope.$eval("'abcd'|substring:1:offset")).toEqual("bc"); - expect(scope.$eval("'abcd'|substring:1:3|upper._case")).toEqual("BC"); - }); + expect(scope.$eval("'abcd'|substring:1:3|uppercase")).toEqual("BC"); + })); it('should access scope', function() { scope.a = 123; |
