Fixed tests which worked in browser but didn't in phantomjs.
Merge pull request #321 from mbucknell/NAWQAAN-229

Fixed tests which worked in browser but didn't in phantomjs.