DOM Unit Tests

These are unit tests. A series of small tests that challenge you to implement some code that manipulates the DOM in some way. When your code does what is required, the test passes, and you should move on to the next test.

Content for use by tests.

These are the elements that are part of the DOM that your code will access in order to pass the tests.

Find an element by its ID

This is a paragraph.

Add some text to an element

Does it work yet?

Replace the text in an element

𝔯𝔢𝔭𝔩𝔞𝔠𝔢 𝔱𝔥𝔦𝔰

Find all elements matching more complex criteria (selector)

This is a paragraph.

This is also a paragraph.

This too is yet another paragraph.

Set the src, alt & title of an image

dummyimage.com and placebear.com are websites that serve pictures in specific sizes.

Not a bear...

Set the class of an element

In the beginning was the text, and the text was without class, and the developer gave unto it a class, and the class was `interesting`.

Add a class to an element without affecting other classes it has

I am a paragraph with great content, and what more could a paragraph want than an excellent border, as provided by the `excellence` class?

Remove a class from an element without affecting other classes it has

I am a paragraph with great content, however someone put a bit of a `downer` in my classes and with that removed I too could show my excellence.

Fill an empty list with the contents of an array

Remove all elements matching some selection criteria

I love you

I hate you

I love you

I hate you

I love you

I hate you

Reverse the contents of a list

Blast off!

Star Wars Movies

Move an element from one list to the end of another list

Duplicate an element identified by a selector

Duplicate me!

Let user tell us about themself

Name:

Speed:

Student: