Hide React prototype project rail scrollbars
This commit is contained in:
@@ -34,6 +34,7 @@ const metrics = await page.evaluate(() => {
|
||||
const statusbar = document.querySelector('.statusbar')
|
||||
const search = document.querySelector('.global-search')
|
||||
const rail = document.querySelector('.project-rail')
|
||||
const railChildren = rail?.querySelector('.arco-layout-sider-children')
|
||||
const dashboard = document.querySelector('.dashboard-button')
|
||||
const project = document.querySelector('.project-button')
|
||||
const create = document.querySelector('.create-project')
|
||||
@@ -52,6 +53,16 @@ const metrics = await page.evaluate(() => {
|
||||
}
|
||||
: null
|
||||
const verticalGaps = itemRects.slice(1).map((item, index) => item.top - (itemRects[index].top + itemRects[index].height))
|
||||
const overflowState = (node) => node
|
||||
? {
|
||||
clientWidth: node.clientWidth,
|
||||
scrollWidth: node.scrollWidth,
|
||||
clientHeight: node.clientHeight,
|
||||
scrollHeight: node.scrollHeight,
|
||||
overflowX: getComputedStyle(node).overflowX,
|
||||
overflowY: getComputedStyle(node).overflowY,
|
||||
}
|
||||
: null
|
||||
|
||||
return {
|
||||
statusbarHeight: statusbar?.getBoundingClientRect().height,
|
||||
@@ -63,6 +74,8 @@ const metrics = await page.evaluate(() => {
|
||||
firstProjectBadge: rect(firstBadge),
|
||||
horizontalInsets,
|
||||
verticalGaps,
|
||||
projectRailOverflow: overflowState(rail),
|
||||
projectRailChildrenOverflow: overflowState(railChildren),
|
||||
overflowX: document.documentElement.scrollWidth > document.documentElement.clientWidth,
|
||||
}
|
||||
})
|
||||
@@ -87,6 +100,18 @@ if (!metrics.horizontalInsets || Math.abs(metrics.horizontalInsets.left - metric
|
||||
if (metrics.verticalGaps.some((gap) => gap !== 12)) {
|
||||
failures.push(`expected all project rail vertical gaps to be 12px, got ${JSON.stringify(metrics.verticalGaps)}`)
|
||||
}
|
||||
for (const [name, overflow] of [
|
||||
['project rail', metrics.projectRailOverflow],
|
||||
['project rail children', metrics.projectRailChildrenOverflow],
|
||||
]) {
|
||||
if (
|
||||
!overflow ||
|
||||
overflow.overflowX !== 'hidden' ||
|
||||
overflow.overflowY !== 'hidden'
|
||||
) {
|
||||
failures.push(`expected ${name} scrollbars to be hidden with no overflow, got ${JSON.stringify(overflow)}`)
|
||||
}
|
||||
}
|
||||
if (
|
||||
!metrics.firstProjectBadge ||
|
||||
metrics.firstProjectBadge.right > metrics.projectRailWidth ||
|
||||
|
||||
Reference in New Issue
Block a user