Skip to content

Commit 21909fc

Browse files
test: css supports is not really testable :(
1 parent 0d5b88a commit 21909fc

File tree

1 file changed

+1
-30
lines changed

1 file changed

+1
-30
lines changed

src/test/utils.spec.js

+1-30
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { debounce, computeTooltipPosition, cssTimeToMs, cssSupports } from 'utils'
1+
import { debounce, computeTooltipPosition, cssTimeToMs } from 'utils'
22

33
// Tell Jest to mock all timeout functions
44
jest.useRealTimers()
@@ -86,35 +86,6 @@ describe('compute positions', () => {
8686
})
8787
})
8888

89-
describe('css supports', () => {
90-
let windowSpy
91-
92-
beforeEach(() => {
93-
windowSpy = jest.spyOn(window, 'window', 'get')
94-
})
95-
96-
afterEach(() => {
97-
windowSpy.mockRestore()
98-
})
99-
100-
test('returns true if css property is supported', () => {
101-
expect(cssSupports('position', 'relative')).toBe(true)
102-
})
103-
104-
test('returns false if css property is not supported', () => {
105-
expect(cssSupports('position', 'foo')).toBe(false)
106-
})
107-
108-
test('returns true if `window.CSS.supports` is not available', () => {
109-
windowSpy.mockImplementation(() => ({
110-
CSS: {
111-
supports: undefined,
112-
},
113-
}))
114-
expect(cssSupports('position', 'foo')).toBe(true)
115-
})
116-
})
117-
11889
describe('css time to ms', () => {
11990
test('converts time correctly', () => {
12091
expect(cssTimeToMs('1s')).toBe(1000)

0 commit comments

Comments
 (0)