Here's an update with the Jasmine test code included. That test now reports each time that we run the code, and will continue to check that things are as expected each time the code is run,
It's always harder to add tests in afterwards, partly because there's less incentive to because the code is already working.
Because of that, it's a better work habit to start with a test first, and then write test to make it pass. That's similar to writing out a work order for a contractor, and after the contractor has done the work, his work can be checked against the work order. If he hasn't properly completed the contract, he gets sent back to do it again more properly, until all of the tests pass.
We can now go ahead with making changes to the code. Normally we would have other tests to ensure that the button still plays properly too, but those things can be added when changes occur that require other tests to be added.
I'll take a look at the code now and figure out what is the easiest way to make the test pass.