Vid-1129

RFCR @garthwebb 

Adds unit tests to cover the more important parts of the Lightbox controller code. Also makes a few improvements to the code itself.

More coverage can be added as time permits.

https://wikia-inc.atlassian.net/browse/VID-1129

What's the purpose of this function?