NOTE: this is the second step of the Level up: HTML + CSS challenge. Make sure taht you have solved it first.
- Clone this repository.
- Read the "Challenge description" below in order to understand the challenge as a whole.
- Visit Actions page in your repo and check the last workflow.
- At the beggining you should see 5 tests passing and 43 failing.
- Please watch the How to use the auto-grading tests output? video.
- If you cannot see any auto-grading workflows on the Actions page, learn how to fix it in this repo.
- Address each requirement one by one:
- Make required changes to the:
- styles.css file.
- index.html file.
- challenge.js file.
- Open the index.html in your browser in order to check the result of your changes.
- Commit your changes after each step.
- Push your commit to the GitHub repo after each step.
- Wait for the result of the "GitHub Classroom Workflow" action:
- After completing each step you should see more tests passing.
- Once every requirement is fulfilled - congratulations, you solved this challenge!
- Make required changes to the:
- Copy your code from the Level up: HTML + CSS challenge and paste it in the:
- styles.css file.
- index.html file.
- After completing the previous step you should see 41 tests passing and 7 failing.
- Add
challenge.js
as an external script for theindex.html
file (put it inside the tag). - In the
challenge.js
file:- 4.1. Implement the function called
findAllUnorderedListElements
:- It takes no arguments.
- It returns all unordered list's items (the ones that include links to Facebook, Instagram, and Twitter). They should be NodeList objects that are returned by function querySelector or
querySElectorAll
. Common mistake hint: we do not look only for the inner text of those items, we need NodeList objects.
- 4.2 Implement the function called
addWavyUnderline
:- It takes elements as an argument. Elements should be NodeList objects that are returned by function querySelector or
querySElectorAll
. - It iterates through
elements
and adds a style that makes text decorationwavy underline
.
- It takes elements as an argument. Elements should be NodeList objects that are returned by function querySelector or
- 4.1. Implement the function called
- Observe that the
addWavyUnderline
function is called in theDOMContentLoaded
event and takes the result of thefindAllUnorderedListElements
function. Thanks to that once your index.html page is loaded the unordered list's links should get a new style. Verify it in your browser. - In the
challenge.js
file:- 6.1. Implement the function called
prepareProjects
:- It takes 3 arguments -
firstProject
,secondProject
,thirdProject
- It declares an array with a list of projects from the params.
- It iterates through the array with projects and for each project it:
- Checks if the number of chars is bigger than 20:
- If it is it creates a string with the project's name enclosed in the
<p>
tag. - If it is NOT it creates a string with the project's name enclosed in the
<span>
tag.
- If it is it creates a string with the project's name enclosed in the
- It adds a
<br>
tag after each project.
- Checks if the number of chars is bigger than 20:
- It returns a long string with projects enclosed in the
<p>
or<span>
tags.
- It takes 3 arguments -
- 6.2 Implement the function called
displayProjects
:- It finds a div with id =
projects
. - It injects the output of the function
prepareProjects
called with the arguments selected by you into that div.
- It finds a div with id =
- 6.3. Call the
displayProjects
function in theDOMContentLoaded
event.
- 6.1. Implement the function called
- Verify if projects were added to the correct div in your browser.
- Please keep in mind:
findAllUnorderedListElements
andprepareProjects
functions should not change any DOM elements, i.e. they should not interact with the content of your website.addWavyUnderline
anddisplayProjects
functions are supposed to to change DOM elements.
If you cannot see any auto-grading workflows on the Actions page, learn how to fix it in this repo.