feat: Page Editor v1.0 - canonical schema, SSR parity, and migration
Major improvements to WooNooW Page Editor system: Schema & Architecture: - Canonical section schema with unified sectionSchema.ts - Normalized feature-grid to use items (not features) - Standardized default values across all section types - Schema versioning with automatic migration on read Backend (PHP): - Enhanced PlaceholderRenderer with typed output contracts - Added fallback behavior for empty/invalid dynamic sources - Added caching support for post data resolution - New SchemaMigration class for backward compatibility - New Features class for feature flags - Enhanced PageSSR with full style support - Removed controller-level special-casing for related_posts Frontend (Admin SPA): - Updated CanvasRenderer with schema-aware transformation - Enhanced InspectorPanel with canonical schema metadata - Added new section renderers Frontend (Customer SPA): - New section components: BentoCategoryGrid, MarqueeBanner, ProductCarousel, ShoppableImage - Updated FeatureGridSection for items prop contract Testing: - Add PHP tests: SchemaMigrationTest, PlaceholderRendererTest, PageSSRTest - Add TypeScript tests: schema-integration, feature-grid-regression - Add parity tests for React vs SSR content matching - Add CI script: check-schema-drift.mjs - Add VERIFICATION_CHECKLIST.md Documentation: - RELEASE_NOTES-v1.0.md with full release notes - docs/PAGE_EDITOR_SECTION_SCHEMA_V1.md - docs/PAGE_EDITOR_SSR_COVERAGE_AUDIT.md
This commit is contained in:
41
tests/page-editor-fixtures.test.mjs
Normal file
41
tests/page-editor-fixtures.test.mjs
Normal file
@@ -0,0 +1,41 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import { describe, it } from 'node:test';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { resolve } from 'node:path';
|
||||
|
||||
const fixtureDir = resolve('tests/fixtures/page-editor');
|
||||
|
||||
function readFixture(name) {
|
||||
return JSON.parse(readFileSync(resolve(fixtureDir, name), 'utf8'));
|
||||
}
|
||||
|
||||
function assertSectionProp(prop, expectedType = 'static') {
|
||||
assert.equal(typeof prop, 'object');
|
||||
assert.equal(prop.type, expectedType);
|
||||
assert.ok('value' in prop || 'source' in prop);
|
||||
}
|
||||
|
||||
describe('page editor fixtures', () => {
|
||||
it('uses canonical feature-grid.items for v1 fixtures', () => {
|
||||
const fixture = readFixture('feature-grid-v1.json');
|
||||
const section = fixture.sections[0];
|
||||
|
||||
assert.equal(fixture.schemaVersion, 1);
|
||||
assert.equal(section.type, 'feature-grid');
|
||||
assertSectionProp(section.props.heading);
|
||||
assertSectionProp(section.props.items);
|
||||
assert.ok(Array.isArray(section.props.items.value));
|
||||
assert.equal(section.props.features, undefined);
|
||||
});
|
||||
|
||||
it('keeps a legacy feature-grid.features fixture for migration coverage', () => {
|
||||
const fixture = readFixture('feature-grid-legacy-features.json');
|
||||
const section = fixture.sections[0];
|
||||
|
||||
assert.equal(fixture.schemaVersion, 0);
|
||||
assert.equal(section.type, 'feature-grid');
|
||||
assertSectionProp(section.props.heading);
|
||||
assertSectionProp(section.props.features);
|
||||
assert.ok(Array.isArray(section.props.features.value));
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user