(path: string | RouteLocationRaw, onLoad?: () => void)
| 93 | const getPage = () => el.getComponent('#page') |
| 94 | |
| 95 | async function expectNavigatesWithLoading (path: string | RouteLocationRaw, onLoad?: () => void) { |
| 96 | startedLoading = 0 |
| 97 | stoppedLoading = 0 |
| 98 | await navigateTo(path) |
| 99 | expect(startedLoading).toBe(1) |
| 100 | expect(stoppedLoading).toBe(0) |
| 101 | |
| 102 | expect(isLoading.value).toBe(true) |
| 103 | expect(getLoadingIndicator().attributes().style).toContain('opacity: 1;') |
| 104 | onLoad?.() |
| 105 | |
| 106 | if (isLoading.value) { |
| 107 | resolve!() |
| 108 | await new Promise<void>(resolve => nuxtApp.hooks.hookOnce('page:loading:end', () => { resolve() })) |
| 109 | .then(() => new Promise(r => setTimeout(r, 0))) |
| 110 | } |
| 111 | |
| 112 | expect(startedLoading).toBe(1) |
| 113 | expect(stoppedLoading).toBe(1) |
| 114 | |
| 115 | expect(isLoading.value).toBe(false) |
| 116 | expect(getLoadingIndicator().attributes().style).toContain('opacity: 0;') |
| 117 | } |
| 118 | |
| 119 | await flushPromises() |
| 120 |
no test coverage detected
searching dependent graphs…