fix: builder column classes only – no 4_5, all breakpoints checked (S49)
New rows no longer accept 4_5 (the builder does not offer it). On update, the flexType of every non-desktop breakpoint (tablet, phone, …) is format-checked against the builder list like desktop. Guide updated. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
This commit is contained in:
@@ -29,6 +29,14 @@ final class ColumnWidthsTest extends TestCase
|
||||
self::assertStringContainsString('volle Zeile', (string) ColumnWidths::parse('1_2,1_3')['error']);
|
||||
}
|
||||
|
||||
/** Ruling S49: new rows use only widths the builder offers – 4_5 is no builder column class. */
|
||||
public function testFourFifthsIsNoInsertWidth(): void
|
||||
{
|
||||
self::assertSame(['widths' => ['24_24'], 'error' => 'Spaltenbreite 4_5 gibt es in Divi nicht'], ColumnWidths::parse('1_5,4_5'));
|
||||
self::assertNotNull(ColumnWidths::rowError(['1_5', '4_5']));
|
||||
self::assertSame(['widths' => ['1_5', '2_5', '2_5'], 'error' => null], ColumnWidths::parse('1_5,2_5,2_5'));
|
||||
}
|
||||
|
||||
/** Ruling S43: the builder's column classes. */
|
||||
public function testColumnClassesAreTheBuilderList(): void
|
||||
{
|
||||
|
||||
@@ -157,6 +157,38 @@ final class DiviUpdateAbilityTest extends DiviWriteAbilityTestCase
|
||||
self::assertSame([], $this->saved);
|
||||
}
|
||||
|
||||
/** Ruling S49: tablet/phone (every non-desktop breakpoint) flexTypes are format-checked like desktop. */
|
||||
public function testUpdateChecksTheColumnClassFormatOnOtherBreakpoints(): void
|
||||
{
|
||||
foreach (['tablet', 'phone', 'phoneWide'] as $breakpoint) {
|
||||
foreach (['4_5', '13_25', 'auto'] as $width) {
|
||||
$result = $this->update()->execute(['post_id' => 7, 'tree_rev' => $this->treeRev(), 'changes' => [[
|
||||
'id' => 's0.r0.c0',
|
||||
'attrs' => ['module.decoration.sizing' => [
|
||||
'desktop' => ['flexType' => '8_24'],
|
||||
$breakpoint => ['flexType' => $width],
|
||||
]],
|
||||
]]]);
|
||||
self::assertInstanceOf(WP_Error::class, $result, $breakpoint . ' ' . $width);
|
||||
$message = self::clientError($result)['fields']['changes[0].attrs.module.decoration.sizing'];
|
||||
self::assertStringContainsString($breakpoint, $message);
|
||||
self::assertStringContainsString('none', $message);
|
||||
}
|
||||
}
|
||||
self::assertSame([], $this->saved);
|
||||
|
||||
$valid = $this->update()->execute(['post_id' => 7, 'tree_rev' => $this->treeRev(), 'changes' => [[
|
||||
'id' => 's0.r0.c0',
|
||||
'attrs' => ['module.decoration.sizing' => [
|
||||
'desktop' => ['flexType' => '8_24'],
|
||||
'tablet' => ['flexType' => '24_24'],
|
||||
'phone' => ['flexType' => 'none'],
|
||||
]],
|
||||
]]]);
|
||||
self::assertTrue($valid['ok'], (string) json_encode($valid));
|
||||
self::assertStringContainsString('"tablet":{"value":{"flexType":"24_24"}},"phone":{"value":{"flexType":"none"}}', $this->saved[0]);
|
||||
}
|
||||
|
||||
/** Ruling S43: rows that are no plain exact row are not sum-checked (none, omitted width, wrap). */
|
||||
public function testUpdateAcceptsWidthChangesInLooseRows(): void
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user