Skip to content

Commit

Permalink
fix object inspector test
Browse files Browse the repository at this point in the history
  • Loading branch information
Bing Dai committed Oct 16, 2021
1 parent bff944b commit 4b2870a
Showing 1 changed file with 32 additions and 6 deletions.
38 changes: 32 additions & 6 deletions tests/ember_debug/object-inspector-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import hasEmberVersion from '@ember/test-helpers/has-ember-version';
import { compareVersion } from 'ember-debug/utils/version';
import EmberDebug from 'ember-debug/main';
import setupEmberDebugTest from '../helpers/setup-ember-debug-test';
import EmberRoute from '@ember/routing/route';
import Controller from '@ember/controller';

const GlimmerComponent = (function () {
try {
Expand Down Expand Up @@ -72,9 +74,25 @@ async function inspectObject(object) {
}

module('Ember Debug - Object Inspector', function (hooks) {
setupEmberDebugTest(hooks);
setupEmberDebugTest(hooks, {
routes() {
this.route('simple')
}
});

hooks.beforeEach(async function () {
this.owner.register('route:application', EmberRoute);

this.owner.register('controller:application', Controller);

this.owner.register(
'template:application',
hbs(
'<div class="application" style="line-height: normal;">{{outlet}}</div>',
{ moduleName: 'my-app/templates/application.hbs' }
)
);
this.owner.register('route:simple', EmberRoute);
this.owner.register('component:x-simple', Component);
this.owner.register(
'template:simple',
Expand Down Expand Up @@ -1117,7 +1135,7 @@ module('Ember Debug - Object Inspector', function (hooks) {
test('Inspecting GlimmerComponent does not cause errors', async function (assert) {
let instance;

class FooComponent extends GlimmerComponent {
class Foo extends GlimmerComponent {
constructor(...args) {
super(...args);
instance = this;
Expand All @@ -1134,14 +1152,22 @@ module('Ember Debug - Object Inspector', function (hooks) {
}
}

this.owner.register('component:foo', FooComponent);
this.owner.register('template:simple', hbs`<Foo />`);
this.owner.register('template:simple', hbs`<Foo />`, {
moduleName: 'my-app/templates/simple.hbs',
});

this.owner.register('component:foo', Foo);
this.owner.register(
`template:components/foo`,
hbs('text only', {
moduleName: 'my-app/templates/components/foo.hbs',
})
);
await visit('/simple');

assert.ok(
instance instanceof FooComponent,
'an instance of FooComponent has been created'
instance instanceof Foo,
'an instance of Foo has been created'
);

let { details, errors } = await inspectObject(instance);
Expand Down

0 comments on commit 4b2870a

Please sign in to comment.