Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests on ember v6+ #1179

Merged
merged 1 commit into from
Sep 14, 2024
Merged
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
22 changes: 17 additions & 5 deletions test-app/tests/integration/setup-rendering-test-test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
/* eslint-disable ember/no-classic-components */
import { module, test } from 'qunit';
import Component from '@ember/component';
import Component, { setComponentTemplate } from '@ember/component';
import templateOnly from '@ember/component/template-only';
import { helper } from '@ember/component/helper';
import { hbs } from 'ember-cli-htmlbars';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { macroCondition, dependencySatisfies } from '@embroider/macros';

module('setupRenderingTest tests', function (hooks) {
setupRenderingTest(hooks);
Expand All @@ -16,10 +18,20 @@ module('setupRenderingTest tests', function (hooks) {
});

test('can invoke template only components', async function (assert) {
this.owner.register(
'template:components/template-only',
hbs`template-only component here`
);
if (
macroCondition(dependencySatisfies('ember-source', '>= 6.0.0-alpha.0'))
) {
this.owner.register(
'component:template-only',
setComponentTemplate(hbs`template-only component here`, templateOnly())
);
} else {
this.owner.register(
'template:components/template-only',
hbs`template-only component here`
);
}

await render(hbs`<TemplateOnly />`);

assert.strictEqual(
Expand Down