forked from fingerprintjs/fingerprintjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolor_gamut.test.ts
23 lines (20 loc) · 946 Bytes
/
color_gamut.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { withMockMatchMedia } from '../../tests/utils'
import getColorGamut from './color_gamut'
describe('Sources', () => {
describe('colorGamut', () => {
it('handles browser native value', () => {
const colorGamut = getColorGamut()
expect([undefined, 'srgb', 'p3', 'rec2020']).toContain(colorGamut)
})
it('handles missing browser support', async () => {
await withMockMatchMedia({ 'color-gamut': [undefined] }, true, () => expect(getColorGamut()).toBeUndefined())
})
it('handles various color gamuts', async () => {
await withMockMatchMedia({ 'color-gamut': ['srgb'] }, true, () => expect(getColorGamut()).toBe('srgb'))
await withMockMatchMedia({ 'color-gamut': ['srgb', 'p3'] }, true, () => expect(getColorGamut()).toBe('p3'))
await withMockMatchMedia({ 'color-gamut': ['srgb', 'p3', 'rec2020'] }, true, () =>
expect(getColorGamut()).toBe('rec2020'),
)
})
})
})