blob: 1cb290de3feb584bf9dc63e8090f6b31dd10eeb9 [file] [log] [blame]
<!doctype html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
async_test(function (test) {
const iframe = document.createElement("iframe");
iframe.src = "resources/css-module-basic-iframe.html";
iframe.onload = test.step_func_done(function () {
assert_equals(getComputedStyle(iframe.contentDocument.querySelector('#test'))
.backgroundColor, "rgb(255, 0, 0)",
"CSS module import should succeed");
});
document.body.appendChild(iframe);
}, "A CSS Module should load");
async_test(function (test) {
const iframe = document.createElement("iframe");
iframe.src = "resources/css-module-at-import-iframe.html";
iframe.onload = test.step_func_done(function () {
assert_equals(iframe.contentDocument.load_error, undefined);
assert_not_equals(getComputedStyle(iframe.contentDocument.querySelector('#test'))
.backgroundColor, "rgb(255, 0, 0)",
"CSS module @import should not succeed");
});
document.body.appendChild(iframe);
}, "An @import CSS Module should not load, but should not throw an exception");
async_test(function (test) {
const iframe = document.createElement("iframe");
iframe.src = "resources/malformed-iframe.html";
iframe.onload = test.step_func_done(function () {
assert_not_equals(getComputedStyle(iframe.contentDocument.querySelector('#test'))
.backgroundColor, "rgb(255, 0, 0)",
"Malformed CSS should not load");
});
document.body.appendChild(iframe);
}, "Malformed CSS should not load");
</script>
</body>