Truly independent web browser
<!DOCTYPE html>
<script src="../include.js"></script>
<script src="../work-test.js"></script>
<style>
body { margin: 0; }
#clip { clip-path: inset(50%); width: 50px; height: 50px; }
#child { width: 50px; height: 50px; background: green; }
</style>
<div id="clip"><div id="child"></div></div>
<script>
const hit = () => document.elementFromPoint(10, 10);
visualContextTest({
steps: [
{
name: "clipped away",
check: equal => equal(hit().tagName, "BODY", "hit"),
expect: ``,
},
{
name: "the clip opens",
mutate: () => { clip.style.clipPath = "inset(0)"; },
check: equal => equal(hit().id, "child", "hit"),
expect: `
update DIRTY-PATH
div#clip clip-path UPDATED
div#clip clip-path UPDATED
`,
},
{
name: "the clip closes again",
mutate: () => { clip.style.clipPath = "inset(50%)"; },
check: equal => equal(hit().tagName, "BODY", "hit"),
expect: `
update DIRTY-PATH
div#clip clip-path UPDATED
div#clip clip-path UPDATED
`,
},
],
});
</script>