diff options
| author | Brian Ford | 2012-07-19 01:10:12 -0700 |
|---|---|---|
| committer | Igor Minar | 2012-08-13 09:48:23 -0700 |
| commit | e85774f709b9f681b0ff8d829b07568b0f844a62 (patch) | |
| tree | dab37854be2ae13084e1b5f2aeb61858d2bdbfae /test/ng | |
| parent | 44345c74decfd2e303ada9c958af8e9a07bb8336 (diff) | |
| download | angular.js-e85774f709b9f681b0ff8d829b07568b0f844a62.tar.bz2 | |
fix(ngPluralize): fixes ng-pluralize when using non-standard start/end symbols
Closes #1134
Diffstat (limited to 'test/ng')
| -rw-r--r-- | test/ng/directive/ngPluralizeSpec.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/ng/directive/ngPluralizeSpec.js b/test/ng/directive/ngPluralizeSpec.js index c382f4f4..e790518c 100644 --- a/test/ng/directive/ngPluralizeSpec.js +++ b/test/ng/directive/ngPluralizeSpec.js @@ -133,4 +133,41 @@ describe('ngPluralize', function() { expect(element.text()).toBe('Igor, Misko and 2 other people are viewing.'); })); }); + + + describe('interpolation', function() { + + it('should support custom interpolation symbols', function() { + module(function($interpolateProvider) { + $interpolateProvider.startSymbol('[[').endSymbol('%%'); + }); + + inject(function($compile, $rootScope) { + element = $compile( + "<ng:pluralize count=\"viewCount\" offset=\"1\"" + + "when=\"{'0': 'Nobody is viewing.'," + + "'1': '[[p1%% is viewing.'," + + "'one': '[[p1%% and one other person are viewing.'," + + "'other': '[[p1%% and {} other people are viewing.'}\">" + + "</ng:pluralize>")($rootScope); + $rootScope.p1 = 'Igor'; + + $rootScope.viewCount = 0; + $rootScope.$digest(); + expect(element.text()).toBe('Nobody is viewing.'); + + $rootScope.viewCount = 1; + $rootScope.$digest(); + expect(element.text()).toBe('Igor is viewing.'); + + $rootScope.viewCount = 2; + $rootScope.$digest(); + expect(element.text()).toBe('Igor and one other person are viewing.'); + + $rootScope.viewCount = 3; + $rootScope.$digest(); + expect(element.text()).toBe('Igor and 2 other people are viewing.'); + }); + }) + }); }); |
