#Clipboard contents after action has been clicked
11 messages · Page 1 of 1 (latest)
where is the action?
Form component (TextInput).
could you share the code?
// Custom action btw
Action::make('copy')
->icon('heroicon-s-clipboard')
->color('gray')
->visible(fn ($state) => $this->getCopyable() && ! empty($state))
->action(function ($livewire, $state, Action $action) {
$action->icon('heroicon-s-clipboard-document-check')
->color('success');
$livewire->dispatch('copy-to-clipboard', text: $state);
}),
After that is basically writes to the clipboard. navigator.clipboard.writeText(text);
But im not sure if we can even access something like that in tests. 🤔
maybe assertDispatched ?