Skip to content

Commit f61604b

Browse files
author
Luke Bowerman
authored
refactor(ComponentsProvider): Rename snapshotMode to disableStyleDefender (#2350)
1 parent 7929f54 commit f61604b

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

packages/components-providers/src/ComponentsProvider.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,11 @@ export interface ComponentsProviderProps
5959
* StyledDefender is a utility component that attempts to ensure that a few common
6060
* styles are injected at any point where @looker/components are injected into the DOM.
6161
* When taking code-snapshots (a pattern we generally discourage) the `StyleDefender`
62-
* may be visible in output. Enabling `snapshotMode` disables StyleDefender to narrow
63-
* snapshot output.
62+
* may be visible in output so we generally recommend disabling it for those use-cases.
6463
*
6564
* @default false
6665
*/
67-
snapshotMode?: boolean
66+
disableStyleDefender?: boolean
6867

6968
/**
7069
* Prevent automatic injection of a basic CSS-reset into the DOM
@@ -101,7 +100,7 @@ export const ComponentsProvider: FC<ComponentsProviderProps> = ({
101100
children,
102101
loadFontSources = true,
103102
loadGoogleFonts = false,
104-
snapshotMode = false,
103+
disableStyleDefender = false,
105104
locale,
106105
resources,
107106
themeCustomizations,
@@ -125,7 +124,9 @@ export const ComponentsProvider: FC<ComponentsProviderProps> = ({
125124

126125
useI18n({ locale, resources })
127126

128-
const ConditionalStyleDefender = snapshotMode ? Fragment : StyleDefender
127+
const ConditionalStyleDefender = disableStyleDefender
128+
? Fragment
129+
: StyleDefender
129130

130131
return (
131132
<HelmetProvider>

packages/components-test-utils/src/create_with_theme.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import 'jest-styled-components'
3030
import React, { ReactElement } from 'react'
3131

3232
export const withThemeProvider = (Component: ReactElement<any>) => (
33-
<ComponentsProvider snapshotMode>{Component}</ComponentsProvider>
33+
<ComponentsProvider disableStyleDefender>{Component}</ComponentsProvider>
3434
)
3535

3636
export const renderWithTheme = (

0 commit comments

Comments
 (0)