Correct all tsc errors

This commit is contained in:
49lf
2024-12-05 16:37:56 -05:00
parent 119cacf6a8
commit 1a04a4dcfb
29 changed files with 1433 additions and 1254 deletions

View File

@ -3,6 +3,7 @@ import { test, expect, Page } from './zoo-test'
import { deg, getUtils, wiggleMove } from './test-utils'
import { LineInputsType } from 'lang/std/sketchcombos'
import { uuidv4 } from 'lib/utils'
import { EditorFixture } from './fixtures/editorFixture'
test.describe('Testing segment overlays', () => {
test.describe('Hover over a segment should show its overlay, hovering over the input overlays should show its popover, clicking the input overlay should constrain/unconstrain it:\nfor the following segments', () => {
@ -52,7 +53,9 @@ test.describe('Testing segment overlays', () => {
await wiggleMove(page, x, y, 20, 30, ang, 10, 5, locator)
await page.mouse.move(x, y)
await editor.expectEditor.toContain(expectBeforeUnconstrained, { shouldNormalise: true })
await editor.expectEditor.toContain(expectBeforeUnconstrained, {
shouldNormalise: true,
})
const constrainedLocator = page.locator(
`[data-constraint-type="${constraintType}"][data-is-constrained="true"]`
)
@ -62,7 +65,9 @@ test.describe('Testing segment overlays', () => {
await page.getByTestId('constraint-symbol-popover').count()
).toBeGreaterThan(0)
await constrainedLocator.click()
await editor.expectEditor.toContain(expectAfterUnconstrained, { shouldNormalise: true })
await editor.expectEditor.toContain(expectAfterUnconstrained, {
shouldNormalise: true,
})
await page.mouse.move(0, 0)
await page.waitForTimeout(1000)
@ -91,6 +96,9 @@ test.describe('Testing segment overlays', () => {
.click()
await expect(page.locator('.cm-content')).toContainText(expectFinal)
await editor.expectEditor.toContain(expectFinal, { shouldNormalise: true })
await editor.expectEditor.toContain(expectFinal, {
shouldNormalise: true,
})
}
/**
@ -138,7 +146,9 @@ test.describe('Testing segment overlays', () => {
await page.mouse.move(x, y)
await expect(page.getByText('Added variable')).not.toBeVisible()
await editor.expectEditor.toContain(expectBeforeUnconstrained, { shouldNormalise: true })
await editor.expectEditor.toContain(expectBeforeUnconstrained, {
shouldNormalise: true,
})
const unconstrainedLocator = page.locator(
`[data-constraint-type="${constraintType}"][data-is-constrained="false"]`
)
@ -156,7 +166,9 @@ test.describe('Testing segment overlays', () => {
name: 'arrow right Continue',
})
.click()
await editor.expectEditor.toContain(expectAfterUnconstrained, { shouldNormalise: true })
await editor.expectEditor.toContain(expectAfterUnconstrained, {
shouldNormalise: true,
})
await expect(page.getByText('Added variable')).not.toBeVisible()
await page.mouse.move(0, 0)
@ -176,7 +188,9 @@ test.describe('Testing segment overlays', () => {
await page.getByTestId('constraint-symbol-popover').count()
).toBeGreaterThan(0)
await constrainedLocator.click()
await editor.expectEditor.toContain(expectFinal, { shouldNormalise: true })
await editor.expectEditor.toContain(expectFinal, {
shouldNormalise: true,
})
}
test.setTimeout(120000)
test('for segments [line, angledLine, lineTo, xLineTo]', async ({
@ -344,7 +358,11 @@ test.describe('Testing segment overlays', () => {
locator: '[data-overlay-toolbar-index="3"]',
})
})
test('for segments [yLineTo, xLine]', async ({ page, editor, homePage }) => {
test('for segments [yLineTo, xLine]', async ({
page,
editor,
homePage,
}) => {
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
@ -709,7 +727,11 @@ test.describe('Testing segment overlays', () => {
locator: '[data-overlay-toolbar-index="11"]',
})
})
test('for segment [tangentialArcTo]', async ({ page, editor, homePage }) => {
test('for segment [tangentialArcTo]', async ({
page,
editor,
homePage,
}) => {
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
@ -888,12 +910,16 @@ test.describe('Testing segment overlays', () => {
await wiggleMove(page, x, y, 20, 30, ang, 10, 5, locator)
await page.mouse.move(x, y)
await editor.expectEditor.toContain(codeToBeDeleted, { shouldNormalise: true })
await editor.expectEditor.toContain(codeToBeDeleted, {
shouldNormalise: true,
})
await page.locator(`[data-stdlib-fn-name="${stdLibFnName}"]`).click()
await page.getByText('Delete Segment').click()
await editor.expectEditor.not.toContain(codeToBeDeleted, { shouldNormalise: true })
await editor.expectEditor.not.toContain(codeToBeDeleted, {
shouldNormalise: true,
})
}
test('all segment types', async ({ page, editor, homePage }) => {
await page.addInitScript(async () => {
@ -1075,12 +1101,16 @@ test.describe('Testing segment overlays', () => {
await page.mouse.move(hoverPos.x, hoverPos.y)
const codeToBeDeleted = 'lineTo([33, 11.5 + 0], %)'
await editor.expectEditor.toContain(codeToBeDeleted, { shouldNormalise: true })
await editor.expectEditor.toContain(codeToBeDeleted, {
shouldNormalise: true,
})
await page.getByTestId('overlay-menu').click()
await page.getByText('Delete Segment').click()
await editor.expectEditor.not.toContain(codeToBeDeleted, { shouldNormalise: true })
await editor.expectEditor.not.toContain(codeToBeDeleted, {
shouldNormalise: true,
})
segmentToDelete = await getOverlayByIndex(1)
ang = await u.getAngle(`[data-overlay-index="${1}"]`)
@ -1175,7 +1205,9 @@ test.describe('Testing segment overlays', () => {
await page.mouse.move(hoverPos.x + x, hoverPos.y + y)
await page.mouse.move(hoverPos.x, hoverPos.y, { steps: 5 })
await editor.expectEditor.toContain(lineOfInterest, { shouldNormalise: true })
await editor.expectEditor.toContain(lineOfInterest, {
shouldNormalise: true,
})
await page.getByTestId('overlay-menu').click()
await page.waitForTimeout(100)
@ -1186,7 +1218,9 @@ test.describe('Testing segment overlays', () => {
await page.mouse.move(hoverPos.x + x, hoverPos.y + y)
await page.mouse.move(hoverPos.x, hoverPos.y, { steps: 5 })
await editor.expectEditor.toContain(lineOfInterest, { shouldNormalise: true })
await editor.expectEditor.toContain(lineOfInterest, {
shouldNormalise: true,
})
await page.getByTestId('overlay-menu').click()
await page.waitForTimeout(100)
@ -1202,12 +1236,18 @@ test.describe('Testing segment overlays', () => {
)
).toBeTruthy()
// eslint-disable-next-line jest/no-conditional-expect
await editor.expectEditor.toContain(lineOfInterest, { shouldNormalise: true })
await editor.expectEditor.toContain(lineOfInterest, {
shouldNormalise: true,
})
} else {
// eslint-disable-next-line jest/no-conditional-expect
await editor.expectEditor.not.toContain(lineOfInterest, { shouldNormalise: true })
await editor.expectEditor.not.toContain(lineOfInterest, {
shouldNormalise: true,
})
// eslint-disable-next-line jest/no-conditional-expect
await editor.expectEditor.not.toContain('seg01', { shouldNormalise: true })
await editor.expectEditor.not.toContain('seg01', {
shouldNormalise: true,
})
}
})
}