aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng
diff options
context:
space:
mode:
authorFrancesco Pontillo2013-08-31 11:48:11 +0200
committerBrian Ford2013-10-01 15:08:23 -0700
commit8e1276c011b33b90af47494dc5e76baf86468a5a (patch)
tree63ab29694fa90ee2797dd95397f9f5f61de5fdaf /test/ng
parent6972596ce99f2a11ae07e65ebcb554cef1dd3240 (diff)
downloadangular.js-8e1276c011b33b90af47494dc5e76baf86468a5a.tar.bz2
fix($compile): allow interpolations for non-event handlers attrs
Fix wrong behaviour that didn't allow 'data-on' and 'on' element attributes to be interpolated by $compile. The regex now accepts any string beginning with 'on' and with at least one more English letter.
Diffstat (limited to 'test/ng')
-rwxr-xr-xtest/ng/compileSpec.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js
index 580d51c3..6b3a0479 100755
--- a/test/ng/compileSpec.js
+++ b/test/ng/compileSpec.js
@@ -3250,6 +3250,18 @@ describe('$compile', function() {
$rootScope.$apply();
expect(element.attr('on-click')).toEqual('javascript:doSomething()');
}));
+
+ it('should pass through arbitrary values on "on" and "data-on" attributes', inject(function($compile, $rootScope) {
+ element = $compile('<button data-on="{{dataOnVar}}"></script>')($rootScope);
+ $rootScope.dataOnVar = 'data-on text';
+ $rootScope.$apply();
+ expect(element.attr('data-on')).toEqual('data-on text');
+
+ element = $compile('<button on="{{onVar}}"></script>')($rootScope);
+ $rootScope.onVar = 'on text';
+ $rootScope.$apply();
+ expect(element.attr('on')).toEqual('on text');
+ }));
});
describe('iframe[src]', function() {