Skip to content

Commit

Permalink
chore(tests): move dpr reactivity case
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyJasonBennett committed May 4, 2024
1 parent 6f8f736 commit f6dea27
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/fiber/tests/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ describe('createRoot', () => {
expect(camera.position.z).toEqual(5)
})

// TODO: deprecate
it('should handle an performance changing functions', async () => {
let store: RootStore = null!
await act(async () => {
Expand Down Expand Up @@ -85,6 +86,20 @@ describe('createRoot', () => {
jest.useRealTimers()
})

it('should handle the DPR prop reactively', async () => {
// Initial clamp
const store = await act(async () => root.configure({ dpr: [1, 2] }).render(<group />))
expect(store.getState().viewport.dpr).toEqual(window.devicePixelRatio)

// Reactive update
await act(async () => store.getState().setDpr(0.1))
expect(store.getState().viewport.dpr).toEqual(0.1)

// Reactive clamp
await act(async () => store.getState().setDpr([1, 2]))
expect(store.getState().viewport.dpr).toEqual(window.devicePixelRatio)
})

it('should set PCFSoftShadowMap as the default shadow map', async () => {
const store = await act(async () => root.configure({ shadows: true }).render(<group />))
const { gl } = store.getState()
Expand Down

0 comments on commit f6dea27

Please sign in to comment.