|
1 | 1 | import { userEvent } from '@vitest/browser/context' |
2 | 2 | import { describe, expect, test } from 'vitest' |
3 | 3 | import { render } from 'vitest-browser-svelte' |
| 4 | +import PropsReactivity from '../src/components/test/props-reactivity.svelte' |
4 | 5 | import App from '../src/routes/+page.svelte' |
5 | 6 |
|
6 | 7 | const createMockFile = (name: string, type: string, size: number = 1024) => { |
@@ -124,3 +125,27 @@ describe('RemoteSource Component', () => { |
124 | 125 | await expect.element(loginButton).toBeInTheDocument() |
125 | 126 | }) |
126 | 127 | }) |
| 128 | + |
| 129 | +test('Dashboard reacts to prop changes', async () => { |
| 130 | + const screen = render(PropsReactivity) |
| 131 | + const toggleButton = screen.getByText('Toggle dashboard') |
| 132 | + const dashboard = screen.container.querySelector('.uppy-Dashboard') |
| 133 | + |
| 134 | + expect(dashboard).toBeTruthy() |
| 135 | + expect(dashboard?.ariaDisabled).toEqual('false') |
| 136 | + await userEvent.click(toggleButton) |
| 137 | + expect(dashboard?.ariaDisabled).toEqual('true') |
| 138 | +}) |
| 139 | + |
| 140 | +test('StatusBar reacts to prop changes', async () => { |
| 141 | + const screen = render(PropsReactivity) |
| 142 | + const toggleButton = screen.getByText('Toggle statusbar') |
| 143 | + |
| 144 | + expect( |
| 145 | + screen.container.querySelector('#statusbar-container .uppy-c-btn-primary'), |
| 146 | + ).toBeVisible() |
| 147 | + await userEvent.click(toggleButton) |
| 148 | + expect( |
| 149 | + screen.container.querySelector('#statusbar-container .uppy-c-btn-primary'), |
| 150 | + ).toEqual(null) |
| 151 | +}) |
0 commit comments