Drag the border between two columns to set their widths in 1.16.0
Umut, with a card of an icon next to a text as the example: "bei Rows die Breite ändern, am besten per Drag and Drop im Editor". Rows only ever had equal columns - both the classic `columns` token and the free `gridColumns` produce `repeat(n, 1fr)`. A row now carries the free style `columnWidths`, a list of shares such as `2 1` or `66.7 33.3`, per device and without a new document schema. `StyleCompiler::columnTracks()` turns it into `grid-template-columns`, pads or cuts the shares to the number of columns, and gives a device whose layout stacks the columns a single track, because the desktop rule carries an id and would otherwise outrank the class that stacks a phone. In the editor the border between two side-by-side columns of the selected row is a handle: dragging restyles the row inline while the pointer moves and writes one undo step on release; the arrow keys nudge by five points. The design panel shows the same value as the text field "Spaltenbreiten". The Playwright editor check drags the handle with the real mouse. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
f6350de636
commit
32ee28888e
14 files changed
+346
-3
No files matched your search
@@ -253,6 +253,39 @@ try {
|
||||
assert.equal(await frame.locator(`#${newSectionId} .block-column`).first().getAttribute('id'), firstColumnId);
|
||||
}
|
||||
await page.getByRole('button', { name: 'Desktop', exact: true }).click();
|
||||
// Umut: "bei Rows die Breite ändern, am besten per Drag and Drop im Editor". The border
|
||||
// between the two columns is a handle; dragging it to the right widens the first column.
|
||||
await treeSelect(firstColumnId);
|
||||
await frame.locator(`#${firstColumnId}`).scrollIntoViewIfNeeded();
|
||||
const resizeHandle = page.locator('.ov-resize');
|
||||
await resizeHandle.waitFor();
|
||||
assert.equal(await resizeHandle.count(), 1, 'two columns have one border to drag');
|
||||
const columnTracks = () => frame.locator(`#${newSectionId} .block-row`).first().evaluate(el => getComputedStyle(el).gridTemplateColumns.split(' ').map(Number.parseFloat));
|
||||
const evenTracks = await columnTracks();
|
||||
assert.ok(Math.abs(evenTracks[0] - evenTracks[1]) < 2, `columns start out equal: ${evenTracks}`);
|
||||
const handleBox = await resizeHandle.boundingBox();
|
||||
await page.mouse.move(handleBox.x + handleBox.width / 2, handleBox.y + handleBox.height / 2);
|
||||
await page.mouse.down();
|
||||
await page.mouse.move(handleBox.x + handleBox.width / 2 + 120, handleBox.y + handleBox.height / 2, { steps: 8 });
|
||||
await page.mouse.up();
|
||||
await previewReady();
|
||||
const widenedTracks = await columnTracks();
|
||||
assert.ok(widenedTracks[0] > widenedTracks[1] * 1.3, `dragging the border widened the first column: ${widenedTracks}`);
|
||||
await page.screenshot({ path: 'reports/editor/column-widths.png', fullPage: true });
|
||||
// The same value is visible as numbers in the design panel of the row.
|
||||
await treeSelect(await frame.locator(`#${newSectionId} .block-row`).first().getAttribute('id'));
|
||||
await page.getByRole('button', { name: 'Design', exact: true }).click();
|
||||
const layoutGroup = page.locator('.design-group').filter({ has: page.locator('summary', { hasText: 'Layout' }) }).first();
|
||||
if (!(await layoutGroup.evaluate(element => element.open))) await layoutGroup.locator('summary').click();
|
||||
assert.match(await page.locator('#style-columnWidths').inputValue(), /^\d+(\.\d)? \d+(\.\d)?$/, 'shares are stored per column');
|
||||
// On a phone the columns stack, so there is no border to drag - and one undo restores equal columns.
|
||||
await page.getByRole('button', { name: 'Mobil', exact: true }).click();
|
||||
await treeSelect(firstColumnId);
|
||||
await page.waitForFunction(() => document.querySelectorAll('.ov-resize').length === 0);
|
||||
await page.getByRole('button', { name: 'Desktop', exact: true }).click();
|
||||
await page.locator('#undo').click(); await previewReady();
|
||||
const restoredTracks = await columnTracks();
|
||||
assert.ok(Math.abs(restoredTracks[0] - restoredTracks[1]) < 2, `undo restores equal columns: ${restoredTracks}`);
|
||||
const savedEmptyDraft = await page.evaluate(async () => (await (await fetch(document.querySelector('#editor').dataset.api)).json()).document);
|
||||
assert.equal(JSON.stringify(savedEmptyDraft).includes('editor-empty'), false, 'editing aids never enter content');
|
||||
const publicBefore = await (await fetch(origin)).text();
|
||||
|
||||
Reference in new issue
Block a user