Skip to content

Commit d2fd670

Browse files
committed
chore: remove cssSupport util and his usage
1 parent 4fefbe4 commit d2fd670

File tree

5 files changed

+1
-49
lines changed

5 files changed

+1
-49
lines changed

src/components/TooltipController/TooltipController.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import type {
99
ITooltip,
1010
TooltipRefProps,
1111
} from 'components/Tooltip/TooltipTypes'
12-
import { cssSupports } from 'utils'
1312
import clsx from 'clsx'
1413
import type { ITooltipController } from './TooltipControllerTypes'
1514

@@ -250,18 +249,10 @@ const TooltipController = React.forwardRef<TooltipRefProps, ITooltipController>(
250249
// eslint-disable-next-line no-console
251250
console.warn('[react-tooltip] Do not set `style.border`. Use `border` prop instead.')
252251
}
253-
if (border && !cssSupports('border', `${border}`)) {
254-
// eslint-disable-next-line no-console
255-
console.warn(`[react-tooltip] "${border}" is not a valid \`border\`.`)
256-
}
257252
if (style?.opacity) {
258253
// eslint-disable-next-line no-console
259254
console.warn('[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead.')
260255
}
261-
if (opacity && !cssSupports('opacity', `${opacity}`)) {
262-
// eslint-disable-next-line no-console
263-
console.warn(`[react-tooltip] "${opacity}" is not a valid \`opacity\`.`)
264-
}
265256
}, [border, opacity, style?.border, style?.opacity])
266257

267258
/**

src/test/jest-setup.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,3 @@ global.ResizeObserver = jest.fn().mockImplementation(() => ({
77
unobserve: jest.fn(),
88
disconnect: jest.fn(),
99
}))
10-
11-
global.CSS = {
12-
supports: (key, value) => {
13-
if (key === 'opacity') {
14-
return value
15-
}
16-
17-
return false
18-
},
19-
}

src/test/utils.spec.js

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { debounce, deepEqual, computeTooltipPosition, cssTimeToMs, cssSupports } from 'utils'
1+
import { debounce, deepEqual, computeTooltipPosition, cssTimeToMs } from 'utils'
22
import { injectStyle } from 'utils/handle-style.ts'
33

44
describe('compute positions', () => {
@@ -283,18 +283,3 @@ describe('handleStyle', () => {
283283
expect(styleElement.innerHTML).toBe(`body { background: 'red' }`)
284284
})
285285
})
286-
287-
describe('check for CSS attribute support on current page', () => {
288-
test('CSS attribute should be supported in global Window', () => {
289-
const hasSupportToOpacity = cssSupports('opacity', '1')
290-
291-
expect(hasSupportToOpacity).toBe('1')
292-
})
293-
294-
test('CSS attribute should not be supported in global Window', () => {
295-
// not a valid css attribute
296-
const hasSupportToOpacity = cssSupports('lorem', '100')
297-
298-
expect(hasSupportToOpacity).toBe(false)
299-
})
300-
})

src/utils/css-supports.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/utils/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { IComputedPosition } from './compute-tooltip-position-types'
22
import computeTooltipPosition from './compute-tooltip-position'
3-
import cssSupports from './css-supports'
43
import cssTimeToMs from './css-time-to-ms'
54
import debounce from './debounce'
65
import deepEqual from './deep-equal'
@@ -10,7 +9,6 @@ import useIsomorphicLayoutEffect from './use-isomorphic-layout-effect'
109
export type { IComputedPosition }
1110
export {
1211
computeTooltipPosition,
13-
cssSupports,
1412
cssTimeToMs,
1513
debounce,
1614
deepEqual,

0 commit comments

Comments
 (0)