diff --git a/ui/tests/integration/components/form-field-test.js b/ui/tests/integration/components/form-field-test.js index fb7d25fae4e9..0d5916351b08 100644 --- a/ui/tests/integration/components/form-field-test.js +++ b/ui/tests/integration/components/form-field-test.js @@ -127,14 +127,41 @@ module('Integration | Component | form field', function (hooks) { }); test('it renders: editType ttl', async function (assert) { - const [model, spy] = await setup.call(this, createAttr('foo', null, { editType: 'ttl' })); + const [model, spy] = await setup.call( + this, + createAttr('foo', null, { + editType: 'ttl', + helperTextDisabled: 'TTL is disabled', + helperTextEnabled: 'TTL is enabled', + }) + ); assert.ok(component.hasTTLPicker, 'renders the ttl-picker component'); + assert.dom('[data-test-ttl-form-subtext]').hasText('TTL is disabled'); + assert.dom('[data-test-ttl-toggle]').isNotChecked(); await component.fields.objectAt(0).toggleTtl(); await component.fields.objectAt(0).select('h').change(); await component.fields.objectAt(0).ttlTime('3'); const expectedSeconds = `${3 * 3600}s`; assert.strictEqual(model.get('foo'), expectedSeconds); assert.ok(spy.calledWith('foo', expectedSeconds), 'onChange called with correct args'); + await component.fields.objectAt(0).toggleTtl(); + assert.ok(spy.calledWith('foo', '0'), 'onChange called with 0 when toggle off'); + }); + + test('it renders: editType ttl with special settings', async function (assert) { + const [model, spy] = await setup.call( + this, + createAttr('foo', null, { + editType: 'ttl', + setDefault: '3600s', + ttlOffValue: '', + }) + ); + assert.ok(component.hasTTLPicker, 'renders the ttl-picker component'); + assert.dom('[data-test-ttl-toggle]').isChecked(); + await component.fields.objectAt(0).toggleTtl(); + assert.strictEqual(model.get('foo'), ''); + assert.ok(spy.calledWith('foo', ''), 'onChange called with correct args'); }); test('it renders: editType ttl without toggle', async function (assert) { diff --git a/ui/tests/unit/adapters/aws-credential-test.js b/ui/tests/unit/adapters/aws-credential-test.js index 527338900cdc..558c300e648c 100644 --- a/ui/tests/unit/adapters/aws-credential-test.js +++ b/ui/tests/unit/adapters/aws-credential-test.js @@ -74,6 +74,11 @@ module('Unit | Adapter | aws credential', function (hooks) { [storeStub, type, makeSnapshot({ credentialType: 'assumed_role' })], 'POST', ], + [ + 'assumed_role type no arn, ttl empty', + [storeStub, type, makeSnapshot({ credentialType: 'assumed_role', ttl: '' })], + 'POST', + ], [ 'assumed_role type no arn', [storeStub, type, makeSnapshot({ credentialType: 'assumed_role', ttl: '3h' })],