mirror of
https://github.com/simonw/datasette.git
synced 2026-09-16 13:34:07 +02:00
Add declarative data-modal-cancel attribute to datasette-modal
Clicking any element inside a <datasette-modal> that carries a
data-modal-cancel attribute now calls requestClose("cancel"), so
Cancel buttons no longer need JavaScript wiring. Like other
dismissals this respects the busy property and the closeGuard hook.
The set-column-type, row-delete and create-table dialogs now use the
attribute instead of their own click listeners, and the plugin
documentation example is simplified to match (the regenerated docs
screenshot is unchanged).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TShiUYVMmmF4zyJR6GMw34
This commit is contained in:
parent
14397ac4c1
commit
32be92fa24
6 changed files with 27 additions and 25 deletions
|
|
@ -975,6 +975,13 @@ def test_set_column_type_dialog(page, datasette_server):
|
|||
option_names = dialog.locator(".set-column-type-option-name").all_inner_texts()
|
||||
assert "asset" in option_names
|
||||
|
||||
# Escape closes the dialog via the shared datasette-modal component
|
||||
# The declarative data-modal-cancel attribute closes the dialog
|
||||
dialog.locator("[data-modal-cancel]").click()
|
||||
dialog.wait_for(state="hidden")
|
||||
|
||||
# Escape also closes the dialog via the shared datasette-modal component
|
||||
page.locator('th[data-column="title"] svg.dropdown-menu-icon').click()
|
||||
page.get_by_role("link", name="Set custom type").click()
|
||||
dialog.wait_for(state="visible")
|
||||
page.keyboard.press("Escape")
|
||||
dialog.wait_for(state="hidden")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue