fix: improve tests in travel agency lab (#57743)

This commit is contained in:
Ilenia 2024-12-25 21:22:13 +01:00 committed by GitHub
parent 077db2d9ff
commit 779bb5a574
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -142,7 +142,7 @@ assert.strictEqual(
You should have two items in your unordered list.
```js
assert.lengthOf(document.querySelectorAll('li'), 2);
assert.lengthOf(document.querySelectorAll('p + ul li'), 2);
```
Both your list items should contain an anchor element.
@ -205,17 +205,25 @@ Each `figure` element should contain a `figcaption` element as its second child.
const figures = document.querySelectorAll('figure');
assert.isNotEmpty(figures);
for (let figure of figures) {
assert.equal(figure.children[1].tagName, 'FIGCAPTION');
assert.equal(figure.children[1]?.tagName, 'FIGCAPTION');
}
```
Each `figcaption` should contain some text.
```js
const figcaptionEls = document.querySelectorAll('figcaption');
assert.isNotEmpty(figcaptionEls);
figcaptionEls.forEach((figcaption => assert.isNotEmpty(figcaption.innerText)));
```
Each of the `a` elements that are children of your `figure` elements should contain an image.
```js
const anchors = document.querySelectorAll('figure > a');
assert.isNotEmpty(anchors);
for (let anchor of anchors) {
assert.equal(anchor.children[0].tagName, 'IMG');
assert.equal(anchor.children[0]?.tagName, 'IMG');
}
```