Skip to content

Commit

Permalink
fix ember-classic scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
ro0gr committed Jan 20, 2024
1 parent 2d190c6 commit 90170ae
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions test-app/tests/unit/-private/query-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Query } from 'ember-cli-page-object/-private/query';
import { setupRenderingTest } from '../../helpers';
// @ts-expect-error test-only private import
import Locator from 'ember-cli-page-object/-private/query/locator';
import { getRootElement } from '@ember/test-helpers';

const renderList = (testContext, options) => {
return testContext.createTemplate(
Expand Down Expand Up @@ -33,9 +34,14 @@ module('Unit | -private/query', function (hooks) {
</div>`);

assert.equal(q.toString(), ':first-child:eq(0)');

// due to ember-classic scenario to enable the application-template-wrapper
// we have one extra element in the DOM, which prevents us from using the hard-coded expected selector
const firstChild = getRootElement().querySelector(':first-child');
assert.deepEqual(
q.all().map((e) => e.id),
['root']
// for all the scenarios, but ember-classic it must be ['root']
[firstChild.id]
);
});

Expand Down Expand Up @@ -165,9 +171,13 @@ module('Unit | -private/query', function (hooks) {

await renderPlayground(this);

// due to ember-classic scenario to enable the application-template-wrapper
// we have one extra element in the DOM, which prevents us from using the hard-coded expected selector
const firstChild = getRootElement().querySelector(':first-child');
assert.deepEqual(
q.all().map((el) => el.id),
['root1']
// for all the scenarios, but ember-classic it must be ['root']
[firstChild.id]
);
assert.equal(q.toString(), ':first-child:eq(0)');
});
Expand Down

0 comments on commit 90170ae

Please sign in to comment.