blob: db647374b33edb44923b00aa826213394c228a57 [file] [log] [blame]
<html>
<head>
<title>Test CSSOM View module: MediaQueryList interface</title>
<style type="text/css">
</style>
<script type="text/javascript" charset="utf-8">
if (window.testRunner)
testRunner.dumpAsText();
function log(m) {
document.getElementById('results').innerHTML += m + '<br>';
}
function callback1(query) {
log("[1] - query " + query.media + " changed to " + (query.matches ? "true" : "false"));
}
function callback2(query) {
log("[2] - query " + query.media + " changed to " + (query.matches ? "true" : "false"));
}
function runTests()
{
if (!window.testRunner)
return;
testRunner.waitUntilDone();
var query = window.matchMedia("screen");
query.addListener(null);
query.addListener(undefined);
query.removeListener(null);
query.removeListener(undefined);
log("EventListener is optional");
query.addListener(callback1);
try {
query.addListener(5);
} catch (e) {
log("query.addListener(5) threw exception as expected");
}
try {
query.addListener('cinco');
} catch (e) {
log("query.addListener('cinco') threw exception as expected");
}
query.addListener(callback2);
window.internals.settings.setMediaTypeOverride("handheld");
requestAnimationFrame(() => testRunner.notifyDone());
}
</script>
</head>
<body onload="runTests()">
<p>Test the MediaQueryList interface: <a href="http://dev.w3.org/csswg/cssom-view/#the-mediaquerylist-interface" title="CSSOM View Module">http://dev.w3.org/csswg/cssom-view/#the-mediaquerylist-interface</a>.</p>
<p>Invalid listeners. Two callbacks are expected.</p>
<div id="results">
</div>
</body>
</html>