From ac7275823b483969296eb4eff329dc9e4a354578 Mon Sep 17 00:00:00 2001 From: cameron-eyds Date: Mon, 4 Dec 2023 21:03:28 -0800 Subject: [PATCH] Console cleanup --- ppr-ui/src/utils/form-helper.ts | 5 ++--- ppr-ui/tests/setup.ts | 12 ++++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ppr-ui/src/utils/form-helper.ts b/ppr-ui/src/utils/form-helper.ts index bd4e5ea57..c64f620cb 100644 --- a/ppr-ui/src/utils/form-helper.ts +++ b/ppr-ui/src/utils/form-helper.ts @@ -14,9 +14,8 @@ export function focusOnFirstError(formName: string): void { // Scroll to first designated error on Information or Review page export async function scrollToFirstErrorComponent(defaultIndex: number = 0): Promise { setTimeout(() => { - document.getElementsByClassName('border-error-left').length > 0 && - document - .getElementsByClassName('border-error-left')[defaultIndex] + document?.getElementsByClassName('border-error-left').length > 0 && + document?.getElementsByClassName('border-error-left')[defaultIndex] .scrollIntoView({ block: 'start', inline: 'nearest', behavior: 'smooth' }) }, 500) } diff --git a/ppr-ui/tests/setup.ts b/ppr-ui/tests/setup.ts index ea90e8184..a38f687c9 100755 --- a/ppr-ui/tests/setup.ts +++ b/ppr-ui/tests/setup.ts @@ -47,6 +47,18 @@ beforeAll(() => { } }) + // Stub the SbcHeader component + vi.mock('../node_modules/sbc-common-components/src/components/SbcHeader.vue', () => { + // Replace the component with a dummy component or return an empty object + return { + default: { + render () { + return null + } + } + } + }) + // Mock the WysiwygEditors (imported editor portion) component functions global.ClipboardEvent = class ClipboardEvent { constructor(type, eventInitDict) {