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(); } } 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`<MaskedInput @allowCopy={{true}} @value={{this.value}} />`); 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) {