docs(docs): U2 preparatory closure, skipped tests, contrast anomaly, Prettier on two tests
This commit is contained in:
1 parent
9386288ffd
commit
70d4addc56
4 files changed
+41
-9
No files matched your search
@@ -1,6 +1,12 @@
|
||||
/** The held-reason bubble (D1): its closing rules and its place, apart from the editor. */
|
||||
import { afterEach, describe, expect, it } from 'vitest'
|
||||
import { act, cleanup, render, renderHook, screen } from '@testing-library/react'
|
||||
import {
|
||||
act,
|
||||
cleanup,
|
||||
render,
|
||||
renderHook,
|
||||
screen,
|
||||
} from '@testing-library/react'
|
||||
import HeldReasonBubble from '@/components/editor/HeldReasonBubble'
|
||||
import { useHeldBubble } from '@/components/editor/useHeldBubble'
|
||||
|
||||
@@ -13,10 +19,9 @@ function opened(tab = 'annotations') {
|
||||
const button = document.createElement('button')
|
||||
document.body.append(button)
|
||||
const ref = { current: button }
|
||||
const hook = renderHook(
|
||||
({ held, tab }) => useHeldBubble(held, tab, ref),
|
||||
{ initialProps: { held: true, tab } },
|
||||
)
|
||||
const hook = renderHook(({ held, tab }) => useHeldBubble(held, tab, ref), {
|
||||
initialProps: { held: true, tab },
|
||||
})
|
||||
act(() => hook.result.current.show())
|
||||
expect(hook.result.current.open).toBe(true)
|
||||
return { hook, button }
|
||||
@@ -71,7 +76,7 @@ describe('closing', () => {
|
||||
expect(key(button).defaultPrevented).toBe(false)
|
||||
})
|
||||
|
||||
it('Escape typed in a text field closes it and stays the field\'s', () => {
|
||||
it("Escape typed in a text field closes it and stays the field's", () => {
|
||||
const { hook } = opened()
|
||||
const field = document.createElement('input')
|
||||
document.body.append(field)
|
||||
@@ -83,7 +88,14 @@ describe('closing', () => {
|
||||
|
||||
describe('the place', () => {
|
||||
const rect = (left: number, right: number, top = 0, bottom = 40) =>
|
||||
({ left, right, top, bottom, width: right - left, height: bottom - top }) as DOMRect
|
||||
({
|
||||
left,
|
||||
right,
|
||||
top,
|
||||
bottom,
|
||||
width: right - left,
|
||||
height: bottom - top,
|
||||
}) as DOMRect
|
||||
function anchor() {
|
||||
const button = document.createElement('button')
|
||||
document.body.append(button)
|
||||
@@ -112,7 +124,7 @@ describe('the place', () => {
|
||||
expect(bubble.style.maxWidth).toBe('min(18rem, 952px)')
|
||||
})
|
||||
|
||||
it('ends left of the strip\'s commands when the strip is shown', () => {
|
||||
it("ends left of the strip's commands when the strip is shown", () => {
|
||||
strip(760)
|
||||
render(<HeldReasonBubble anchor={anchor()} text="why" />)
|
||||
const bubble = screen.getByTestId('history-hold-bubble')
|
||||
|
||||
@@ -794,7 +794,7 @@ describe('why a button is held (point 6)', () => {
|
||||
return user
|
||||
}
|
||||
|
||||
it('is announced by the button\'s always-mounted status region, once per press', async () => {
|
||||
it("is announced by the button's always-mounted status region, once per press", async () => {
|
||||
const user = await openAnnotations()
|
||||
stacks()
|
||||
pend()
|
||||
|
||||
Reference in new issue
Block a user