I am trying to create a unit test with Karma Jasmine that interacts with the Dropbox api.
Below is the test. It compiles the directive, then runs a click on it. This checks that the file picker window opens. Checking the window opening in this way works on other tests, but in this instance it fails because ReferenceError: Can't find variable: Dropbox
. This is because its not in the test. The file is hosted directly with Dropbox via http://ift.tt/1DerHLs, so i cannot seem to inject it... So the question is, how do i make Dropbox
available in this case?
it(": clicking button should open Dropbox Picker window", function(){
var element = $compile("<span data-dropbox extensions=\"extensions\"></span>")($scope);
$scope.$digest();
var theButton = element.find('button');
spyOn($window, 'open');
theButton.triggerHandler('click');
expect($window.open).toHaveBeenCalled();
});
Thanks in advance
Aucun commentaire:
Enregistrer un commentaire