Fix test assertions

Make sure we're asserting the correct thing when testing visible and
invisible DOM elements.