Omit the class description when the group block shows one class
CI / Tests (PHP 8.1) (pull_request) Successful in 1m29s
CI / Tests (PHP 8.2) (pull_request) Successful in 1m40s
CI / No Debug Code (pull_request) Successful in 2s
CI / PHPStan (pull_request) Successful in 3m1s
CI / Coding Standards (pull_request) Successful in 3m28s
CI / Tests (PHP 8.3) (pull_request) Successful in 2m49s
CI / Build Plugin Zip (pull_request) Skipped
CI / Tests (PHP 8.1) (pull_request) Successful in 1m29s
CI / Tests (PHP 8.2) (pull_request) Successful in 1m40s
CI / No Debug Code (pull_request) Successful in 2s
CI / PHPStan (pull_request) Successful in 3m1s
CI / Coding Standards (pull_request) Successful in 3m28s
CI / Tests (PHP 8.3) (pull_request) Successful in 2m49s
CI / Build Plugin Zip (pull_request) Skipped
The Group Classes block can be pinned to a single class via its Class option so it can be embedded on a page dedicated to that class. On such a page the surrounding copy already describes the class, so the card repeated it. In single-class mode the description is now left out and the card shows only the schedule, instructor, schedule note, price, enrolment deadline and the enrol/withdraw controls. The editor preview follows the same rule: BlockPreview::groupClasses() takes the mode from the block's offeringId attribute, drops the sample description when a class is pinned, and notes what the published page shows. Its sample card also gained the .us-class-when and .us-enrol-deadline elements the live markup has always rendered. Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
@@ -29,6 +29,17 @@ class BlockPreviewTest extends TestCase
|
||||
self::assertStringContainsString('class="us-class"', $html);
|
||||
self::assertStringContainsString('class="us-enrol-btn" disabled', $html);
|
||||
self::assertStringContainsString('us-editor-note', $html);
|
||||
self::assertStringContainsString('A sample class shown so the page can be styled.', $html);
|
||||
}
|
||||
|
||||
public function testSingleClassGroupPreviewDropsTheDescriptionButKeepsScheduleAndEnrolment(): void
|
||||
{
|
||||
$html = BlockPreview::groupClasses(true);
|
||||
|
||||
self::assertStringNotContainsString('A sample class shown so the page can be styled.', $html);
|
||||
self::assertStringContainsString('class="us-class-when"', $html);
|
||||
self::assertStringContainsString('class="us-enrol-deadline"', $html);
|
||||
self::assertStringContainsString('class="us-enrol-btn" disabled', $html);
|
||||
}
|
||||
|
||||
public function testLoginPreviewIncludesTheRealLoginTemplate(): void
|
||||
|
||||
@@ -179,6 +179,19 @@ class BlockRegistrarTest extends TestCase
|
||||
self::assertStringContainsString('us-group-app', $this->registrar->renderGroupClasses());
|
||||
}
|
||||
|
||||
public function testEditorPreviewOfAPinnedGroupClassOmitsTheDescription(): void
|
||||
{
|
||||
$this->registrar->preview = true;
|
||||
$this->groupClassPage->shouldNotReceive('render');
|
||||
|
||||
$all = $this->registrar->renderGroupClasses();
|
||||
$single = $this->registrar->renderGroupClasses(['offeringId' => 12]);
|
||||
|
||||
self::assertStringContainsString('A sample class shown so the page can be styled.', $all);
|
||||
self::assertStringNotContainsString('A sample class shown so the page can be styled.', $single);
|
||||
self::assertStringContainsString('us-enrol-deadline', $single);
|
||||
}
|
||||
|
||||
public function testIsEditorPreviewIsFalseOutsideRestRequests(): void
|
||||
{
|
||||
// REST_REQUEST is undefined in the test process, so the real
|
||||
|
||||
Reference in New Issue
Block a user