We're working on edits to the webfundamentals book, and we would like to add autograding to the HTML activecode exercises. This would be done by writing the tests in JavaScript.
For a simple example, for the following exercise:
Create an h1 heading that says "Welcome!", and change the color to blue using the inline style.
this could be verified using tests something like:
assert.strictEqual(document.querySelector('h1').textContent, "Welcome!", "Checking contents of h1 element");
assert.strictEqual(document.querySelector('h1').style.color, "blue", "Checking inline color of h1 element");
We're working on edits to the webfundamentals book, and we would like to add autograding to the HTML activecode exercises. This would be done by writing the tests in JavaScript.
For a simple example, for the following exercise:
Create an h1 heading that says "Welcome!", and change the color to blue using the inline style.
this could be verified using tests something like: