1

I'm working on a new project that uses AngularJS, one of the goals that we have for this project is that it's build using TDD. I'm having some issues testing a directive that uses Popcorn.js to embed video.

Here is a link to some sample code

and here is a sample of the test I'm trying to run,

it('Should load HTML5 video', function() {
    var videoLoadedListener = jasmine.createSpy('listener');
    rootScope.$on('videoLoaded', videoLoadedListener);

    element = angular.element('<player></player>');
    element = compile(element)(rootScope);

    expect(element.find("video").length).toBe(1);
    expect(videoLoadedListener).toHaveBeenCalled();
});

I'm getting an error from the test, 'Specified target player was not found.' which is from Popcorn.js not being able to find the div to insert the video into.

I'm using Karma with both PhantomJS and Chrome. Code seems to work fine, it's just the test that is not working.

4

0 回答 0