Skip to content

Commit d0281df

Browse files
committed
test: add definitions of :first-child, :last-child, :only-child
1 parent daebded commit d0281df

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

test/select.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ test('structural pseudo-classes', function (t) {
177177
});
178178

179179
t.test(':first-child', function (t) {
180+
t.deepEqual(select(ast, ':first-child'), select(ast, ':nth-child(1)'));
180181
t.deepEqual(select(ast, ':root:first-child'), []);
181182
t.deepEqual(select(ast, 'heading:first-child'), [path(ast, [0])]);
182183
t.deepEqual(select(ast, 'list listItem:first-child [value]:first-child'), [
@@ -189,6 +190,7 @@ test('structural pseudo-classes', function (t) {
189190
});
190191

191192
t.test(':last-child', function (t) {
193+
t.deepEqual(select(ast, ':last-child'), select(ast, ':nth-last-child(1)'));
192194
t.deepEqual(select(ast, ':root:last-child'), []);
193195
t.deepEqual(select(ast, 'tableCell:last-child *')
194196
.map(function (node) { return node.value }),
@@ -197,6 +199,8 @@ test('structural pseudo-classes', function (t) {
197199
});
198200

199201
t.test(':only-child', function (t) {
202+
t.deepEqual(select(ast, ':only-child'),
203+
select(ast, ':first-child:last-child'));
200204
t.deepEqual(select(ast, ':root:only-child'), []);
201205
t.deepEqual(select(ast, 'table:only-child'), []);
202206
t.deepEqual(select(ast, ':root > *:not(paragraph) > text:only-child')

0 commit comments

Comments
 (0)