Skip to content

Commit

Permalink
added simple integration test for hds-register-event
Browse files Browse the repository at this point in the history
  • Loading branch information
didoo committed Mar 26, 2024
1 parent a35cdc4 commit c074144
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions showcase/tests/integration/modifiers/hds-register-event-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/

import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { click, render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';

module('Integration | Modifier | hds-register-event', function (hooks) {
setupRenderingTest(hooks);

test('it calls the callback associated with the `click` event assigned via the modifier', async function (assert) {
let clicked;
this.set('onClick', () => (clicked = true));
await render(
hbs`<button id="test-button" {{hds-register-event 'click' this.onClick}}>Test</button>`
);
await click('button#test-button');
assert.true(clicked);
});
});

0 comments on commit c074144

Please sign in to comment.