Skip to content

Wait with renderSettled in the renderComponent tests, not run() - #21657

Open
NullVoxPopuli-ai-agent wants to merge 1 commit into
emberjs:mainfrom
NullVoxPopuli-ai-agent:nvp/render-component-test-without-run
Open

NullVoxPopuli-ai-agent wants to merge 1 commit into
emberjs:mainfrom
NullVoxPopuli-ai-agent:nvp/render-component-test-without-run

Conversation

@NullVoxPopuli-ai-agent

Copy link
Copy Markdown
Contributor

render-component-test.ts no longer imports run. Each test calls the API directly and waits with await renderSettled(), as an application does.

This is the first test file in the move away from run(() => ...).

Changes

Before After
run(() => renderComponent(...)) renderComponent(...), then the HTML assertion with no wait. The render is synchronous.
run(() => change()) change(); await renderSettled();
run(() => destroy(x)) destroy(x); await renderSettled();
runDestroy(this) in afterEach destroy(this); await renderSettled();

AbstractStrictTestCase changes too. Its afterEach and assertStableRerender are now async and use renderSettled() in place of runDestroy and runTask. Only this test file extends that class.

No test was added, removed or renamed.

One test keeps its shape: "strict-mode components cannot lookup things in the registry". template() throws at compile time, before the render call, so assert.throws stays.

Verification

  • Tests that match the renderComponent filter: 45 pass in a development build, 43 pass in a production build, 2 skipped in each.
  • Full suite, development build: 9513 tests, 9495 pass, 18 skipped, 0 fail.
  • With await renderSettled() removed from assertChange and from one destroy test, 8 tests fail. The waits do real work.
  • On a trial merge with Render through the scheduler, without the runloop, RSVP, or backburner (RFC 957 end state) #21655, the same 45 tests pass.
  • pnpm type-check:internals, eslint and prettier pass.

Conflict with #21647

#21647 adds tests to this file that use run. The PR that merges second needs an update.

🤖 Generated with Claude Code

The renderComponent tests wrapped each render, update and destroy in
`run(() => ...)`. The tests now call the API directly and wait with
`await renderSettled()`, as an application does.

- `renderComponent()` renders synchronously. The test helper asserts the
  HTML immediately after the call, with no wait.
- Each tracked update and each destroy is followed by
  `await renderSettled()`.
- `AbstractStrictTestCase` no longer uses `runTask` and `runDestroy`.
  Only this test file extends that class.

No test was added, removed or renamed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@NullVoxPopuli

Copy link
Copy Markdown
Contributor

I think this looks good -- best viewed with "Ignore whitespace"

This branch has not been deployed

No deployments
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