Clean up tests

Instead of storing temporary data in the body element and having the
qUnit read it from the element, the test now uses a global variable
instead. It's not ideal but less invasive to the code base. Maybe I'll
think up a better way later.
Also break the test variable down.
Clean up source file

Switch from if-else structure to use switch case instead.
Stop writing key data into the body tag's data.
Clean up the logic checking variables.