dimanche 28 juillet 2019

angular testing, conflicting component selectors

In an angular application unit test I would like to replace an imported component with a stub-component. I must import the module that defines the component because other components from it are required for the test. Simiar question: How to find which components are conflicting? How can I import all components from a module but some? Like a whitelist or blacklist of components.

TestBed.configureTestingModule({
  imports: [
    FormsModule, 
     /*Contains RichTextBoxComponent with selector 'app-rich-text-box'.
       How to import all components from this module but 'app-rich-text-box'.
     */
    UicompsModule],
  declarations: [ 
    ManageQuestionComponent, 
    /*Contains also a selector 'app-rich-text-box'*/
    StubRichTextBoxComponent],
  providers: [  ],
})
.compileComponents();

Aucun commentaire:

Enregistrer un commentaire