Added Jasmine testing framework with tests and modified dirtyflag

As you requested, I am submitting a pull request with tests for the dirtyflag. I am also submitting a suggested change for the dirtyflag. There is no need to call dirtyFlag as a function to find out if it is dirty.