fix jasmine and add some specs for direction detection