feat: complete WorkBuddy parity and Windows release workflow
This commit is contained in:
1 parent
143516b3a8
commit
d5512df549
434 files changed
+54977
-1854
No files matched your search
@@ -0,0 +1,98 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import { promises as fs } from 'node:fs'
|
||||
import { resolve } from 'node:path'
|
||||
import {
|
||||
computeNotificationsPanelPosition
|
||||
} from '../src/renderer/src/components/NotificationsPanel'
|
||||
import {
|
||||
computeProjectMenuPosition
|
||||
} from '../src/renderer/src/projects/ProjectMenu'
|
||||
|
||||
async function main(): Promise<void> {
|
||||
const notificationPosition = computeNotificationsPanelPosition(
|
||||
{ left: 240, right: 272, top: 854, bottom: 886 },
|
||||
{ width: 300, height: 380 },
|
||||
{ width: 1336, height: 902 }
|
||||
)
|
||||
assert.deepEqual(notificationPosition, { left: 8, top: 466 })
|
||||
|
||||
const rightEdgePosition = computeNotificationsPanelPosition(
|
||||
{ left: 1200, right: 1232, top: 600, bottom: 632 },
|
||||
{ width: 300, height: 280 },
|
||||
{ width: 1280, height: 720 }
|
||||
)
|
||||
assert.deepEqual(rightEdgePosition, { left: 932, top: 312 })
|
||||
|
||||
const shortViewportPosition = computeNotificationsPanelPosition(
|
||||
{ left: 120, right: 152, top: 690, bottom: 720 },
|
||||
{ width: 300, height: 380 },
|
||||
{ width: 360, height: 720 }
|
||||
)
|
||||
assert.equal(shortViewportPosition.left, 8)
|
||||
assert.equal(shortViewportPosition.top, 302)
|
||||
|
||||
const sourceProjectMenuPosition = computeProjectMenuPosition(
|
||||
{ left: 100, right: 271, top: 266 },
|
||||
{ width: 162, height: 64 },
|
||||
{ width: 1336, height: 902 }
|
||||
)
|
||||
assert.deepEqual(sourceProjectMenuPosition, { left: 275, top: 258 })
|
||||
|
||||
const narrowProjectMenuPosition = computeProjectMenuPosition(
|
||||
{ left: 20, right: 200, top: 80 },
|
||||
{ width: 162, height: 64 },
|
||||
{ width: 320, height: 240 }
|
||||
)
|
||||
assert.equal(narrowProjectMenuPosition.left, 4)
|
||||
assert.equal(narrowProjectMenuPosition.top, 72)
|
||||
|
||||
const sidebar = await fs.readFile(
|
||||
resolve('src/renderer/src/components/Sidebar.tsx'),
|
||||
'utf8'
|
||||
)
|
||||
assert.match(sidebar, /onContextMenu=\{\(event\) => \{[\s\S]*?openTaskMenu\(session, event\.currentTarget, \{ left: event\.clientX, top: event\.clientY \}\)/)
|
||||
assert.match(sidebar, /event\.key === 'ContextMenu' \|\| \(event\.shiftKey && event\.key === 'F10'\)/)
|
||||
assert.match(sidebar, /aria-haspopup="dialog"/)
|
||||
assert.match(sidebar, /<NotificationsPanel anchor=\{notifAnchor\}/)
|
||||
|
||||
const notifications = await fs.readFile(
|
||||
resolve('src/renderer/src/components/NotificationsPanel.tsx'),
|
||||
'utf8'
|
||||
)
|
||||
assert.match(notifications, /createPortal\(/)
|
||||
assert.match(notifications, /role="dialog"/)
|
||||
assert.match(notifications, /computeNotificationsPanelPosition/)
|
||||
assert.match(notifications, /event\.key === 'Escape'/)
|
||||
assert.match(notifications, /anchor\?\.trigger\.focus/)
|
||||
|
||||
const sidebarCss = await fs.readFile(
|
||||
resolve('src/renderer/src/styles/sidebar.css'),
|
||||
'utf8'
|
||||
)
|
||||
assert.match(sidebarCss, /\.notif-panel \{[\s\S]*?position: fixed;[\s\S]*?z-index: 10020;/)
|
||||
assert.match(sidebarCss, /width: min\(300px, calc\(100vw - 16px\)\);/)
|
||||
assert.match(sidebarCss, /max-height: min\(380px, calc\(100vh - 16px\)\);/)
|
||||
assert.match(sidebarCss, /html\[data-theme='dark'\] \.notif-panel \{[\s\S]*?--yc-notif-bg: #242424;/)
|
||||
|
||||
const projectMenuCss = await fs.readFile(
|
||||
resolve('src/renderer/src/projects/project-menu.css'),
|
||||
'utf8'
|
||||
)
|
||||
assert.match(projectMenuCss, /--yc-project-menu-bg: #fff;/)
|
||||
assert.match(projectMenuCss, /background: var\(--yc-project-menu-bg\);/)
|
||||
assert.match(projectMenuCss, /html\[data-theme="dark"\] \.yc-project-more \{[\s\S]*?--yc-project-menu-bg: #242424;/)
|
||||
|
||||
const taskMenuQa = await fs.readFile(
|
||||
resolve('scripts/verify-task-menu.cjs'),
|
||||
'utf8'
|
||||
)
|
||||
assert.match(taskMenuQa, /context-menu-same-as-more/)
|
||||
assert.match(taskMenuQa, /dispatchEvent\(new MouseEvent\('contextmenu'/)
|
||||
|
||||
console.log('sidebar-notification-menu-regression: ok')
|
||||
}
|
||||
|
||||
main().catch((error) => {
|
||||
console.error(error)
|
||||
process.exitCode = 1
|
||||
})
|
||||
Reference in new issue
Block a user