Skip to content

Commit

Permalink
chore: apply formatting and linting changes through autofix
Browse files Browse the repository at this point in the history
  • Loading branch information
joshblack committed Sep 25, 2023
1 parent 0da3854 commit 480ea51
Show file tree
Hide file tree
Showing 12 changed files with 107 additions and 107 deletions.
8 changes: 4 additions & 4 deletions src/__tests__/anchored-position.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function makeDOMRect(x: number, y: number, width: number, height: number): DOMRe
bottom: y + height,
toJSON() {
return this
}
},
}
}

Expand All @@ -31,7 +31,7 @@ function createVirtualDOM(
parentRect: DOMRect,
anchorRect: DOMRect,
floatingRect: DOMRect,
parentBorders: {top: number; right: number; bottom: number; left: number} = {top: 0, right: 0, bottom: 0, left: 0}
parentBorders: {top: number; right: number; bottom: number; left: number} = {top: 0, right: 0, bottom: 0, left: 0},
) {
const parent = document.createElement('div')
parent.style.overflow = 'hidden'
Expand Down Expand Up @@ -280,7 +280,7 @@ describe('getAnchoredPosition', () => {
side: 'outside-right',
align: 'center',
alignmentOffset: 10,
anchorOffset: -10
anchorOffset: -10,
}

const {top, left} = getAnchoredPosition(float, anchor, settings)
Expand All @@ -301,7 +301,7 @@ describe('getAnchoredPosition', () => {
side: 'inside-right',
align: 'center',
alignmentOffset: 10,
anchorOffset: -10
anchorOffset: -10,
}

const {top, left} = getAnchoredPosition(float, anchor, settings)
Expand Down
22 changes: 11 additions & 11 deletions src/__tests__/focus-trap.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ beforeAll(() => {
try {
Object.defineProperties(HTMLElement.prototype, {
offsetHeight: {
get: () => 42
get: () => 42,
},
offsetWidth: {
get: () => 42
get: () => 42,
},
getClientRects: {
get: () => () => [42]
}
get: () => () => [42],
},
})
} catch {
// ignore
Expand All @@ -32,7 +32,7 @@ it('Should initially focus the first element when activated', () => {
<button tabIndex={0}>Banana</button>
<button tabIndex={0}>Cantaloupe</button>
</div>
</div>
</div>,
)

const trapContainer = container.querySelector<HTMLElement>('#trapContainer')!
Expand All @@ -49,7 +49,7 @@ it('Should initially focus the initialFocus element when specified', () => {
<button tabIndex={0}>Apple</button>
<button tabIndex={0}>Banana</button>
<button tabIndex={0}>Cantaloupe</button>
</div>
</div>,
)

const trapContainer = container.querySelector<HTMLElement>('#trapContainer')!
Expand All @@ -71,7 +71,7 @@ it('Should prevent focus from exiting the trap, returns focus to first element',
<button id="durian" tabIndex={0}>
Durian
</button>
</div>
</div>,
)

const trapContainer = container.querySelector<HTMLElement>('#trapContainer')!
Expand Down Expand Up @@ -107,7 +107,7 @@ it('Should cycle focus from last element to first element and vice-versa', async
<button id="durian" tabIndex={0}>
Durian
</button>
</div>
</div>,
)

const trapContainer = container.querySelector<HTMLElement>('#trapContainer')!
Expand Down Expand Up @@ -137,7 +137,7 @@ it('Should should release the trap when the signal is aborted', async () => {
<button id="durian" tabIndex={0}>
Durian
</button>
</div>
</div>,
)

const trapContainer = container.querySelector<HTMLElement>('#trapContainer')!
Expand Down Expand Up @@ -167,7 +167,7 @@ it('Should should release the trap when the container is removed from the DOM',
<button id="durian" tabIndex={0}>
Durian
</button>
</div>
</div>,
)

const trapContainer = container.querySelector<HTMLElement>('#trapContainer')!
Expand Down Expand Up @@ -198,7 +198,7 @@ it('Should handle dynamic content', async () => {
<button id="durian" tabIndex={0}>
Durian
</button>
</div>
</div>,
)

const trapContainer = container.querySelector<HTMLElement>('#trapContainer')!
Expand Down
50 changes: 25 additions & 25 deletions src/__tests__/focus-zone.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ beforeAll(() => {
try {
Object.defineProperties(HTMLElement.prototype, {
offsetHeight: {
get: () => 42
get: () => 42,
},
offsetWidth: {
get: () => 42
get: () => 42,
},
getClientRects: {
get: () => () => [42]
}
get: () => () => [42],
},
})
} catch {
// ignore
Expand All @@ -39,7 +39,7 @@ it('Should allow arrow keys to move focus', () => {
<button tabIndex={0}>Banana</button>
<button tabIndex={0}>Cantaloupe</button>
</div>
</div>
</div>,
)

const focusZoneContainer = container.querySelector<HTMLElement>('#focusZone')!
Expand All @@ -65,7 +65,7 @@ it('Should have one tab-stop inside the focus zone when enabled', () => {
<button tabIndex={0}>Cantaloupe</button>
</div>
<button tabIndex={0}>Next Apple</button>
</div>
</div>,
)

const focusZoneContainer = container.querySelector<HTMLElement>('#focusZone')!
Expand Down Expand Up @@ -96,7 +96,7 @@ it('Should prevent moving focus outside the zone', () => {
<button tabIndex={0}>Banana</button>
<button tabIndex={0}>Cantaloupe</button>
</div>
</div>
</div>,
)

const focusZoneContainer = container.querySelector<HTMLElement>('#focusZone')!
Expand Down Expand Up @@ -130,7 +130,7 @@ it('Should do focus wrapping correctly', () => {
<button tabIndex={0}>Banana</button>
<button tabIndex={0}>Cantaloupe</button>
</div>
</div>
</div>,
)

const focusZoneContainer = container.querySelector<HTMLElement>('#focusZone')!
Expand Down Expand Up @@ -164,7 +164,7 @@ it('Should call custom getNextFocusable callback', () => {
<button tabIndex={0}>Banana</button>
<button tabIndex={0}>Cantaloupe</button>
</div>
</div>
</div>,
)

const focusZoneContainer = container.querySelector<HTMLElement>('#focusZone')!
Expand Down Expand Up @@ -195,7 +195,7 @@ it('Should focus-in to the most recently-focused element', () => {
<button tabIndex={0}>Banana</button>
<button tabIndex={0}>Cantaloupe</button>
</div>
</div>
</div>,
)

const focusZoneContainer = container.querySelector<HTMLElement>('#focusZone')!
Expand Down Expand Up @@ -228,7 +228,7 @@ it('Should focus-in to the first element when focusInStrategy is "first"', () =>
<button tabIndex={0}>Banana</button>
<button tabIndex={0}>Cantaloupe</button>
</div>
</div>
</div>,
)

const focusZoneContainer = container.querySelector<HTMLElement>('#focusZone')!
Expand Down Expand Up @@ -270,7 +270,7 @@ it('Should focus-in to the closest element when focusInStrategy is "closest"', (
<button tabIndex={0} id="outsideAfter">
Good Apple
</button>
</div>
</div>,
)

const focusZoneContainer = container.querySelector<HTMLElement>('#focusZone')!
Expand Down Expand Up @@ -309,7 +309,7 @@ it('Should call the custom focusInStrategy callback', () => {
<button tabIndex={0}>Banana</button>
<button tabIndex={0}>Cantaloupe</button>
</div>
</div>
</div>,
)

const focusZoneContainer = container.querySelector<HTMLElement>('#focusZone')!
Expand Down Expand Up @@ -340,7 +340,7 @@ it('Should respect inputs by not moving focus if key would have some other effec
<input type="text" defaultValue="Banana" tabIndex={0} />
<button tabIndex={0}>Cantaloupe</button>
</div>
</div>
</div>,
)

const focusZoneContainer = container.querySelector<HTMLElement>('#focusZone')!
Expand Down Expand Up @@ -372,7 +372,7 @@ it('Should focus-in to the first element if the last-focused element is removed'
<button tabIndex={0}>Banana</button>
<button tabIndex={0}>Cantaloupe</button>
</div>
</div>
</div>,
)

const focusZoneContainer = container.querySelector<HTMLElement>('#focusZone')!
Expand Down Expand Up @@ -411,7 +411,7 @@ it('Should call onActiveDescendantChanged properly', () => {
<button tabIndex={0}>Banana</button>
<button tabIndex={0}>Cantaloupe</button>
</div>
</div>
</div>,
)

const focusZoneContainer = container.querySelector<HTMLElement>('#focusZone')!
Expand All @@ -420,7 +420,7 @@ it('Should call onActiveDescendantChanged properly', () => {
const activeDescendantChangedCallback = jest.fn()
const controller = focusZone(focusZoneContainer, {
activeDescendantControl: control,
onActiveDescendantChanged: activeDescendantChangedCallback
onActiveDescendantChanged: activeDescendantChangedCallback,
})
type ActiveDescendantChangedCallbackParameters = Parameters<
Exclude<FocusZoneSettings['onActiveDescendantChanged'], undefined>
Expand All @@ -430,37 +430,37 @@ it('Should call onActiveDescendantChanged properly', () => {
expect(activeDescendantChangedCallback).toHaveBeenLastCalledWith<ActiveDescendantChangedCallbackParameters>(
firstButton,
undefined,
false
false,
)
userEvent.type(control, '{arrowdown}')
expect(activeDescendantChangedCallback).toHaveBeenLastCalledWith<ActiveDescendantChangedCallbackParameters>(
secondButton,
firstButton,
true
true,
)
userEvent.type(control, '{arrowup}')
expect(activeDescendantChangedCallback).toHaveBeenLastCalledWith<ActiveDescendantChangedCallbackParameters>(
firstButton,
secondButton,
true
true,
)
fireEvent.mouseMove(secondButton)
expect(activeDescendantChangedCallback).toHaveBeenLastCalledWith<ActiveDescendantChangedCallbackParameters>(
secondButton,
firstButton,
false
false,
)
userEvent.type(control, '{arrowup}')
expect(activeDescendantChangedCallback).toHaveBeenLastCalledWith<ActiveDescendantChangedCallbackParameters>(
firstButton,
secondButton,
true
true,
)
userEvent.type(control, '{arrowUp}')
expect(activeDescendantChangedCallback).toHaveBeenLastCalledWith<ActiveDescendantChangedCallbackParameters>(
firstButton,
firstButton,
true
true,
)
activeDescendantChangedCallback.mockReset()
fireEvent.mouseMove(firstButton)
Expand All @@ -481,7 +481,7 @@ it('Should set aria-activedescendant correctly', () => {
<button tabIndex={0}>Banana</button>
<button tabIndex={0}>Cantaloupe</button>
</div>
</div>
</div>,
)

const focusZoneContainer = container.querySelector<HTMLElement>('#focusZone')!
Expand Down Expand Up @@ -514,7 +514,7 @@ it('Should handle elements being reordered', async () => {
<button tabIndex={0}>Cantaloupe</button>
<button tabIndex={0}>Durian</button>
</div>
</div>
</div>,
)

const focusZoneContainer = container.querySelector<HTMLElement>('#focusZone')!
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/iterate-focusable-elements.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ it('Should iterate through focusable elements only', () => {
</a>
<a href="#yah">Focusable</a>
</div>
</div>
</div>,
)

const focusable = Array.from(iterateFocusableElements(container as HTMLElement, {onlyTabbable: true}))
Expand Down Expand Up @@ -45,7 +45,7 @@ it('Should iterate through focusable elements in reverse', () => {
</a>
<a href="#yah">Focusable</a>
</div>
</div>
</div>,
)

const focusable = Array.from(iterateFocusableElements(container as HTMLElement, {reverse: true, onlyTabbable: true}))
Expand Down
Loading

0 comments on commit 480ea51

Please sign in to comment.