From d87fa0042375b025b98c40bff05e5f42c00af114 Mon Sep 17 00:00:00 2001
From: Igor Minar
Date: Wed, 24 Jul 2013 16:42:52 -0700
Subject: 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
---
test/ng/directive/booleanAttrsSpec.js | 34 ++++++++++++++++++++++++----------
1 file changed, 24 insertions(+), 10 deletions(-)
(limited to 'test')
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('')($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('')($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('')($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('')
+ }).toThrow('[$compile:selmulti] Binding to the multiple attribute is not supported. ' +
+ 'Element: