I'm writing my first Angular tests and having a problem here. I'm testing a component, which has a custom attribute in it
<ng-container *isGranted="admin">
...
</ng-container>
Official documentation says
The NO_ERRORS_SCHEMA tells the Angular compiler to ignore unrecognized elements and attributes.
So I added the following to my TestBed config:
schemas: [NO_ERRORS_SCHEMA]
But still, I'm getting an error:
Property binding isGranted not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations
Where am I wrong? I do not want to test how isGranted behaves, I just want to check that a correct value was assigned to it.
You are using directive, while NO_ERROR_SCHEMA is to ignore custom components. See github when error is thrown with proper exception saying that you need to include directives
Property binding ${prop.name} not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With