2022-03-07 16:36:22 -05:00
|
|
|
import { assert, test } from '../run/test.setup.js'
|
|
|
|
import { polyfill } from '../mod.js'
|
|
|
|
|
|
|
|
test(() => {
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
name: 'Includes MediaQueryList functionality',
|
|
|
|
test() {
|
|
|
|
const target = {}
|
2022-03-07 16:37:50 -05:00
|
|
|
|
2022-03-07 16:36:22 -05:00
|
|
|
polyfill(target)
|
2022-03-07 16:37:50 -05:00
|
|
|
|
2022-03-07 16:36:22 -05:00
|
|
|
assert.equal(Reflect.has(target, 'MediaQueryList'), true)
|
|
|
|
assert.equal(Reflect.has(target, 'matchMedia'), true)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Supports matchMedia creation',
|
|
|
|
test() {
|
|
|
|
const target = {}
|
2022-03-07 16:37:50 -05:00
|
|
|
|
2022-03-07 16:36:22 -05:00
|
|
|
polyfill(target)
|
|
|
|
|
|
|
|
const mql = target.matchMedia('(min-width: 640px)')
|
|
|
|
|
|
|
|
assert.equal(mql.matches, false)
|
|
|
|
assert.equal(mql.media, '(min-width: 640px)')
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|
|
|
|
})
|