test($compile): fix incorrect markup in tests

This commit is contained in:
George Kalpakas
2018-11-08 12:41:10 +02:00
parent ba4d903586
commit 06d154f91c
2 changed files with 9 additions and 9 deletions
+7 -7
View File
@@ -11703,37 +11703,37 @@ describe('$compile', function() {
// All interpolations are disallowed.
$rootScope.onClickJs = '';
expect(function() {
$compile('<button onclick="{{onClickJs}}"></script>');
$compile('<button onclick="{{onClickJs}}"></button>');
}).toThrowMinErr(
'$compile', 'nodomevents', 'Interpolations for HTML DOM event attributes are disallowed');
expect(function() {
$compile('<button ONCLICK="{{onClickJs}}"></script>');
$compile('<button ONCLICK="{{onClickJs}}"></button>');
}).toThrowMinErr(
'$compile', 'nodomevents', 'Interpolations for HTML DOM event attributes are disallowed');
expect(function() {
$compile('<button ng-attr-onclick="{{onClickJs}}"></script>');
$compile('<button ng-attr-onclick="{{onClickJs}}"></button>');
}).toThrowMinErr(
'$compile', 'nodomevents', 'Interpolations for HTML DOM event attributes are disallowed');
expect(function() {
$compile('<button ng-attr-ONCLICK="{{onClickJs}}"></script>');
$compile('<button ng-attr-ONCLICK="{{onClickJs}}"></button>');
}).toThrowMinErr(
'$compile', 'nodomevents', 'Interpolations for HTML DOM event attributes are disallowed');
}));
it('should pass through arbitrary values on onXYZ event attributes that contain a hyphen', inject(function($compile, $rootScope) {
element = $compile('<button on-click="{{onClickJs}}"></script>')($rootScope);
element = $compile('<button on-click="{{onClickJs}}"></button>')($rootScope);
$rootScope.onClickJs = 'javascript:doSomething()';
$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);
element = $compile('<button data-on="{{dataOnVar}}"></button>')($rootScope);
$rootScope.dataOnVar = 'data-on text';
$rootScope.$apply();
expect(element.attr('data-on')).toEqual('data-on text');
element = $compile('<button on="{{onVar}}"></script>')($rootScope);
element = $compile('<button on="{{onVar}}"></button>')($rootScope);
$rootScope.onVar = 'on text';
$rootScope.$apply();
expect(element.attr('on')).toEqual('on text');
+2 -2
View File
@@ -147,11 +147,11 @@ describe('ngProp*', function() {
it('should disallow property binding to onclick', inject(function($compile, $rootScope) {
// All event prop bindings are disallowed.
expect(function() {
$compile('<button ng-prop-onclick="onClickJs"></script>');
$compile('<button ng-prop-onclick="onClickJs"></button>');
}).toThrowMinErr(
'$compile', 'nodomevents', 'Property bindings for HTML DOM event properties are disallowed');
expect(function() {
$compile('<button ng-prop-ONCLICK="onClickJs"></script>');
$compile('<button ng-prop-ONCLICK="onClickJs"></button>');
}).toThrowMinErr(
'$compile', 'nodomevents', 'Property bindings for HTML DOM event properties are disallowed');
}));