I have a simple Ionic2 component using the following directives:
@View({
templateUrl: 'build/components/checkinDateInput/checkinDateInput.html',
directives: [ FocusDirective, Item, Label, TextInput ],
})
When testing, I get an error message: No provider for Form! (Item -> Form)
I tried to add a provider to my specification:
beforeEachProviders(() => [Form]);
However, it Formis private in Ionic, and therefore I cannot import it ( ionic-framework/util/form.d.ts):
export declare class Form {
private _blur;
...
error TS2305: Module '".../node_modules/ionic-framework/ionic"' has no exported member 'Form'.
Since it cannot be imported, I cannot mock it in beforeEachProviders because it Formwill be undefined.
beforeEachProviders(() => [
provide(Form, {useClass: MockForm})
]);
Should I import Form, or am I mistaken about this?
source
share