Skip to content

Commit b36a4d9

Browse files
committed
Test that the dropzone load listener is registered only once
1 parent ad3ec79 commit b36a4d9

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

t/playwright/ticket_dropzone.t

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,17 @@ diag "Delete gamma.txt via the per-row Delete action (with confirmation)";
219219
is( $p->{page}->locator('.attachment-list tr[data-name="gamma.txt"]')->count, 0, 'gamma.txt row removed' );
220220
}
221221

222+
diag "The dropzone htmx:load listener is registered once, not leaked per widget refresh";
223+
{
224+
# The add-attachment form lives inside the self-refreshing widget, so each
225+
# pin/unpin/rename/delete above re-ran its inline <script>. The keyed
226+
# registerLoadListener must keep exactly one dropzone listener registered.
227+
my $count = $p->{page}->evaluate(
228+
q{return (window.RT && RT.loadListeners) ? RT.loadListeners.filter(function (f) { return f._rtLoadListenerKey === 'attach-dropzone'; }).length : -1;}
229+
);
230+
is( $count, 1, 'attach-dropzone load listener registered exactly once after several refreshes' );
231+
}
232+
222233
diag "Bulk mode toggle reveals the bulk action bar and per-row checkboxes";
223234
{
224235
my $widget = $p->{page}->locator('.ticket-info-attachments');

0 commit comments

Comments
 (0)