Adding UI unit tests

Code coverage of ui.js is now 100%.

I'm slightly concerned about the usage/scope of the settings passed into <code>setupUI</code>. There was a "gotcha" type comment there that I tidied up. The settings getter never worked as intended. I think my code is OK, however a decision is to be made on the usage of settings. Thanks!