From 7024bdd0c33d99659caf6b6dfd1257f7215a851d Mon Sep 17 00:00:00 2001 From: "asamuzaK (Kazz)" Date: Sat, 4 May 2024 13:57:51 +0900 Subject: [PATCH] Update wpt.test.js (#70) Fix #67 --- test/wpt.test.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/test/wpt.test.js b/test/wpt.test.js index 429fe45d..43e09444 100644 --- a/test/wpt.test.js +++ b/test/wpt.test.js @@ -110,6 +110,38 @@ describe('local wpt test cases', () => { } }); + describe('css/css-scoping/host-defined.html', () => { + it('should match', () => { + const node = document.createElement('div'); + node.id = 'host'; + document.body.appendChild(node); + const root = node.attachShadow({ mode: 'open' }); + root.innerHTML = '
'; + const res = root.firstElementChild.matches(':host > div'); + assert.isTrue(res, 'result'); + }); + + it('should match', () => { + const node = document.createElement('div'); + node.id = 'host'; + document.body.appendChild(node); + const root = node.attachShadow({ mode: 'open' }); + root.innerHTML = '
'; + const res = root.firstElementChild.matches(':not(:defined) > div'); + assert.isTrue(res, 'result'); + }); + + it('should not match', () => { + const node = document.createElement('div'); + node.id = 'host'; + document.body.appendChild(node); + const root = node.attachShadow({ mode: 'open' }); + root.innerHTML = '
'; + const res = root.firstElementChild.matches(':defined > div'); + assert.isFalse(res, 'result'); + }); + }); + describe('css/css-scoping/host-dom-001.html', () => { it('should not match', () => { const node = document.createElement('div');