astro/packages/webapi/test/media.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
621 B
JavaScript
Raw Normal View History

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)')
},
},
]
})