diff options
| author | Misko Hevery | 2011-04-19 13:50:15 -0700 |
|---|---|---|
| committer | Misko Hevery | 2011-06-08 15:21:33 -0700 |
| commit | 91a34a7027caf0a3f0f4bdaf6649fb6cf479bba8 (patch) | |
| tree | 45cdf78438e1ec63cdaeaa927ec89d6a621cc9da /test | |
| parent | af285dd370aa1b6779bf67ac3bdc19da512aaac5 (diff) | |
| download | angular.js-91a34a7027caf0a3f0f4bdaf6649fb6cf479bba8.tar.bz2 | |
remove ng:format=index
Diffstat (limited to 'test')
| -rw-r--r-- | test/FormattersSpec.js | 9 | ||||
| -rw-r--r-- | test/ParserSpec.js | 11 | ||||
| -rw-r--r-- | test/widgetsSpec.js | 37 |
3 files changed, 8 insertions, 49 deletions
diff --git a/test/FormattersSpec.js b/test/FormattersSpec.js index 234a81d6..1e059e6a 100644 --- a/test/FormattersSpec.js +++ b/test/FormattersSpec.js @@ -40,13 +40,4 @@ describe("formatter", function(){ }); }); - describe('index', function(){ - it('should parse an object from array', function(){ - expect(angular.formatter.index.parse('1', ['A', 'B', 'C'])).toEqual('B'); - }); - it('should format an index from array', function(){ - expect(angular.formatter.index.format('B', ['A', 'B', 'C'])).toEqual('1'); - }); - }); - }); diff --git a/test/ParserSpec.js b/test/ParserSpec.js index 641420cb..d2a1c5ba 100644 --- a/test/ParserSpec.js +++ b/test/ParserSpec.js @@ -405,9 +405,14 @@ describe('parser', function() { }); it('should delegate arguments', function(){ - var index = parser('index:objs').formatter()(); - expect(index.format({objs:['A','B']}, 'B')).toEqual('1'); - expect(index.parse({objs:['A','B']}, '1')).toEqual('B'); + angularFormatter.myArgs = { + parse: function(a, b){ return [a, b]; }, + format: function(a, b){ return [a, b]; } + }; + var myArgs = parser('myArgs:objs').formatter()(); + expect(myArgs.format({objs:'B'}, 'A')).toEqual(['A', 'B']); + expect(myArgs.parse({objs:'D'}, 'C')).toEqual(['C', 'D']); + delete angularFormatter.myArgs; }); }); diff --git a/test/widgetsSpec.js b/test/widgetsSpec.js index 176f6b9c..d3b2ec5d 100644 --- a/test/widgetsSpec.js +++ b/test/widgetsSpec.js @@ -395,43 +395,6 @@ describe("widget", function(){ scope.$eval(); expect(element[0].childNodes[0].selected).toEqual(true); }); - - it('should allow binding to objects through index', function(){ - compile('<div ng:init="list = [{name:\'A\'}, {name:\'B\'}, {name:\'C\'}]">' + - '<select name="selection" multiple ng:format="index:list">' + - '<option selected value="0">A</option>' + - '<option selected value="1">B</option>' + - '<option value="2">C</option>' + - '</select>' + - '</div>'); - scope.$eval(); - expect(scope.selection).toEqual([{name:'A'}, {name:'B'}]); - }); - - it('should be empty array when no items are selected', function(){ - compile( - '<select name="selection" multiple ng:format="index:list">' + - '<option value="0">A</option>' + - '<option value="1">B</option>' + - '<option value="2">C</option>' + - '</select>'); - scope.list = [{name:'A'}, {name:'B'}, {name:'C'}]; - scope.$eval(); - expect(scope.selection).toEqual([]); - }); - - it('should be contain the selected object', function(){ - compile('<div ng:init="list = [{name:\'A\'}, {name:\'B\'}, {name:\'C\'}]">' + - '<select name="selection" multiple ng:format="index:list">' + - '<option value="0">A</option>' + - '<option value="1" selected>B</option>' + - '<option value="2">C</option>' + - '</select>' + - '</div>'); - scope.$eval(); - expect(scope.selection).toEqual([{name:'B'}]); - }); - }); it('should ignore text widget which have no name', function(){ |
