diff options
| -rw-r--r-- | src/service/locale.js | 7 | ||||
| -rw-r--r-- | test/service/localeSpec.js | 8 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/service/locale.js b/src/service/locale.js index e94c2100..069a691e 100644 --- a/src/service/locale.js +++ b/src/service/locale.js @@ -58,6 +58,13 @@ angularServiceInject('$locale', function() { shortDate: 'M/d/yy', mediumTime: 'h:mm:ss a', shortTime: 'h:mm a' + }, + + pluralCat: function(num) { + if (num === 1) { + return 'one'; + } + return 'other'; } }; }); diff --git a/test/service/localeSpec.js b/test/service/localeSpec.js index 048cf5b5..4be49275 100644 --- a/test/service/localeSpec.js +++ b/test/service/localeSpec.js @@ -36,5 +36,13 @@ describe('$locale', function() { expect(datetime.MONTH.length).toBe(12); expect(datetime.AMPMS.length).toBe(2); }); + + + it('should return correct plural types', function() { + expect($locale.pluralCat(-1)).toBe('other'); + expect($locale.pluralCat(0)).toBe('other'); + expect($locale.pluralCat(2)).toBe('other'); + expect($locale.pluralCat(1)).toBe('one'); + }) }); |
