Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions oxlint.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { tanstackConfig } from '@tanstack/oxlint-config'
import pluginJestDom from 'eslint-plugin-jest-dom'
import { defineConfig } from 'oxlint'

export default defineConfig({
Expand All @@ -24,7 +25,11 @@ export default defineConfig({
overrides: [
{
files: ['**/*.spec.ts*', '**/*.test.ts*', '**/*.test-d.ts*'],
jsPlugins: [{ name: 'jest-dom', specifier: 'eslint-plugin-jest-dom' }],
rules: {
...pluginJestDom.configs['flat/recommended'].rules,
// `toHaveTextContent` matches substrings, so exact `textContent` checks stay as `toBe`
'jest-dom/prefer-to-have-text-content': 'off',
'vitest/consistent-each-for': [
'error',
{ describe: 'each', it: 'each' },
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
"@tanstack/vite-config": "0.4.3",
"@testing-library/jest-dom": "^6.8.0",
"@types/node": "^22.15.2",
"eslint-plugin-jest-dom": "^5.12.0",
"eslint-plugin-unused-imports": "^4.2.0",
"jsdom": "^27.0.0",
"knip": "^5.64.0",
Expand Down
24 changes: 14 additions & 10 deletions packages/devtools/src/components/trigger.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,14 @@ describe('the drag tooltip', () => {
const button = getByLabelText('Open TanStack Devtools')

drag(button, 'pointerdown', 400, 400)
expect(queryByText(/magnetic mode/)).not.toBeNull()
expect(queryByText(/magnetic mode/)).toBeInTheDocument()

fireEvent.mouseLeave(button)
drag(button, 'pointermove', 700, 300)
expect(queryByText(/magnetic mode/)).not.toBeNull()
expect(queryByText(/magnetic mode/)).toBeInTheDocument()

drag(button, 'pointerup', 700, 300)
expect(queryByText(/magnetic mode/)).toBeNull()
expect(queryByText(/magnetic mode/)).not.toBeInTheDocument()
})

it('gets out of the way while the drag is still going', () => {
Expand All @@ -329,13 +329,13 @@ describe('the drag tooltip', () => {
const button = getByLabelText('Open TanStack Devtools')

drag(button, 'pointerdown', 400, 400)
expect(queryByText(/magnetic mode/)).not.toBeNull()
expect(queryByText(/magnetic mode/)).toBeInTheDocument()

advanceTimers(1500)
expect(queryByText(/magnetic mode/)).toBeNull()
expect(queryByText(/magnetic mode/)).not.toBeInTheDocument()

drag(button, 'pointermove', 500, 400)
expect(queryByText(/magnetic mode/)).toBeNull()
expect(queryByText(/magnetic mode/)).not.toBeInTheDocument()
} finally {
vi.useRealTimers()
}
Expand All @@ -350,11 +350,11 @@ describe('the drag tooltip', () => {
drag(button, 'pointerdown', 400, 400)
drag(button, 'pointerup', 400, 400)
drag(button, 'pointerdown', 400, 400)
expect(queryByText(/magnetic mode/)).not.toBeNull()
expect(queryByText(/magnetic mode/)).toBeInTheDocument()

drag(button, 'pointercancel', 400, 400)
fireEvent.mouseLeave(button)
expect(queryByText(/magnetic mode/)).toBeNull()
expect(queryByText(/magnetic mode/)).not.toBeInTheDocument()
})
})

Expand Down Expand Up @@ -600,7 +600,9 @@ describe('dragging the trigger off screen', () => {
drag(undocked, 'pointerup', 800, 400)

expect(storedSettings().triggerEdge).toBeUndefined()
expect(undocked.style.left).toBe(`${800 - undocked.offsetWidth / 2}px`)
expect(undocked).toHaveStyle({
left: `${800 - undocked.offsetWidth / 2}px`,
})
expect(
queryByLabelText('Open TanStack Devtools (docked)'),
).not.toBeInTheDocument()
Expand Down Expand Up @@ -662,7 +664,9 @@ describe('dragging the trigger off screen', () => {
drag(button, 'pointerup', 500, 400)

expect(getByLabelText('Open TanStack Devtools')).toBeInTheDocument()
expect(queryByLabelText('Open TanStack Devtools (docked)')).toBeNull()
expect(
queryByLabelText('Open TanStack Devtools (docked)'),
).not.toBeInTheDocument()
expect(storedSettings().triggerEdge).toBeUndefined()
})
})
Expand Down
4 changes: 2 additions & 2 deletions packages/devtools/src/tabs/settings-tab.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ describe('SettingsTab', () => {

// The "URL flag" Input is gated behind <Show when={settings().requireUrlFlag}>,
// so it is absent until the store is mutated.
expect(queryByText('URL flag')).toBeNull()
expect(queryByText('URL flag')).not.toBeInTheDocument()

// Mutate settings through the provider's setter obtained from context.
setSettings({ requireUrlFlag: true })

// The Show block reacts to the store change and mounts the Input.
expect(queryByText('URL flag')).not.toBeNull()
expect(queryByText('URL flag')).toBeInTheDocument()
})

it('reflects controlled `checked` updates: toggling defaultOpen flips the "Default open" checkbox', () => {
Expand Down
29 changes: 28 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading