572fb826be
* allow passing a path for options so that it can be extracted from the model * add cred type selector for the aws generate form * style hint text on generate creds form * add tests for aws-credential adapter * allow for the case where we might have zero ttl * show error for TTL picker if a non-number is entered for the duration part of the TTL * fix positioning of tooltips * fix ttl rendering with invalid input for initialValue
32 lines
1.2 KiB
JavaScript
32 lines
1.2 KiB
JavaScript
import { module, test } from 'qunit';
|
|
import { setupRenderingTest } from 'ember-qunit';
|
|
import { render, fillIn } from '@ember/test-helpers';
|
|
import hbs from 'htmlbars-inline-precompile';
|
|
import sinon from 'sinon';
|
|
|
|
module('Integration | Component | ttl picker', function(hooks) {
|
|
setupRenderingTest(hooks);
|
|
|
|
hooks.beforeEach(function() {
|
|
this.changeSpy = sinon.spy();
|
|
this.set('onChange', this.changeSpy);
|
|
});
|
|
|
|
test('it renders error on non-number input', async function(assert) {
|
|
await render(hbs`<TtlPicker @onChange={{onChange}} />`);
|
|
|
|
let callCount = this.changeSpy.callCount;
|
|
await fillIn('[data-test-ttl-value]', 'foo');
|
|
assert.equal(this.changeSpy.callCount, callCount, "it did't call onChange again");
|
|
assert.dom('[data-test-ttl-error]').includesText('Error', 'renders the error box');
|
|
|
|
await fillIn('[data-test-ttl-value]', '33');
|
|
assert.dom('[data-test-ttl-error]').doesNotIncludeText('Error', 'removes the error box');
|
|
});
|
|
|
|
test('it shows 30s for invalid duration initialValue input', async function(assert) {
|
|
await render(hbs`<TtlPicker @onChange={{onChange}} @initialValue={{'invalid'}} />`);
|
|
assert.dom('[data-test-ttl-value]').hasValue('30', 'sets 30 as the default');
|
|
});
|
|
});
|