Add tests for directive generics

This commit is contained in:
Quentin Bouygues
2018-12-17 10:00:24 +01:00
parent d158d782e9
commit 443d1cdc32
+20
View File
@@ -1545,3 +1545,23 @@ const directiveFactoryWithGeneric2: ng.IDirectiveFactory<MyScope, MyElement, MyA
): ng.IDirectiveLinkFn<MyScope, MyElement, MyAttributes, MyController> => {
return ($scope: MyScope, templateElement: MyElement, templateAttributes: MyAttributes, controller: MyController) => {return; };
};
angular.module('WithGenerics', []).directive('usingDirectiveFactoryWithGeneric', directiveFactoryWithGeneric).directive('usingDirectiveFactoryWithGeneric2', directiveFactoryWithGeneric2);
class DirectiveWithGenerics implements ng.IDirective<MyScope, MyElement, MyAttributes, MyController> {
restrict = 'EAC';
compile(templateElement: MyElement) {
return {
pre: this.link
};
}
static instance(): ng.IDirective<MyScope, MyElement, MyAttributes, MyController> {
return new DirectiveWithGenerics();
}
link($scope: MyScope, templateElement: MyElement, templateAttributes: MyAttributes, controller: MyController) {}
}
angular.module('WithGenerics', []).directive('directiveWithGenerics', DirectiveWithGenerics.instance);