This is a run-through of one developer's approach to Test the Web Forward. It will show you ways you can be involved, some of the challenges you may face, and the reward at the end.
I was faced with this challenge:
look over a web specification similar to https://html.spec.whatwg.org/multipage/tables.html#htmltableelement (focus on the “DOM interface” and specification of each method there) and tell us what tests you would write.
I had a read of the spec and was surprised by all the methods I'd never heard of. I picked deleteCaption()
as a place to start. It seemed relatively straightforward, with this one line description:
The
deleteCaption()
method must remove the firstcaption
element child of thetable
element, if any.
Tip: take the quiz on understanding web specifications!
I had feedback from James Graham and Josh Matthews about the tests I wrote—generally positive although they did highlight that there was a failure in Firefox.
This was due to using innerText
. Switching to textContent
resolved that issue.
See the Pen HTMLTableElement tests by Ben Boyle (@bboyle) on CodePen.
innerText
is not standard—textContent
is probably what you want (but not exactly the same)innerHTML
is standardI had the opportunity to port my initial tests to Test the Web Forward. JavaScript tests are run by testharness.js. If you've used any JavaScript unit testing or assertion libraries before, you'll likely find it quite familiar. Read the Testharness.js API Documentation for more info, or try the tutorial using testharness.js.
James suggested 2 extra test cases: caption elements in nested tables, and caption elements from another namespace. I added these tests with his help.
See the Pen deleteCaption() tests by Ben Boyle (@bboyle) on CodePen.
The ultimate goal of writing tests is to improve Test the Web Forward. To do this I had to setup a local test environment and follow the process for submitting tests.