2019-05-13 19:05:25 +00:00
|
|
|
import { module, test } from 'qunit';
|
|
|
|
import { setupRenderingTest } from 'ember-qunit';
|
|
|
|
import { render } from '@ember/test-helpers';
|
|
|
|
import hbs from 'htmlbars-inline-precompile';
|
2019-05-16 19:49:38 +00:00
|
|
|
import waitForError from 'vault/tests/helpers/wait-for-error';
|
2019-05-13 19:05:25 +00:00
|
|
|
|
|
|
|
module('Integration | Component | icon', function(hooks) {
|
|
|
|
setupRenderingTest(hooks);
|
|
|
|
|
|
|
|
test('it renders', async function(assert) {
|
|
|
|
await render(hbs`<Icon class="i-con" />`);
|
|
|
|
assert.dom('.i-con').exists('renders');
|
|
|
|
|
|
|
|
await render(hbs`<Icon @glyph="vault-logo" />`);
|
|
|
|
assert.dom('.vault-logo').exists('inlines the SVG');
|
|
|
|
|
|
|
|
await render(hbs`<Icon class="ah" aria-hidden="true" />`);
|
|
|
|
assert.dom('.ah').hasAttribute('aria-hidden', 'true', 'renders aria-hidden');
|
|
|
|
|
|
|
|
await render(hbs`<Icon class="al" aria-label="Testing" />`);
|
|
|
|
assert.dom('.al').hasAttribute('aria-label', 'Testing', 'renders aria-label');
|
2019-05-16 19:49:38 +00:00
|
|
|
|
|
|
|
await render(hbs`<Icon @glyph="vault-logo" @size="s"/>`);
|
|
|
|
assert.dom('.hs-icon').hasClass('hs-icon-s', 'adds the size class');
|
|
|
|
|
|
|
|
let promise = waitForError();
|
|
|
|
render(hbs`<Icon @glyph="vault-logo" @size="no"/>`);
|
|
|
|
let err = await promise;
|
|
|
|
assert.ok(err.message.includes('The size property of'), "errors when passed a size that's not allowed");
|
2019-05-13 19:05:25 +00:00
|
|
|
});
|
|
|
|
});
|