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';
|
|
|
|
import waitForError from 'vault/tests/helpers/wait-for-error';
|
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
module('Integration | Component | chevron', function (hooks) {
|
2019-05-13 19:05:25 +00:00
|
|
|
setupRenderingTest(hooks);
|
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
test('it renders', async function (assert) {
|
2019-05-13 19:05:25 +00:00
|
|
|
// Set any properties with this.set('myProperty', 'value');
|
|
|
|
// Handle any actions with this.set('myAction', function(val) { ... });
|
|
|
|
|
|
|
|
await render(hbs`<Chevron />`);
|
2021-12-07 17:05:14 +00:00
|
|
|
assert.dom('.flight-icon').exists('renders');
|
2019-05-13 19:05:25 +00:00
|
|
|
|
|
|
|
await render(hbs`<Chevron @isButton={{true}} />`);
|
2021-12-07 17:05:14 +00:00
|
|
|
assert.dom('.flight-icon').hasClass('hs-icon-button-right', 'renders');
|
2019-05-13 19:05:25 +00:00
|
|
|
|
|
|
|
await render(hbs`<Chevron @direction='left' @isButton={{true}} />`);
|
2021-12-07 17:05:14 +00:00
|
|
|
assert.dom('.flight-icon').doesNotHaveClass('hs-icon-button-right', 'renders');
|
2019-05-13 19:05:25 +00:00
|
|
|
|
2022-11-09 23:15:31 +00:00
|
|
|
const promise = waitForError();
|
2019-05-13 19:05:25 +00:00
|
|
|
render(hbs`<Chevron @direction='lol' />`);
|
2022-11-09 23:15:31 +00:00
|
|
|
const err = await promise;
|
2019-05-13 19:05:25 +00:00
|
|
|
assert.ok(
|
|
|
|
err.message.includes('The direction property of <vault@component:chevron:'),
|
|
|
|
'asserts about unsupported direction'
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|