vault/ui/tests/integration/components/overview-card-test.js
Kianna 11f6aad2b2
ui: VAULT-6511 PKI Overview Page (#18599)
* Inital pki overview page code setup

* Add more properties to pki-overview

* Remove previous selectable card component and update template

* Add capability check for roles and issuers

* Add acceptance tests for overview page

* Update SelectableCardForm component

* Code refactor!

* Add selectable-card-form test

* More code cleanup and move function to test helper file

* Address most feedback. Pending refactor of issue certificate card!

* Add integration test

* Moves form to SelectableCard and add tests

* Add jsdoc props to SelectableCard and fix placeholder

* Move back SelectableCard

* Covert to typescript and finish up tests

* Dont use try catch for hasConfig

* Add overview card test

* More overview card tests

* Address feedback!
2023-01-17 13:30:31 -08:00

35 lines
1.3 KiB
JavaScript

import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
const CARD_TITLE = 'Card title';
const ACTION_TEXT = 'View card';
const SUBTEXT = 'This is subtext for card';
module('Integration | Component overview-card', function (hooks) {
setupRenderingTest(hooks);
hooks.beforeEach(function () {
this.set('cardTitle', CARD_TITLE);
this.set('actionText', ACTION_TEXT);
this.set('subText', SUBTEXT);
});
test('it returns card title, ', async function (assert) {
await render(hbs`<OverviewCard @cardTitle={{this.cardTitle}}/>`);
const titleText = this.element.querySelector('.title').innerText;
assert.strictEqual(titleText, 'Card title');
});
test('it returns card subtext, ', async function (assert) {
await render(hbs`<OverviewCard @cardTitle={{this.cardTitle}} @subText={{this.subText}} />`);
const titleText = this.element.querySelector('p').innerText;
assert.strictEqual(titleText, 'This is subtext for card');
});
test('it returns card action text', async function (assert) {
await render(hbs`<OverviewCard @cardTitle={{this.cardTitle}} @actionText={{this.actionText}}/>`);
const titleText = this.element.querySelector('a').innerText;
assert.strictEqual(titleText, 'View card ');
});
});