2023-03-01 09:39:41 -06:00
|
|
|
/**
|
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
*/
|
|
|
|
|
|
2022-04-28 08:49:37 -07:00
|
|
|
import { module, test } from 'qunit';
|
|
|
|
|
import { setupRenderingTest } from 'ember-qunit';
|
|
|
|
|
import { render, find, click } from '@ember/test-helpers';
|
2023-01-11 08:55:35 -08:00
|
|
|
import { hbs } from 'ember-cli-htmlbars';
|
2022-04-28 08:49:37 -07:00
|
|
|
|
2022-04-28 17:49:03 -04:00
|
|
|
module('Integration | Component | loading-button', function (hooks) {
|
2022-04-28 08:49:37 -07:00
|
|
|
setupRenderingTest(hooks);
|
|
|
|
|
test('it renders', async function (assert) {
|
2022-04-28 17:49:03 -04:00
|
|
|
await render(hbs`<LoadingButton />`);
|
|
|
|
|
assert.ok(find('.loading-button'));
|
2022-04-28 08:49:37 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('it executes a function on refresh button click', async function (assert) {
|
|
|
|
|
assert.expect(2);
|
|
|
|
|
this.onClick = () => assert.ok(true, 'refresh was clicked');
|
2023-10-27 11:10:30 -04:00
|
|
|
await render(hbs`<LoadingButton @onClick={{this.onClick}} />`);
|
2022-04-28 17:49:03 -04:00
|
|
|
assert.ok(find('.loading-button'));
|
2022-04-28 08:49:37 -07:00
|
|
|
await click('button');
|
|
|
|
|
});
|
|
|
|
|
});
|