Render undo arrows inline instead of loading external SVG images
This commit is contained in:
parent
096b472c5f
commit
1e12a2c314
3 changed files with 41 additions and 2 deletions
|
|
@ -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/);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,21 @@
|
|||
@keydown.space.prevent="enabled && $emit('click')"
|
||||
>
|
||||
<rect width="80" height="26" fill="gainsboro" stroke="black" rx="2" />
|
||||
<image x="30" y="3" width="20" height="20" href="../../icons/undo.svg" aria-hidden="true" />
|
||||
<svg
|
||||
class="undo-icon"
|
||||
x="30"
|
||||
y="3"
|
||||
width="20"
|
||||
height="20"
|
||||
viewBox="0 0 497.25 497.25"
|
||||
aria-hidden="true"
|
||||
pointer-events="none"
|
||||
>
|
||||
<path
|
||||
:fill="enabled ? 'black' : 'silver'"
|
||||
d="M248.625,89.25 V0 l-127.5,127.5 l127.5,127.5 V140.25 c84.15,0,153,68.85,153,153 c0,84.15-68.85,153-153,153 c-84.15,0-153-68.85-153-153 h-51 c0,112.2,91.8,204,204,204 s204-91.8,204-204 S360.825,89.25,248.625,89.25z"
|
||||
/>
|
||||
</svg>
|
||||
<title>Undo last move</title>
|
||||
</g>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,21 @@
|
|||
@keydown.space.prevent="$emit('click')"
|
||||
>
|
||||
<rect width="80" height="26" fill="gainsboro" stroke="black" rx="2" />
|
||||
<image x="30" y="3" width="20" height="20" href="../../icons/undo.svg" aria-hidden="true" />
|
||||
<svg
|
||||
class="undo-icon"
|
||||
x="30"
|
||||
y="3"
|
||||
width="20"
|
||||
height="20"
|
||||
viewBox="0 0 497.25 497.25"
|
||||
aria-hidden="true"
|
||||
pointer-events="none"
|
||||
>
|
||||
<path
|
||||
fill="black"
|
||||
d="M248.625,89.25 V0 l-127.5,127.5 l127.5,127.5 V140.25 c84.15,0,153,68.85,153,153 c0,84.15-68.85,153-153,153 c-84.15,0-153-68.85-153-153 h-51 c0,112.2,91.8,204,204,204 s204-91.8,204-204 S360.825,89.25,248.625,89.25z"
|
||||
/>
|
||||
</svg>
|
||||
<title>Undo my move</title>
|
||||
</g>
|
||||
</template>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue