open-vault/ui/tests/integration/components/info-table-test.js
Noelle Daley 032ffcaff2
Ui/fix ui tests (#9438)
* fix linting errors

* don't show primary url if we don't have any primaries

* Revert "fix linting errors"

This reverts commit a56d371272868d93024c557a6d5807be6eadda57.

* run all component tests always
2020-07-09 15:04:56 -07:00

37 lines
1.1 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 TITLE = 'My Table';
const HEADER = 'Cool Header';
const ITEMS = ['https://127.0.0.1:8201', 'hello', 3];
module('Integration | Component | InfoTable', function(hooks) {
setupRenderingTest(hooks);
hooks.beforeEach(function() {
this.set('title', TITLE);
this.set('header', HEADER);
this.set('items', ITEMS);
});
test('it renders', async function(assert) {
await render(hbs`<InfoTable
@title={{title}}
@header={{header}}
@items={{items}}
/>`);
assert.dom('[data-test-info-table]').exists();
assert.dom('[data-test-info-table] th').includesText(HEADER, `shows the table header`);
const rows = document.querySelectorAll('.info-table-row');
assert.equal(rows.length, ITEMS.length, 'renders an InfoTableRow for each item');
rows.forEach((row, i) => {
assert.equal(row.innerText, ITEMS[i], 'handles strings and numbers as row values');
});
});
});