Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix selection tests #9240

Merged
merged 1 commit into from
Mar 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions app/gui2/src/composables/__tests__/selection.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Rect } from '@/util/data/rect'
import { Vec2 } from '@/util/data/vec2'
import { expect, test } from 'vitest'
import { expect, test, vi } from 'vitest'
import { proxyRefs, ref, type Ref } from 'vue'
import { useSelection } from '../selection'

Expand All @@ -23,7 +23,7 @@ function selectionWithMockData(sceneMousePos?: Ref<Vec2>) {

// TODO[ao]: Skipping test, as they often fail in CI
// (for example https://github.com/enso-org/enso/actions/runs/8102076908/job/22163122663)
test.skip.each`
test.each`
click | modifiers | expected
${1} | ${[]} | ${[1]}
${3} | ${[]} | ${[3]}
Expand Down Expand Up @@ -54,7 +54,7 @@ const areas: Record<string, Rect> = {

// TODO[ao]: Skipping test, as they often fail in CI
// (for example https://github.com/enso-org/enso/actions/runs/8102076908/job/22163122663)
test.skip.each`
test.each`
areaId | modifiers | expected
${'left'} | ${[]} | ${[1, 3]}
${'right'} | ${[]} | ${[2, 4]}
Expand Down Expand Up @@ -103,12 +103,12 @@ test.skip.each`
dragCase(new Vec2(area.right, area.top), new Vec2(area.left, area.bottom))
})

// There is no PointerEvent class in jsdom (yet).
class MockPointerEvent extends MouseEvent {
currentTarget: EventTarget | null
pointerId: number
readonly pointerId: number
constructor(type: string, options: MouseEventInit & { currentTarget?: Element | undefined }) {
super(type, options)
this.currentTarget = options.currentTarget ?? null
vi.spyOn(this, 'currentTarget', 'get').mockReturnValue(options.currentTarget ?? null)
this.pointerId = 4
}
}
Expand Down
Loading