Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added a Jasmine test for $.onDemand.use that was missing, for some re…

…ason.
  • Loading branch information...
commit b0bb1dbe5ea9f2a4639524b593fd5d9735788875 1 parent 3983919
@mmarcon authored
Showing with 19 additions and 0 deletions.
  1. +19 −0 test/spec/ondemand.spec.js
View
19 test/spec/ondemand.spec.js
@@ -137,5 +137,24 @@ describe('jQuery OnDemand', function(){
expect(gaaa).toHaveBeenCalledWith('foo', 'bar');
});
+
+ it('Provides a remote object asynchronously on demand', function(){
+ var obj = {
+ rockIt: jasmine.createSpy('rockIt!')
+ };
+ //jQuery getScript mock
+ $.getScript = function(){
+ $.onDemand._proxy.obj = obj;
+ var deferred = $.Deferred();
+ deferred.resolve();
+ return deferred.promise();
+ };
+
+ var promise = $.onDemand.use('obj');
+ promise.done(function(o){
+ o.rockIt();
+ });
+ expect(obj.rockIt).toHaveBeenCalled();
+ });
});
Please sign in to comment.
Something went wrong with that request. Please try again.