@@ -1733,6 +1733,34 @@ describe('ngModelOptions attributes', function() {
1733
1733
} ) ;
1734
1734
1735
1735
1736
+ it ( 'should allow sharing options between multiple inputs' , function ( ) {
1737
+ $rootScope . options = { updateOn : 'default' } ;
1738
+ var inputElm = helper . compileInput (
1739
+ '<input type="text" ng-model="name1" name="alias1" ' +
1740
+ 'ng-model-options="options"' +
1741
+ '/>' +
1742
+ '<input type="text" ng-model="name2" name="alias2" ' +
1743
+ 'ng-model-options="options"' +
1744
+ '/>' ) ;
1745
+
1746
+ helper . changeGivenInputTo ( inputElm . eq ( 0 ) , 'a' ) ;
1747
+ helper . changeGivenInputTo ( inputElm . eq ( 1 ) , 'b' ) ;
1748
+ expect ( $rootScope . name1 ) . toEqual ( 'a' ) ;
1749
+ expect ( $rootScope . name2 ) . toEqual ( 'b' ) ;
1750
+ } ) ;
1751
+
1752
+
1753
+ it ( 'should hold a copy of the options object' , function ( ) {
1754
+ $rootScope . options = { updateOn : 'default' } ;
1755
+ var inputElm = helper . compileInput (
1756
+ '<input type="text" ng-model="name" name="alias" ' +
1757
+ 'ng-model-options="options"' +
1758
+ '/>' ) ;
1759
+ expect ( $rootScope . options ) . toEqual ( { updateOn : 'default' } ) ;
1760
+ expect ( $rootScope . form . alias . $options ) . not . toBe ( $rootScope . options ) ;
1761
+ } ) ;
1762
+
1763
+
1736
1764
it ( 'should allow overriding the model update trigger event on checkboxes' , function ( ) {
1737
1765
var inputElm = helper . compileInput (
1738
1766
'<input type="checkbox" ng-model="checkbox" ' +
0 commit comments