Skip to content

Commit b352e0c

Browse files
danielbariongabrieljablonski
authored andcommitted
chore: remove cssSupport util and his usage
1 parent d8b2444 commit b352e0c

File tree

5 files changed

+1
-56
lines changed

5 files changed

+1
-56
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 & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
import {
2-
debounce,
3-
deepEqual,
4-
computeTooltipPosition,
5-
cssTimeToMs,
6-
cssSupports,
7-
clearTimeoutRef,
8-
} from 'utils'
1+
import { debounce, deepEqual, computeTooltipPosition, cssTimeToMs, clearTimeoutRef } from 'utils'
92
import { injectStyle } from 'utils/handle-style.ts'
103

114
describe('compute positions', () => {
@@ -306,18 +299,3 @@ describe('handleStyle', () => {
306299
expect(styleElement.innerHTML).toBe(`body { background: 'red' }`)
307300
})
308301
})
309-
310-
describe('check for CSS attribute support on current page', () => {
311-
test('CSS attribute should be supported in global Window', () => {
312-
const hasSupportToOpacity = cssSupports('opacity', '1')
313-
314-
expect(hasSupportToOpacity).toBe('1')
315-
})
316-
317-
test('CSS attribute should not be supported in global Window', () => {
318-
// not a valid css attribute
319-
const hasSupportToOpacity = cssSupports('lorem', '100')
320-
321-
expect(hasSupportToOpacity).toBe(false)
322-
})
323-
})

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'
@@ -11,7 +10,6 @@ import clearTimeoutRef from './clear-timeout-ref'
1110
export type { IComputedPosition }
1211
export {
1312
computeTooltipPosition,
14-
cssSupports,
1513
cssTimeToMs,
1614
debounce,
1715
deepEqual,

0 commit comments

Comments
 (0)