fix: reliably reveal image link fields on selection (1.7.4)
CMS quality / php (8.2) (push) Canceled after 0s
CMS quality / php (8.4) (push) Canceled after 0s
CMS quality / browser (push) Canceled after 0s
CMS quality / mysql (push) Canceled after 0s

This commit is contained in:
kantarci committed 2026-09-14 11:56:40 +02:00
1 parent e18c881db8
commit 25fd388f80
5 files changed
+70 -10

No files matched your search

+33
View File
@@ -37,6 +37,7 @@ try {
assert.ok(chosen); const original = mediaProps(chosen); original.alt ||= chosen.title;
data.document.blocks.unshift({ id: 'qa-link-section', type: 'section', children: [
{ id: 'qa-link-image', type: 'image', props: { ...original, href: '/impressum', click: 'link' } },
{ id: 'qa-empty-image', type: 'image', props: { ...original, click: 'keine' } },
{ id: 'qa-link-button', type: 'button', props: { text: 'QA Neuer Tab', href: '/impressum' } },
{ id: 'qa-link-text', type: 'text', props: { text: '<p>Textlink prüfen</p>' } },
{ id: 'qa-link-gallery', type: 'gallery', children: [{ id: 'qa-gallery-image', type: 'image', props: original }] },
@@ -53,12 +54,40 @@ try {
return block && doc.defaultView.getComputedStyle(block).backgroundImage.includes('url(') === hasImage;
}, hasImage);
const save = async () => { await page.locator('#save').click(); await page.locator('#save-status').filter({ hasText: 'Entwurf gespeichert' }).waitFor(); };
await select('qa-empty-image');
const clickAction = () => page.getByLabel('Beim Klick', { exact: true });
await page.locator('#property-href').waitFor({ state: 'hidden' });
const nativeSelect = await clickAction().elementHandle();
await clickAction().click(); await page.keyboard.press('End'); await page.keyboard.press('Enter');
await page.getByLabel('Linkziel', { exact: true }).waitFor();
assert.equal(await nativeSelect.evaluate(el => el.isConnected), true, 'Keep the native dropdown mounted while changing the action');
await nativeSelect.dispose();
await page.getByLabel('Linkziel', { exact: true }).fill('/kontakt');
await clickAction().focus(); await page.keyboard.press('Home');
await page.locator('#property-href').waitFor({ state: 'hidden' });
await page.keyboard.press('End'); await page.getByLabel('Linkziel', { exact: true }).waitFor();
assert.equal(await page.getByLabel('Linkziel', { exact: true }).inputValue(), '/kontakt');
await clickAction().selectOption('keine');
await clickAction().evaluate(el => { el.value = 'link'; el.dispatchEvent(new Event('change', { bubbles: true })); });
await page.getByLabel('Linkziel', { exact: true }).waitFor();
assert.equal(await page.getByLabel('Linkziel', { exact: true }).inputValue(), '/kontakt');
await page.locator('#undo').click();
assert.equal(await clickAction().inputValue(), 'keine'); await page.locator('#property-href').waitFor({ state: 'hidden' });
await page.locator('#redo').click();
assert.equal(await clickAction().inputValue(), 'link'); await page.getByLabel('Linkziel', { exact: true }).waitFor();
await clickAction().selectOption('vergroessern');
await page.locator('#property-href').waitFor({ state: 'hidden' }); await page.locator('#property-newTab').waitFor({ state: 'hidden' });
await frame.locator('#qa-empty-image a.image-zoom').waitFor();
await clickAction().selectOption('link'); await page.getByLabel('Linkziel', { exact: true }).waitFor();
await page.locator('.image-link-options').screenshot({ path: `${report}/image-link-fields.png` });
checks.push('fresh image URL appears after native dropdown and keyboard selection; URL retained; change-only event supported');
await select('qa-link-image'); await thumbnail().waitFor({ state: 'visible' });
assert.ok(await thumbnail().evaluate(img => img.naturalWidth > 0));
await page.getByLabel('In neuem Tab öffnen', { exact: true }).check();
await frame.locator('#qa-link-image a[target="_blank"][rel="noopener"]').waitFor();
await page.getByLabel('Beim Klick', { exact: true }).selectOption('keine');
await frame.locator('#qa-link-image a').waitFor({ state: 'detached' });
await page.getByLabel('Beim Klick', { exact: true }).focus();
await page.getByLabel('Beim Klick', { exact: true }).selectOption('link');
assert.equal(await page.getByLabel('Beim Klick', { exact: true }).evaluate(el => el === document.activeElement), true);
await page.getByLabel('Linkziel', { exact: true }).waitFor();
@@ -118,6 +147,9 @@ try {
await save(); await page.reload(); await select('qa-link-image');
assert.equal(await page.getByLabel('In neuem Tab öffnen', { exact: true }).isChecked(), true);
await thumbnail().waitFor({ state: 'visible' });
await select('qa-empty-image');
assert.equal(await clickAction().inputValue(), 'link');
assert.equal(await page.getByLabel('Linkziel', { exact: true }).inputValue(), '/kontakt');
await page.locator('#publish').click(); await page.locator('#confirm-publish').click();
await page.locator('#save-status').filter({ hasText: 'Veröffentlicht' }).waitFor();
checks.push('button and rich-text target creation/edit/uncheck, safe attributes, save/reload and publication');
@@ -146,6 +178,7 @@ try {
assert.equal(await publicPage.locator(selector).getAttribute('rel'), 'noopener');
}
assert.equal(await publicPage.getByRole('link', { name: 'QA Menülink', exact: true }).getAttribute('target'), '_blank');
assert.equal(await publicPage.locator('#qa-empty-image a').getAttribute('href'), '/kontakt');
const popupPromise = publicPage.waitForEvent('popup'); await publicPage.locator('#qa-link-button').click();
const popup = await popupPromise; await popup.waitForLoadState();
assert.equal(new URL(popup.url()).pathname, '/impressum'); assert.equal(await popup.evaluate(() => window.opener), null); await popup.close();