Skip to content

Commit

Permalink
capricorn86#686@trivial: Add test no number before 'n'.
Browse files Browse the repository at this point in the history
  • Loading branch information
takaya1992 committed Jan 5, 2023
1 parent 3ef9a2a commit a54feaf
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/happy-dom/test/query-selector/QuerySelector.test.ts
Expand Up @@ -470,6 +470,16 @@ describe('QuerySelector', () => {
expect(elements[1]).toBe(container.children[0].children[1].children[1]);
});

it('Returns all elements matching ":nth-child(n+8)".', () => {
const container = document.createElement('div');
container.innerHTML = QuerySelectorNthChildHTML;
const elements = container.querySelectorAll(':nth-child(n+8)');

expect(
elements.map((element) => `${element.tagName.toLowerCase()}.${element.className}`)
).toEqual(['span.n8', 'div.n9', 'i.n10']);
});

it('Returns all elements matching :nth-child(2n).', () => {
const container = document.createElement('div');
container.innerHTML = QuerySelectorNthChildHTML;
Expand Down

0 comments on commit a54feaf

Please sign in to comment.