Skip to content

Commit

Permalink
Merge pull request #739 from mkszepp/improve-wormhole
Browse files Browse the repository at this point in the history
Allow passing attributes in wormhole component & add tests for wormhole
  • Loading branch information
mkszepp authored Jan 13, 2024
2 parents c0ada87 + e64e4a3 commit d7c5e88
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<div id={{this.getDestinationId}}></div>
<div id={{this.getDestinationId}} ...attributes></div>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import Component from '@glimmer/component';
import { macroCondition, isTesting } from '@embroider/macros';
import config from 'ember-get-config';

export default class BasicDropdownWormholeComponent extends Component {
export interface BasicDropdownWormholeSignature {
Element: Element;
}

export default class BasicDropdownWormholeComponent extends Component<BasicDropdownWormholeSignature> {
get getDestinationId(): string {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const _config = config as unknown as any;
Expand Down
3 changes: 3 additions & 0 deletions test-app/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ module.exports = {
// test files
files: ['tests/**/*-test.{js,ts}'],
extends: ['plugin:qunit/recommended'],
rules: {
'qunit/require-expect': 'off',
},
},
],
};
4 changes: 4 additions & 0 deletions test-app/.template-lintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@

module.exports = {
extends: 'recommended',
rules: {
'no-inline-styles': false,
'no-positive-tabindex': false,
},
};
5 changes: 2 additions & 3 deletions test-app/tests/integration/components/basic-dropdown-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
waitUntil,
find,
} from '@ember/test-helpers';
import { settled } from '@ember/test-helpers';

let deprecations = [];

Expand Down Expand Up @@ -278,7 +277,7 @@ module('Integration | Component | basic-dropdown', function (hooks) {
`);

await click('.ember-basic-dropdown-trigger');

assert
.dom('.ember-basic-dropdown-trigger')
.hasClass(
Expand Down Expand Up @@ -922,7 +921,7 @@ module('Integration | Component | basic-dropdown', function (hooks) {
</parent.Content>
</BasicDropdown>
`);

//open the nested dropdown
await click('.ember-basic-dropdown-trigger.parent');
assert.dom('.body-parent').exists('the parent dropdown is rendered');
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { hbs } from 'ember-cli-htmlbars';
import { render } from '@ember/test-helpers';

module('Integration | Component | basic-dropdown-wormhole', function (hooks) {
setupRenderingTest(hooks);

test('Is present', async function (assert) {
await render(hbs`
<BasicDropdownWormhole />
`);

assert.dom('#ember-testing').exists('wormhole is present');
});

test('Has class my-custom-class', async function (assert) {
await render(hbs`
<BasicDropdownWormhole class="my-custom-class" />
`);

assert.dom('.my-custom-class').exists('my-custom-class was set');
});
});

0 comments on commit d7c5e88

Please sign in to comment.