Repository navigation
Migrate five more glimmer integration tests to plain .gjs tests with setupRenderingTest - #21672
Merged
NullVoxPopuli merged 2 commits intoOct 9, 2026
Conversation
A separate commit keeps the file history, because git does not detect the rename after the rewrite. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
||
| class Subject extends Component { | ||
| @tracked count = 0; | ||
| await assert.stableRender('subject'); |
Contributor
There was a problem hiding this comment.
I've decided for any of our custom, low-level, asserts, I'm going to make new helpers for the modern syntax here -- I don't think we'll have too many of these
NullVoxPopuli-ai-agent
force-pushed
the
nvp/vanilla-gjs-tests-2
branch
from
October 8, 2026 14:15
b2148b9 to
8afb856
Compare
Contributor
|
I don't like that the new stableRender helper is weaker than what the old one tested. It's trying to see what happens after some unrelated change causes a re-render. We do need to force re-render, but I think we can do it without any private API just by writing any piece of tracked state. You can confirm that it's working by resolving a promise in afterRender. |
The tests now use module and test from qunit, setupRenderingTest from ember-qunit, and render and settled from @ember/test-helpers. No test is added, removed or renamed. Two additions support the tests: - qunit-dom is a dev dependency, for assert.dom().hasText() after an update. - assert.stableRender() records the DOM nodes, waits for settled(), then checks that each node is the same node. With a string, it also compares the rendered HTML. It replaces assertStableRerender() and the expect option of renderComponent() of RenderingTestCase. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
NullVoxPopuli-ai-agent
force-pushed
the
nvp/vanilla-gjs-tests-2
branch
from
October 9, 2026 17:10
8afb856 to
616437f
Compare
ef4
approved these changes
Oct 9, 2026
Closed
ef4
added a commit
that referenced
this pull request
Oct 19, 2026
…-tests-layout Format the templates of the plain glimmer integration tests from #21672
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Five more test files now use
module,test,setupRenderingTest,renderandsettled, in the style of #21659.No test was added, removed or renamed. The module names are the same.
Files
integration/custom-helper-test.gjsintegration/helpers/if-laziness-test.gjsintegration/components/glimmer-component-test.gjsintegration/helpers/log-test.js, renamed to.gjsintegration/helpers/concat-test.js, renamed to.gjsWhat changed in each test
runTask(() => ...)is now an assignment andawait settled().this.assertText(x)after an update is nowassert.dom().hasText(x), orassert.dom().hasNoText()for no text.set(this.context, ...)is now an assignment to a@trackedfield.this.render('...', context)is nowawait render(<template>...</template>).internal-test-helpers.qunit-domThis PR adds
qunit-dom^3.6.0(the version of the smoke tests) as a dev dependency.setup-test-helpers.jscalls itssetup()withgetRootElementfrom@ember/test-helpers, soassert.dom()with no argument is the rendered element.assert.stableRender()assertStableRerender()ofRenderingTestCasehas no equivalent in a plain test, so this PR adds a QUnit assertion for it. The definition is ininternal-test-helpers/lib/ember-dev/setup-test-helpers.js.The assertion does these steps:
trackedValue()that no template reads. A write to any tracked state makes the renderer run an update pass over every root, so this is an unrelated change that causes a new render.afterRenderqueue, then forsettled().With a string, it also compares the rendered HTML with the string. This is the
expectoption ofrenderComponent(), and it uses the same token comparison asassertHTML().The old
this.rerender()also dirtied the tag of the classic test component. A plain test has no such component, so the unrelated write is the equivalent. An update step tests reactivity, so it stays an assignment,await settled()andassert.dom().hasText().Semantic differences
assertStableRerender()is nowawait assert.stableRender(). EachrenderComponent(X, { expect })is nowrender()andawait assert.stableRender(expect).assertText(x)came before a stable check, the test now usesawait assert.stableRender(x). That compares HTML, not text.runTask(() => this.rerender())inconcat-testare gone.assert.dom().hasText()trims the text and collapses white space.assertText()compared the exacttextContent.if-laziness-test: afterassert.stableRender(), the test also changes a tracked value in the same template, then checks that the helper did not run.log-test: the tests for a property and forthisuse a@glimmer/componentclass. Before,thiswas the classic component ofRenderingTestCase.concat-test: the model is a class with@trackedfields. Before, it was a plain object changed withset. Thex-eqhelper is now a plain function in scope.custom-helper-test:Helpercomes from@ember/component/helper, not from the relative../../index.Checks
ALL_DEPRECATIONS_ENABLED=true.assert.stableRender()fails when a text node is replaced between the snapshot and the check, and the string form fails on a wrong string. I tried both on earlier versions of this branch.renderqueue and theafterRenderqueue run before the promise resolves.pnpm vite devloadsqunit-domand theconcat-testmodule passes there.tsc --noEmit,eslintandprettier --checkpass.🤖 Generated with Claude Code