components icon indicating copy to clipboard operation
components copied to clipboard

MdButton trigger click with reference does not work

Open no-more opened this issue 10 years ago • 3 comments

Bug, feature request, or proposal:

Bug

What is the expected behavior?

Same behavior as plain button element

What is the current behavior?

Nothing, the event is not trigger

What are the steps to reproduce?

http://plnkr.co/edit/W6fcHo5TAFe1IDYS18jb?p=preview when you click on "trigger button1" it works and not for "button2"

What is the use-case or motivation for changing an existing behavior?

Which versions of Angular, Material, OS, browsers are affected?

tested on : angular2 rc1, material2 alpha5, windows, chrome

Is there anything else we should know?

Thanks.

no-more avatar Jun 15 '16 04:06 no-more

I'm not really seeing why you would ever want to call click() on a button rather than calling the same function that the button's (click) calls. Closing this issue for now, would consider reopening it if there's a compelling use-case.

jelbourn avatar Jun 15 '16 15:06 jelbourn

I have no idea whether integration testing is a compelling use-case, but at the moment I have to trigger the click on the private property _elementRef: (promptDialog.componentInstance.confirmButton as any)._elementRef.nativeElement.click();

In my opinion, it's a lot cleaner if I could just do the following (and I would have intellisense on this): promptDialog.componentInstance.confirmButton.click()

I'm testing whether the confirmation button actually closes the dialog, so calling promptDialog.close() in the test itself wouldn't be what I'm actually testing.

glenstaes avatar May 04 '17 12:05 glenstaes

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.