summaryrefslogtreecommitdiff
path: root/packages/webapi/test/media.js
blob: c1b4607cae9bc7c45d48404b0f1bc60b0a9074f2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { assert, test } from '../run/test.setup.js'
import { polyfill } from '../mod.js'

test(() => {
	return [
		{
			name: 'Includes MediaQueryList functionality',
			test() {
				const target = {}

				polyfill(target)

				assert.equal(Reflect.has(target, 'MediaQueryList'), true)
				assert.equal(Reflect.has(target, 'matchMedia'), true)
			},
		},
		{
			name: 'Supports matchMedia creation',
			test() {
				const target = {}

				polyfill(target)

				const mql = target.matchMedia('(min-width: 640px)')

				assert.equal(mql.matches, false)
				assert.equal(mql.media, '(min-width: 640px)')
			},
		},
	]
})