Closed jdjd1118 closed 2 years ago
Hello @jdjd1118
The error occurs when set showConfirmButton
to true
but you didn't set the event for the confirm button. I should add it to documentation, Thanks for submitting the issue.
@jantinnerezo Ah, I see. That makes sense. I set the event and no longer get that js error. One more question for you, due to this change our tests no longer pass because of the event array in the payload. Previously it was just an empty array but now it has the component ID in it. Any ideas on how to test that the correct alert was called with the correct message? Below is the assertion.
$this->assertDispatchedBrowserEvent('alert', [ 'type' => 'error', 'message' => $message, 'events' => [], 'options' => $options, 'data' => null ]);
@jantinnerezo Nevermind, I figured it out. This is what I have now:
$this->assertDispatchedBrowserEvent('alert', [ 'type' => 'error', 'message' => $message, 'events' => [ 'onConfirmed' => [ 'id' => $this->id, 'component' => 'self', 'listener' => 'confirmed' ] ], 'options' => $options, 'data' => null ]);
See screenshot for error. This error occurs after a user clicks OK on an error alert
$this->alert('error', 'Error message', [ 'toast' => false, 'showConfirmationButton' => true ]);