angular2-draggable icon indicating copy to clipboard operation
angular2-draggable copied to clipboard

Unit test failure

Open devilsgeographer opened this issue 6 years ago • 3 comments

After implementing your directive on a div:

And registering the directive in app.module.ts, the app is working as expected.

When I run the unit test on my component, I receive an error:

Failed: Template parse errors: Can't bind to 'rzHandles' since it isn't a known property of 'div'. ("

If I remove [rzHandles], it will error similiarly with [handle] not being a known property.

In my spec.ts file, I register your directive in beforeEach like so: declarations: [AngularDraggableModule, ... imports: [AngularDraggableModule, ...

Do you have any idea for why the tests continue to fail? I cant figure it from google and I dont see unit test examples in your source.

Thank you.

devilsgeographer avatar May 17 '19 15:05 devilsgeographer

@rjacksongeocomm I think you need to remove AngularDraggableModule from declarations: [].

You should import it in your TestBed, but not declare it.

xieziyu avatar May 21 '19 03:05 xieziyu

Ziyu, yes I did import the module. For some reason regardless of what I tried the error persists. looked at other samples and the same pattern didnt work. Was hoping you might have an example ts.spec file.

Get Outlook for Androidhttps://aka.ms/ghei36


From: Xie, Ziyu [email protected] Sent: Monday, May 20, 2019 8:45:16 PM To: xieziyu/angular2-draggable Cc: Roy Jackson; Mention Subject: Re: [xieziyu/angular2-draggable] Unit test failure (#167)

@rjacksongeocommhttps://github.com/rjacksongeocomm Did you import AngularDraggableModule in your TestBed?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/xieziyu/angular2-draggable/issues/167?email_source=notifications&email_token=AEF5KTKXPUWVBPU3FSZSDVLPWNV4ZA5CNFSM4HNWLJAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODV2VG7I#issuecomment-494228349, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AEF5KTI4VKXJH3MOY4LMDUDPWNV4ZANCNFSM4HNWLJAA.

devilsgeographer avatar May 21 '19 03:05 devilsgeographer

@rjacksongeocomm I write a simple demo with an app.component.spec.ts here: https://stackblitz.com/edit/angular2-draggable-with-spec?embed=1&file=src/app/app.component.spec.ts

Hope it works for you.

xieziyu avatar May 21 '19 06:05 xieziyu