I had no good way of testing this, so this is what I came up with (reproduced below)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('updates chapter position property to match audio player position', function () { | |
bppg.generatePage({book: BOOK_OBJECT, chapter: chapterObjInstance}); | |
chapterObjInstance.position = -1 // set the position to a nonzero value | |
var dom_ele = $('#audioSource').trigger('timeupdate'); | |
expect(chapterObjInstance.position).equal(0); | |
}); |
It's times like this that I realize I have no idea what I'm doing when it comes to testing HTML elements.
Ahh, Mr. Hirschberg, but the fact that you know what you don't know is a strong sign that you're well on the way to figuring it out! ;-)
ReplyDelete