unit testing - HowTo test Modal emitter in Angular2? -
this class component:
export class goalsettingspage { public goal: goal; dismiss() { this.viewctrl.dismiss(); } }
this test:
it('should emit on click', () => { let g = new goal() let settingmodal = modal.create(goalsettingspage, { g:goal }); settingmodal.subscribe(hc => { console.log(hc); expect(hc).toequal({hascompleted:true}); }); settingmodal.dismiss() })
this error:
04 07 2016 16:36:48.438:error [chrome 51.0.2704 (mac os x 10.11.3) | goal settings | should emit on click]: typeerror: cannot read property 'remove' of undefined @ modal.viewcontroller.dismiss (http://localhost:9876/absolute/var/folders/zb/tpysrhsx7hbg1dnsn4gwtqq00000gn/t/65a6294f711f882f7429da26bc12e438.browserify?2c82fe582a9911b998cb77bce54ea6804460d5cd:59060:25)
any idea doing wrong?
Comments
Post a Comment