diff --git a/viewer/scripts/undo-move-smoke.mjs b/viewer/scripts/undo-move-smoke.mjs index cc2c219..d0f8557 100644 --- a/viewer/scripts/undo-move-smoke.mjs +++ b/viewer/scripts/undo-move-smoke.mjs @@ -11,6 +11,8 @@ export async function checkUndoMove(page, engine) { assert.ok(later.log.length > earlier.log.length); await page.evaluate( ({ later, seat }) => { + // Remove the thumbnail overlay left by the preceding presentation test. + document.querySelector('.bgs-board-thumbnail')?.remove(); window.undoRequests = 0; host.on('undo', () => undoRequests++); host.emit('preferences', { sound: false, analysis: false }); @@ -23,11 +25,20 @@ export async function checkUndoMove(page, engine) { const turnUndo = page.locator('[data-board-control="undo"]'); const status = page.locator('.statusBar span'); await turnUndo.waitFor(); + assert.equal(await turnUndo.getAttribute('aria-disabled'), 'true'); + assert.equal(await turnUndo.locator('image').count(), 0, 'undo does not depend on an external image'); + assert.equal(await turnUndo.locator('.undo-icon path').getAttribute('fill'), 'silver'); assert.equal(await control.count(), 0, 'hidden until BGS offers it'); await page.evaluate(() => host.emit('undo:available', true)); await control.waitFor(); assert.equal(await control.getAttribute('aria-label'), 'Undo my move'); + assert.equal(await control.locator('.undo-icon path').getAttribute('fill'), 'black'); + await control.scrollIntoViewIfNeeded(); + await page.waitForTimeout(200); + const iconBounds = await control.locator('.undo-icon path').boundingBox(); + assert.ok(iconBounds.width > 10 && iconBounds.height > 10, 'undo arrow renders within the button'); + await page.screenshot({ path: '/tmp/container-undo-icon.png', fullPage: true }); assert.equal(await control.locator('title').textContent(), 'Undo my move'); assert.equal(await turnUndo.count(), 0, 'it stands in for the in-turn undo'); assert.doesNotMatch(await status.textContent(), /your turn/); diff --git a/viewer/src/components/buttons/UndoButton.vue b/viewer/src/components/buttons/UndoButton.vue index a4fc01f..0d821a4 100644 --- a/viewer/src/components/buttons/UndoButton.vue +++ b/viewer/src/components/buttons/UndoButton.vue @@ -11,7 +11,21 @@ @keydown.space.prevent="enabled && $emit('click')" > - + Undo last move diff --git a/viewer/src/components/buttons/UndoMoveButton.vue b/viewer/src/components/buttons/UndoMoveButton.vue index c396530..2f6420f 100644 --- a/viewer/src/components/buttons/UndoMoveButton.vue +++ b/viewer/src/components/buttons/UndoMoveButton.vue @@ -10,7 +10,21 @@ @keydown.space.prevent="$emit('click')" > - + Undo my move