angular - hostCompFixture.detectChanges break my test -


i test toast component have add console log display if use hostcompfixture.detectchanges have nothing test failed directy , if delete hostcompfixture.detectchanges component

this test :

 @component({   template: `     <mae-toast [toast]="toast"></mae-toast>   ` }) class testtoastcomponent {   toast: toast   severity? : severity   id?:   heading?: string   content: string   icon?: string   color?: string   actions?: actionlistitem[] }  describe('toastcomponent', () => {   beforeeach(() => {     testbed.configuretestingmodule({       declarations: [toastcomponent, testtoastcomponent],       imports: [linkmodule, routertestingmodule,browseranimationsmodule]     })     fixture = testbed.createcomponent(toastcomponent)     comp = fixture.componentinstance      hostcompfixture = testbed.createcomponent(testtoastcomponent)     hostcomp = hostcompfixture.componentinstance    })      it('should check severity property', ()=> {         hostcomp.severity = severity.success         hostcompfixture.detectchanges()         el = hostcompfixture.debugelement.query(by.css('.mae-toast__details')).nativeelement         console.log(el)         hostcompfixture.detectchanges()         expect(el.classname).tocontain('mi-check')         expect(el.classname).tocontain('success')        }) 

i don't know if test not or other problem link hostcompfixture.detectchanges

thanks !


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -