aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng/directive/booleanAttrsSpec.js
diff options
context:
space:
mode:
authorIgor Minar2013-07-24 16:42:52 -0700
committerIgor Minar2013-07-24 18:53:09 -0700
commitd87fa0042375b025b98c40bff05e5f42c00af114 (patch)
treecd2ee7f2726d0e7006d03ffd1bf5449d6cdfe9ca /test/ng/directive/booleanAttrsSpec.js
parente03402433d2524fd3a74bbfce984f843794996ce (diff)
downloadangular.js-d87fa0042375b025b98c40bff05e5f42c00af114.tar.bz2
fix(select): don't support binding to select[multiple]
changing the type of select box from single to multiple or the other way around at runtime is currently not supported and the two-way binding does odd stuff when such situation happens. we might eventually support this, but for now we are just going to not allow binding to select[multiple] to prevent people from relying on something that doesn't work. BREAKING CHANGE: binding to select[multiple] directly or via ngMultiple (ng-multiple) directive is not supported. This feature never worked with two-way data-binding, so it's not expected that anybody actually depends on it. Closes #3230
Diffstat (limited to 'test/ng/directive/booleanAttrsSpec.js')
-rw-r--r--test/ng/directive/booleanAttrsSpec.js34
1 files changed, 24 insertions, 10 deletions
diff --git a/test/ng/directive/booleanAttrsSpec.js b/test/ng/directive/booleanAttrsSpec.js
index 221c0411..be2dfb60 100644
--- a/test/ng/directive/booleanAttrsSpec.js
+++ b/test/ng/directive/booleanAttrsSpec.js
@@ -65,16 +65,6 @@ describe('boolean attr directives', function() {
}));
- it('should bind multiple', inject(function($rootScope, $compile) {
- element = $compile('<select ng-multiple="isMultiple"></select>')($rootScope)
- $rootScope.isMultiple=false;
- $rootScope.$digest();
- expect(element.attr('multiple')).toBeFalsy();
- $rootScope.isMultiple='multiple';
- $rootScope.$digest();
- expect(element.attr('multiple')).toBeTruthy();
- }));
-
it('should bind open', inject(function($rootScope, $compile) {
element = $compile('<details ng-open="isOpen"></details>')($rootScope)
$rootScope.isOpen=false;
@@ -84,6 +74,30 @@ describe('boolean attr directives', function() {
$rootScope.$digest();
expect(element.attr('open')).toBeTruthy();
}));
+
+
+ describe('multiple', function() {
+ it('should NOT bind to multiple via ngMultiple', inject(function($rootScope, $compile) {
+ element = $compile('<select ng-multiple="isMultiple"></select>')($rootScope)
+ $rootScope.isMultiple=false;
+ $rootScope.$digest();
+ expect(element.attr('multiple')).toBeFalsy();
+ $rootScope.isMultiple='multiple';
+ $rootScope.$digest();
+ expect(element.attr('multiple')).toBeFalsy(); // ignore
+ }));
+
+
+ it('should throw an exception if binding to multiple attribute', inject(function($rootScope, $compile) {
+ if (msie < 9) return; //IE8 doesn't support biding to boolean attributes
+
+ expect(function() {
+ $compile('<select multiple="{{isMultiple}}"></select>')
+ }).toThrow('[$compile:selmulti] Binding to the multiple attribute is not supported. ' +
+ 'Element: <select multiple="{{isMultiple}}">');
+
+ }));
+ });
});