2023-03-15 16:00:52 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*/
|
|
|
|
|
2020-02-13 19:44:57 +00:00
|
|
|
import { module, test } from 'qunit';
|
|
|
|
import { setupRenderingTest } from 'ember-qunit';
|
|
|
|
import { render } from '@ember/test-helpers';
|
|
|
|
import hbs from 'htmlbars-inline-precompile';
|
|
|
|
|
|
|
|
const TOTAL = 15;
|
2022-06-02 20:40:04 +00:00
|
|
|
const CARD_TITLE = 'Connections';
|
2020-02-13 19:44:57 +00:00
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
module('Integration | Component selectable-card', function (hooks) {
|
2020-02-13 19:44:57 +00:00
|
|
|
setupRenderingTest(hooks);
|
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
hooks.beforeEach(function () {
|
2020-02-13 19:44:57 +00:00
|
|
|
this.set('total', TOTAL);
|
|
|
|
this.set('cardTitle', CARD_TITLE);
|
|
|
|
});
|
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
test('it shows the card total', async function (assert) {
|
2022-10-18 15:46:02 +00:00
|
|
|
await render(hbs`<SelectableCard @total={{this.total}} @cardTitle={{this.cardTitle}}/>`);
|
2022-11-09 23:15:31 +00:00
|
|
|
const titleNumber = this.element.querySelector('.title-number').innerText;
|
2020-02-13 19:44:57 +00:00
|
|
|
|
2022-10-18 15:46:02 +00:00
|
|
|
assert.strictEqual(titleNumber, '15');
|
2020-02-13 19:44:57 +00:00
|
|
|
});
|
|
|
|
|
2022-06-02 20:40:04 +00:00
|
|
|
test('it returns card title, ', async function (assert) {
|
2022-10-18 15:46:02 +00:00
|
|
|
await render(hbs`<SelectableCard @total={{1}} @cardTitle={{this.cardTitle}}/>`);
|
2022-11-09 23:15:31 +00:00
|
|
|
const titleText = this.element.querySelector('.title').innerText;
|
2022-10-18 15:46:02 +00:00
|
|
|
assert.strictEqual(titleText, 'Connections');
|
2020-02-13 19:44:57 +00:00
|
|
|
});
|
|
|
|
});
|