import { readFileSync } from 'node:fs' import { describe, expect, it } from 'vitest' const viewSource = readFileSync( new URL('./SpringboardView.vue', import.meta.url), 'utf8', ) const appSource = readFileSync(new URL('../App.vue', import.meta.url), 'utf8') const appIconSource = readFileSync( new URL('../components/AppIcon.vue', import.meta.url), 'utf8', ) const folderIconSource = readFileSync( new URL('../components/HomeFolderIcon.vue', import.meta.url), 'utf8', ) const mainCss = readFileSync( new URL('../assets/main.css', import.meta.url), 'utf8', ) describe('Springboard page swipe contract', () => { it('replaces the home status row with the edit controls', () => { expect(viewSource).toContain("emit('editModeChange', editing)") expect(viewSource).toContain("emit('editModeChange', false)") expect(appSource).toContain( '@edit-mode-change="springboardEditing = $event"', ) expect(appSource).toMatch( /v-if="\s*!isLocked && !\(isHomeRoute && springboardEditing\)\s*"/, ) expect(mainCss).toMatch( /\.springboard-edit-add\s*\{[^}]*top:\s*14px;[^}]*left:\s*28px;[^}]*width:\s*58px;[^}]*height:\s*30px;/s, ) expect(mainCss).toMatch( /\.springboard-edit-done\s*\{[^}]*top:\s*14px;[^}]*right:\s*28px;[^}]*width:\s*58px;[^}]*height:\s*30px;/s, ) expect(viewSource).toContain( '