lundi 21 mai 2018

ng test show me this error: Failed: Template parse errors: 'mat-checkbox' is not a known element

I create this code for testing my component.

I tried this code:

describe('Component: AddAlarms', () => {
    let component: AddAlarmsFormComponent;
    let fixture: ComponentFixture<AddAlarmsFormComponent>;
    beforeEach(() => {
        TestBed.configureTestingModule({
            declarations: [AddAlarmsFormComponent]
        });
        fixture = TestBed.createComponent(AddAlarmsFormComponent);
        component = fixture.componentInstance;
    });
});

when run ng test show this error:

Failed: Template parse errors:
'mat-checkbox' is not a known element:
1. If 'mat-checkbox' is an Angular component, then verify that it is part of this module.
2. If 'mat-checkbox' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("
        </div>
        <div class="input-field col s2">
          [ERROR ->]<mat-checkbox class="example-margin" (click)="sortbydate()">Dates</mat-checkbox>
        </div>
     "): ng:///DynamicTestModule/NotificationsComponent.html@12:10

I verify my module.ts and it's ok. So, I have this:

import {MatCheckboxModule} from '@angular/material/checkbox';

Can you ask me, what is the problem?

Aucun commentaire:

Enregistrer un commentaire