Skip to content

Tests: cover wizard appearance preview script#119

Open
RCowles wants to merge 2 commits intotrunkfrom
test/wizard-appearance-js-coverage
Open

Tests: cover wizard appearance preview script#119
RCowles wants to merge 2 commits intotrunkfrom
test/wizard-appearance-js-coverage

Conversation

@RCowles
Copy link
Copy Markdown
Contributor

@RCowles RCowles commented May 10, 2026

Summary

  • Replace the placeholder Jest smoke test with jsdom coverage for the wizard appearance preview script.
  • Cover initial stale-markup correction, actor/blog/actor+blog mode changes, missing-radio no-op behavior, and DOMContentLoaded initialization.

Testing

  • pnpm test
  • pnpm run lint
  • pnpm run format:check

Copilot AI review requested due to automatic review settings May 10, 2026 15:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Replaces the placeholder Jest smoke test with focused jsdom unit coverage for the onboarding wizard “Appearance” preview toggling script.

Changes:

  • Added jsdom tests for wizard-appearance.js covering initialization, stale-markup correction, mode switching, and DOMContentLoaded timing.
  • Removed the no-op jest runs placeholder test.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/js/wizard-appearance.test.js Adds DOM-based unit tests for the wizard appearance preview/handle toggling behavior.
tests/js/fosse.test.js Removes the placeholder Jest smoke test.

Comment on lines +25 to +34
function loadScript( readyState = 'complete' ) {
Object.defineProperty( document, 'readyState', {
value: readyState,
configurable: true,
} );

jest.isolateModules( () => {
require( '../../src/Admin/assets/js/wizard-appearance.js' );
} );
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 2477202: loadScript() now captures the original document.readyState descriptor before overriding it and restores that descriptor in a finally block after requiring wizard-appearance.js. The DOMContentLoaded-path test still passes because the listener is registered during the temporary loading override.

Verified locally with:

  • pnpm test -- tests/js/wizard-appearance.test.js
  • pnpm test
  • pnpm run lint
  • pnpm run format:check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants