Skip to content

Commit

Permalink
test(DPxAI:Quest00/Ex01): Duplicating the tests instead of overriding…
Browse files Browse the repository at this point in the history
… the existing ones: the-skelton and call-it
  • Loading branch information
Oumaimafisaoui authored and nprimo committed Jul 23, 2024
1 parent ed9afe7 commit 39bcca4
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 0 deletions.
File renamed without changes.
25 changes: 25 additions & 0 deletions dom/skeleton_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export const tests = []

tests.push(async ({ page, eq }) => {
// check that the title tag is present & is set with some text
const title = await page.$eval('title', (node) => node.textContent)
if (!title.length) throw Error('missing title')
})

tests.push(async ({ page, eq }) => {
// check the face

return eq.$('section:nth-child(1)', { textContent: 'face' })
})

tests.push(async ({ page, eq }) => {
// check the upper-body

return eq.$('section:nth-child(2)', { textContent: 'upper-body' })
})

tests.push(async ({ page, eq }) => {
// check the lower-body, my favorite part

return eq.$('section:nth-child(3)', { textContent: 'lower-body' })
})
19 changes: 19 additions & 0 deletions dom/the-calling_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export const tests = []

tests.push(async ({ page, eq }) => {
// check the face

return eq.$('section#face', { textContent: '' })
})

tests.push(async ({ page, eq }) => {
// check the upper-body

return eq.$('section#upper-body', { textContent: '' })
})

tests.push(async ({ page, eq }) => {
// check the lower-body, my favorite part

return eq.$('section#lower-body', { textContent: '' })
})
File renamed without changes.
41 changes: 41 additions & 0 deletions subjects/DPxAI/call_it/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
## Call it

> Brainpower mode
### Context

Congrats! You created the very first base for your entity and you witnessed its appearance in the Digital
World - your browser.. However, it is still a tiny seed of the marvelous thing it could become. Be patient;
there's still a bit of work to do.

### Directions

First of all, instead of writing down what things are _(you're not writing down on your hand the word 'hand',
are you?)_, we're going to identify them semantically with the very practical [id
attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attri butes/id). This `id` has to be a **unique**
identifier on your webpage, allowing you to target your element when needed. You can compare it to your name and
surname; this is what identifies you to other people, and if someone's calling you by your name, you answer.

### Instructions

So let's identify the 3 elements we have so far: in each section, remove the text content from inside the tag
and set it as the value of the `id` attribute of the corresponding `section` text.

**Run your code in the editor preview:** \
you don't see _anything_? Don't freak out! \
Inspect the HTML that has been created with your
[browser inspector tool](https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_are_browser_developer_tools),
and if you done it correctly, you should see the 3 sections inside the `body` with the `id` attribute set in
your HTML structure.

### Code examples

To set the `id` of a `div` tag to `"my-lil-div"`:

```html
<div id="my-lil-div"></div>
```

### Notions

- [`id` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id)

0 comments on commit 39bcca4

Please sign in to comment.