Skip to content
Open
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
11 changes: 11 additions & 0 deletions src/__tests__/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ describe('configuration API', () => {

expect(getConfig().reactStrictMode).toBe(true)
})

test('configure without reactStrictMode preserves the existing value', () => {
configure({reactStrictMode: true})
configure({testIdAttribute: 'not-data-testid'})

expect(getConfig().reactStrictMode).toBe(true)

configure({reactStrictMode: false})

expect(getConfig().reactStrictMode).toBe(false)
})
})

test('configure can set DTL and RTL options at once', () => {
Expand Down
4 changes: 3 additions & 1 deletion src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ function configure(newConfig) {

configForRTL = {
...configForRTL,
reactStrictMode,
// Only overwrite the existing value when a new one is provided,
// so calling configure() for other options keeps reactStrictMode.
reactStrictMode: reactStrictMode ?? configForRTL.reactStrictMode,
}
}

Expand Down
Loading