2021-08-16 18:55:12 +00:00
|
|
|
import { module, test } from 'qunit';
|
|
|
|
import { setupRenderingTest } from 'ember-qunit';
|
2021-10-26 23:10:09 +00:00
|
|
|
import { render, settled } from '@ember/test-helpers';
|
2021-08-16 18:55:12 +00:00
|
|
|
import { hbs } from 'ember-cli-htmlbars';
|
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
module('Integration | Component | StatText', function (hooks) {
|
2021-08-16 18:55:12 +00:00
|
|
|
setupRenderingTest(hooks);
|
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
test('it renders', async function (assert) {
|
2021-08-16 18:55:12 +00:00
|
|
|
await render(hbs`<StatText />`);
|
|
|
|
|
|
|
|
assert.dom('[data-test-stat-text-container]').exists('renders element');
|
|
|
|
});
|
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
test('it renders passed in attributes', async function (assert) {
|
2021-08-16 18:55:12 +00:00
|
|
|
this.set('label', 'A Label');
|
2021-10-26 23:10:09 +00:00
|
|
|
this.set('value', 'A value');
|
2021-08-16 18:55:12 +00:00
|
|
|
this.set('size', 'l');
|
|
|
|
this.set('subText', 'This is my description');
|
|
|
|
|
|
|
|
await render(
|
|
|
|
hbs`<StatText @label={{this.label}} @size={{this.size}} @value={{this.value}} @subText={{this.subText}}/>`
|
|
|
|
);
|
|
|
|
assert.dom('.stat-label').hasText(this.label, 'renders label');
|
|
|
|
assert.dom('.stat-text').hasText(this.subText, 'renders subtext');
|
2021-10-26 23:10:09 +00:00
|
|
|
assert.dom('.stat-value').hasText(this.value, 'renders a non-integer value');
|
|
|
|
|
|
|
|
this.set('value', 604099);
|
|
|
|
await settled();
|
|
|
|
|
|
|
|
let formattedNumber = '604,099';
|
|
|
|
assert.dom('.stat-value').hasText(formattedNumber, 'renders correctly formatted integer value');
|
2021-08-16 18:55:12 +00:00
|
|
|
});
|
|
|
|
});
|