Implementing a JavaScript widget and a Jasmine test for unit testing