Move code from html file to test.coffee