diff options
| author | Vojta Jina | 2012-03-12 22:56:36 -0700 |
|---|---|---|
| committer | Igor Minar | 2012-03-13 17:51:05 -0700 |
| commit | 13f31602f396bc269076ab4d389cfd8ca94b20ba (patch) | |
| tree | c6837581b3b965d762fb7a1dee7321d7dee0b4db /test/directive/inputSpec.js | |
| parent | 7b52586f7c139ea5dfe694f9667bad673d7ca5f1 (diff) | |
| download | angular.js-13f31602f396bc269076ab4d389cfd8ca94b20ba.tar.bz2 | |
feat(ng-list): Allow custom separator
Diffstat (limited to 'test/directive/inputSpec.js')
| -rw-r--r-- | test/directive/inputSpec.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/directive/inputSpec.js b/test/directive/inputSpec.js index a9aafd04..ad1670f9 100644 --- a/test/directive/inputSpec.js +++ b/test/directive/inputSpec.js @@ -871,6 +871,28 @@ describe('input', function() { changeInputValueTo(''); expect(scope.list).toEqual([]); }); + + + it('should allow custom separator', function() { + compileInput('<input type="text" ng-model="list" ng-list=":" />'); + + changeInputValueTo('a,a'); + expect(scope.list).toEqual(['a,a']); + + changeInputValueTo('a:b'); + expect(scope.list).toEqual(['a', 'b']); + }); + + + it('should allow regexp as a separator', function() { + compileInput('<input type="text" ng-model="list" ng-list="/:|,/" />'); + + changeInputValueTo('a,b'); + expect(scope.list).toEqual(['a', 'b']); + + changeInputValueTo('a,b: c'); + expect(scope.list).toEqual(['a', 'b', 'c']); + }); }); describe('required', function() { |
