From 1af9b8b15e4f19d9d3734364b96b3719f1c70f43 Mon Sep 17 00:00:00 2001 From: Jordan Reimer Date: Wed, 7 Feb 2024 14:22:51 -0700 Subject: [PATCH 1/4] fixes masked-input component throwing error when there is no value --- ui/lib/core/addon/components/masked-input.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/lib/core/addon/components/masked-input.js b/ui/lib/core/addon/components/masked-input.js index f72e63a51a57..ac27526fea94 100644 --- a/ui/lib/core/addon/components/masked-input.js +++ b/ui/lib/core/addon/components/masked-input.js @@ -74,8 +74,9 @@ export default class MaskedInputComponent extends Component { get copyValue() { // Value must be a string to be copied - if (typeof this.args.value === 'string') return this.args.value; - if (typeof this.args.value === 'object') return JSON.stringify(this.args.value); - return this.args.value.toString(); + const { value } = this.args; + if (!value || typeof value === 'string') return value; + if (typeof value === 'object') return JSON.stringify(value); + return value.toString(); } } From 5dc9ac09890af588a5de466f9a59bb29f41f14c6 Mon Sep 17 00:00:00 2001 From: Jordan Reimer Date: Wed, 7 Feb 2024 14:56:34 -0700 Subject: [PATCH 2/4] removes copy button assertions from masked input test --- ui/tests/integration/components/masked-input-test.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ui/tests/integration/components/masked-input-test.js b/ui/tests/integration/components/masked-input-test.js index acdfbf1bdb28..ce56f3f6586d 100644 --- a/ui/tests/integration/components/masked-input-test.js +++ b/ui/tests/integration/components/masked-input-test.js @@ -49,10 +49,6 @@ module('Integration | Component | masked input', function (hooks) { this.set('value', { some: 'object' }); await render(hbs``); assert.ok(component.copyButtonIsPresent); - await click('[data-test-copy-icon]'); - assert - .dom('flight-icon-clipboard-checked') - .exists('clicking copy icon copies value to clipboard', 'copy is successful when value is an object'); }); test('it renders a download button when allowDownload is true', async function (assert) { From 5f9bc626a6f0d32fd448c64e4f54742758ecc980 Mon Sep 17 00:00:00 2001 From: Jordan Reimer Date: Wed, 7 Feb 2024 15:36:37 -0700 Subject: [PATCH 3/4] reverts masked input assertion removal and updates test selectors --- ui/tests/integration/components/masked-input-test.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ui/tests/integration/components/masked-input-test.js b/ui/tests/integration/components/masked-input-test.js index ce56f3f6586d..2478ddf04a36 100644 --- a/ui/tests/integration/components/masked-input-test.js +++ b/ui/tests/integration/components/masked-input-test.js @@ -49,6 +49,10 @@ module('Integration | Component | masked input', function (hooks) { this.set('value', { some: 'object' }); await render(hbs``); assert.ok(component.copyButtonIsPresent); + await click('[data-test-copy-button]'); + assert + .dom('[data-test-icon="clipboard-checked"]') + .exists('clicking copy icon copies value to clipboard', 'copy is successful when value is an object'); }); test('it renders a download button when allowDownload is true', async function (assert) { From f83b9ccfb31c73476e9dbff5100e3dc07c92d88b Mon Sep 17 00:00:00 2001 From: Jordan Reimer Date: Wed, 7 Feb 2024 15:52:29 -0700 Subject: [PATCH 4/4] removes masked input assertion again --- ui/tests/integration/components/masked-input-test.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ui/tests/integration/components/masked-input-test.js b/ui/tests/integration/components/masked-input-test.js index 2478ddf04a36..ce56f3f6586d 100644 --- a/ui/tests/integration/components/masked-input-test.js +++ b/ui/tests/integration/components/masked-input-test.js @@ -49,10 +49,6 @@ module('Integration | Component | masked input', function (hooks) { this.set('value', { some: 'object' }); await render(hbs``); assert.ok(component.copyButtonIsPresent); - await click('[data-test-copy-button]'); - assert - .dom('[data-test-icon="clipboard-checked"]') - .exists('clicking copy icon copies value to clipboard', 'copy is successful when value is an object'); }); test('it renders a download button when allowDownload is true', async function (assert) {