Skip to content

Use native classes in routing tests that are not about classic classes - #21691

Merged
NullVoxPopuli merged 2 commits into
emberjs:mainfrom
NullVoxPopuli-ai-agent:nvp/routing-tests-native-classes
Oct 11, 2026
Merged

NullVoxPopuli merged 2 commits into
emberjs:mainfrom
NullVoxPopuli-ai-agent:nvp/routing-tests-native-classes

Conversation

@NullVoxPopuli-ai-agent

@NullVoxPopuli-ai-agent NullVoxPopuli-ai-agent commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Tests about routing, locations and the router service stop using the classic object model. Only test files and one test harness file change.

Why this is a separate PR

This PR does for classic classes what #21690 does for A().

#21673 deprecates .extend(), reopen() and reopenClass() (RFC 1117). The spike #21674 deprecates EmberObject, its get and set methods, and computed (RFC 1234). A test that is about one of those APIs keeps it, expects the deprecation, and has a removal guard. A test that is about a feature that stays must not use them.

The 13 files here are in the second group. This PR has no dependency on a deprecation, so it can merge first. After it merges, these files drop out of #21673.

Changes

Route.extend({ ... })            class extends Route { ... }
Router.reopen({ location })      this.subclass('router:main', (Router) => class extends Router { ... })
instance.reopen({ method })      instance.method = ...
Class.reopenClass({ compare })   static compare
router.get('location.path')      router.location.path
controller.set('page', 2)        set(controller, 'page', 2)
EmberObject fixture              plain class
@computed get x()                get x()
  • ember/tests/routing/router_service_test/: basic_test, recognize_test, transitionTo_test
  • ember/tests/routing/query_params_test/: model_dependent_state_with_query_params_test, overlapping_query_params_test
  • ember/tests/routing/decoupled_basic_test
  • @ember/routing/tests/location/: history_location_test, none_location_test
  • @ember/routing/tests/system/dsl_test
  • attrs-lookup-test, @ember/utils/tests/compare_test: only .extend() and reopenClass() go. These tests are about classic components and about EmberObject values.
  • @ember/utils/tests/type_of_test: the assertion for a classic class stays, and a new assertion covers a native class.

New in the test harness: subclass(specifier, build) on the application test case. The registry caches a class after the first lookup, so the helper removes the registration before it adds the subclass.

Not in this PR

Test results

Local runs of the full suite on this branch. The number of tests is the same as on main.

default                         9272 pass, 18 skip, 0 fail
ALL_DEPRECATIONS_ENABLED=true   9272 pass, 18 skip, 0 fail

tsc --noEmit, eslint and prettier --check pass on the changed files.

🤖 Generated with Claude Code

NullVoxPopuli and others added 2 commits October 11, 2026 08:13
These tests are about routing, locations and the router service.
They used `.extend()`, `reopen()`, the `get` and `set` methods,
`EmberObject` fixtures and `computed` only for historical reasons.

- `.extend()` and `reopen()` become native classes and assignments.
- The `get` method becomes a property read.
- The `set` method becomes the `set` function.
- `EmberObject` fixtures become plain classes.
- `subclass()` on the application test case replaces a registration
  with a subclass of it.

The classic class changes come from emberjs#21673, so that PR can show only
the deprecation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`typeOf` must return 'class' for a classic class and for a native
class. The test now has one assertion for each.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@NullVoxPopuli
NullVoxPopuli merged commit 313c24b into emberjs:main Oct 11, 2026
70 checks passed
@NullVoxPopuli
NullVoxPopuli deleted the nvp/routing-tests-native-classes branch October 11, 2026 15:46
@github-actions github-actions Bot mentioned this pull request Oct 11, 2026
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.

3 participants