Fix delete-row handler: nested slug extraction in OCaml dispatch
The slug extractor after (api. scanned for the first ) but for nested URLs like (api.(delete.1)) it got "(delete.1" instead of "delete". Now handles nested parens: extracts handler name and injects path params into query string. Also strengthened the Playwright test to accept confirm dialogs and assert strict row count decrease. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -191,14 +191,20 @@ test.describe('Mutation handlers', () => {
|
||||
|
||||
test('delete-row: clicking delete removes row', async ({ page }) => {
|
||||
await loadPage(page, '(geography.(hypermedia.(example.delete-row)))');
|
||||
const rowsBefore = await page.locator('table tbody tr').count();
|
||||
const deleteBtn = page.locator('button:has-text("Delete")').first();
|
||||
if (await deleteBtn.count() > 0 && rowsBefore > 0) {
|
||||
await deleteBtn.click();
|
||||
await page.waitForTimeout(2000);
|
||||
const rowsAfter = await page.locator('table tbody tr').count();
|
||||
// Row count should decrease or stay same (if swap replaces)
|
||||
expect(rowsAfter).toBeLessThanOrEqual(rowsBefore);
|
||||
// Auto-accept confirm dialogs (sx-confirm triggers window.confirm)
|
||||
page.on('dialog', dialog => dialog.accept());
|
||||
const rowsBefore = await page.locator('tbody#delete-rows tr').count();
|
||||
expect(rowsBefore).toBeGreaterThan(0);
|
||||
const firstRowId = await page.locator('tbody#delete-rows tr').first().getAttribute('id');
|
||||
const deleteBtn = page.locator('tbody#delete-rows tr:first-child button').first();
|
||||
await deleteBtn.click();
|
||||
await page.waitForTimeout(2000);
|
||||
const rowsAfter = await page.locator('tbody#delete-rows tr').count();
|
||||
// Row count must strictly decrease
|
||||
expect(rowsAfter).toBe(rowsBefore - 1);
|
||||
// The specific row must be gone
|
||||
if (firstRowId) {
|
||||
await expect(page.locator(`#${firstRowId}`)).toHaveCount(0);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user