Make tests DRY and add more debug output
Ignore trailing whitespace in style attribute test

Fix PhantomJS test failures

In PhantomJS, jQuery is appending a <space> to "display: none;", so use a startswith selector to test visiblity.