Skip to content

Commit 61a2c98

Browse files
committed
test: fix test
1 parent 7094c95 commit 61a2c98

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/useIonicHeaderParallax.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ export function useIonHeaderParallax({
3737
// ion-toolbar background
3838
const toolbarShadowRoot = toolbar.shadowRoot
3939

40-
if (!toolbarShadowRoot) throw new Error('No shadow')
40+
// if (!toolbarShadowRoot) throw new Error('No shadow')
4141

42-
const toolbarBackground = toolbarShadowRoot.querySelector('.toolbar-background') as HTMLElement
42+
const toolbarBackground = toolbarShadowRoot?.querySelector('.toolbar-background') as HTMLElement
4343

44-
if (!toolbarBackground) throw new Error('No .toolbar-background')
44+
// if (!toolbarBackground) throw new Error('No .toolbar-background')
4545

4646
// ion-title
4747
const ionTitle = toolbar.querySelector('ion-title') as HTMLElement
@@ -98,10 +98,11 @@ export function useIonHeaderParallax({
9898
window.getComputedStyle(scrollContent as Element, null).paddingTop.replace('px', '')
9999
)
100100
}
101-
102101
let originalToolbarBgColor = 'white'
103-
originalToolbarBgColor = window.getComputedStyle(toolbarBackground as Element, null).backgroundColor
104102

103+
if (toolbarBackground) {
104+
originalToolbarBgColor = window.getComputedStyle(toolbarBackground as Element, null).backgroundColor
105+
}
105106

106107
// header and title
107108
header.style.position = 'relative'

0 commit comments

Comments
 (0)