Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/strict-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export class StrictResolver implements Resolver {
#modules = new Map<string, unknown>();
#plurals = new Map<string, string>();
original: any;
moduleBasedResolver = true;

constructor(
modules: Record<string, unknown>,
Expand Down Expand Up @@ -71,9 +72,9 @@ export class StrictResolver implements Resolver {
(type === 'template' && name.indexOf('components/') === 0)
) {
return name.replace(/_/g, '-');
} else {
return dasherize(name.replace(/\./g, '/'));
}

return dasherize(name.replace(/\./g, '/'));
}

#resolveSelf(type: string, name: string): Result {
Expand Down
28 changes: 28 additions & 0 deletions tests/registry-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,32 @@ module('Registry', function (hooks) {

assert.strictEqual(value.two, 2);
});

test('has an application_loading substate template', function (assert) {
// @ts-expect-error private API
const instance = [...this.owner.application._applicationInstances][0];
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
instance.setupRouter();
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
const routerHasRoute = instance.router.hasRoute('application_loading');
const template = this.owner.factoryFor('template:application_loading');
const route = this.owner.factoryFor('route:application_loading');

assert.ok(routerHasRoute, 'router has route');
assert.ok(template || route, 'has template or route');
});

test('has an application_error substate template', function (assert) {
// @ts-expect-error private API
const instance = [...this.owner.application._applicationInstances][0];
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
instance.setupRouter();
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
const routerHasRoute = instance.router.hasRoute('application_error');
const template = this.owner.factoryFor('template:application_error');
const route = this.owner.factoryFor('route:application_error');

assert.ok(routerHasRoute, 'router has route');
assert.ok(template || route, 'has template or route');
});
});
7 changes: 7 additions & 0 deletions tests/test-helper.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import EmberApp from '#src/index.ts';
import Service from '@ember/service';
import EmberRouter from '@ember/routing/router';
import Component from '@glimmer/component';
import * as QUnit from 'qunit';
import { setApplication } from '@ember/test-helpers';
import { setup } from 'qunit-dom';
Expand All @@ -14,12 +15,18 @@ class Router extends EmberRouter {
location = 'none';
rootURL = '/';
}
// eslint-disable-next-line ember/no-empty-glimmer-component-classes
class ApplicationLoadingComponent extends Component {}
// eslint-disable-next-line ember/no-empty-glimmer-component-classes
class ApplicationErrorComponent extends Component {}

class TestApp extends EmberApp {
modules = {
'./router': { default: Router },
'./services/manual': { default: Manual },
'./services/manual-shorthand': Manual,
'./templates/application-loading': ApplicationLoadingComponent,
'./templates/application-error': ApplicationErrorComponent,
...import.meta.glob('./services/*', { eager: true }),
};
}
Expand Down
Loading