blob: aec3f9a344cb7a5156f5287aef43c968f4eb9adb [file] [log] [blame]
<!doctype html>
<title>CSS Container Queries Test: custom property style queries</title>
<link rel="help" href="https://drafts.csswg.org/css-contain-3/#style-container">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/cq-testcommon.js"></script>
<style>
#outer {
container-name: outer;
--inner: false;
--outer: true;
--inner-no-space:false;
--outer-no-space:true;
--inner-space-after:false ;
--outer-space-after:true ;
}
#inner {
--inner: true;
--outer: false;
--inner-no-space:true;
--outer-no-space:false;
--inner-space-after:true ;
--outer-space-after:false ;
}
</style>
<div id="outer">
<div id="inner">
<div id="target"></div>
</div>
</div>
<script>
function test_evaluation(query, expected) {
test((t) => {
let style_node = document.createElement('style');
t.add_cleanup(() => {
style_node.remove();
});
style_node.innerText = `@container ${query} { #target { --applied:true; } }`;
assert_equals(getComputedStyle(target).getPropertyValue('--applied'), '');
document.head.append(style_node);
assert_equals(getComputedStyle(target).getPropertyValue('--applied'), expected ? 'true' : '');
}, `${query}`);
}
setup(() => assert_implements_container_queries());
test_evaluation('style(--inner: true)', true);
test_evaluation('style(--inner:true)', true);
test_evaluation('style(--inner:true )', true);
test_evaluation('style(--inner: true )', true);
test_evaluation('style(--inner-no-space: true)', true);
test_evaluation('style(--inner-no-space:true)', true);
test_evaluation('style(--inner-no-space:true )', true);
test_evaluation('style(--inner-no-space: true )', true);
test_evaluation('style(--inner-space-after: true)', true);
test_evaluation('style(--inner-space-after:true)', true);
test_evaluation('style(--inner-space-after:true )', true);
test_evaluation('style(--inner-space-after: true )', true);
test_evaluation('style(--outer: true)', false);
test_evaluation('style(--outer:true)', false);
test_evaluation('style(--outer:true )', false);
test_evaluation('style(--outer: true )', false);
test_evaluation('style(--outer-no-space: true)', false);
test_evaluation('style(--outer-no-space:true)', false);
test_evaluation('style(--outer-no-space:true )', false);
test_evaluation('style(--outer-no-space: true )', false);
test_evaluation('style(--outer-space-after: true)', false);
test_evaluation('style(--outer-space-after:true)', false);
test_evaluation('style(--outer-space-after:true )', false);
test_evaluation('style(--outer-space-after: true )', false);
test_evaluation('outer style(--inner: true)', false);
test_evaluation('outer style(--inner:true)', false);
test_evaluation('outer style(--inner:true )', false);
test_evaluation('outer style(--inner: true )', false);
test_evaluation('outer style(--inner-no-space: true)', false);
test_evaluation('outer style(--inner-no-space:true)', false);
test_evaluation('outer style(--inner-no-space:true )', false);
test_evaluation('outer style(--inner-no-space: true )', false);
test_evaluation('outer style(--inner-space-after: true)', false);
test_evaluation('outer style(--inner-space-after:true)', false);
test_evaluation('outer style(--inner-space-after:true )', false);
test_evaluation('outer style(--inner-space-after: true )', false);
test_evaluation('outer style(--outer: true)', true);
test_evaluation('outer style(--outer:true)', true);
test_evaluation('outer style(--outer:true )', true);
test_evaluation('outer style(--outer: true )', true);
test_evaluation('outer style(--outer-no-space: true)', true);
test_evaluation('outer style(--outer-no-space:true)', true);
test_evaluation('outer style(--outer-no-space:true )', true);
test_evaluation('outer style(--outer-no-space: true )', true);
test_evaluation('outer style(--outer-space-after: true)', true);
test_evaluation('outer style(--outer-space-after:true)', true);
test_evaluation('outer style(--outer-space-after:true )', true);
test_evaluation('outer style(--outer-space-after: true )', true);
</script>