{:uriI"Äfile:///Users/izik/www/sparse/izi_lightup/spec/javascripts/crit-utils/wait_for_spec.js?type=application/javascript&pipeline=self&id=83d307f8ae1b061f31dc8a940c84976bb5fb331d228510755613930fc660c5e8:ET:load_pathI"8/Users/izik/www/sparse/izi_lightup/spec/javascripts;T: filenameI"T/Users/izik/www/sparse/izi_lightup/spec/javascripts/crit-utils/wait_for_spec.js;T: nameI"crit-utils/wait_for_spec;T:logical_pathI"%crit-utils/wait_for_spec.self.js;T:content_typeI"application/javascript;T: sourceI"ddescribe("waitFor", function () { var $clock; beforeEach(function () { $clock = jasmine.clock(); }); it("should exists as global function", function () { expect(waitFor).toBeDefined(); expect(typeof waitFor).toBe("function"); }); it("should return curried fn to pass callback", function () { expect(typeof waitFor("SOMEWHAT")).toBe("function"); }); it("should call callback", function () { return new Promise(function(resolve) { waitFor("jQuery")(function() { expect(jQuery).toBeDefined(); resolve(); }); }); }); it("should wait for required global variable", function () { $clock.install(); return new Promise(function(resolve) { var KEY = "key" + Math.random(); expect(window[KEY]).toBeUndefined(); $clock.tick(500); setTimeout(function () { window[KEY] = "TODO"; }, 500); $clock.tick(500); waitFor(KEY)(function () { expect(window[KEY]).toBeDefined(); $clock.uninstall(); resolve(); }); }); }); it("should fail by timeout", function () { $clock.install(); return new Promise(function(resolve) { var KEY = "key" + Math.random(); expect(window[KEY]).toBeUndefined(); setTimeout(function() { $clock.tick(30000); $clock.tick(1000); window[KEY] = "TODO"; $clock.tick(1000); }, 100); $clock.tick(500); waitFor(KEY)(function () { expect(window[KEY]).toBeDefined(); $clock.uninstall(); resolve(); }, function () { resolve(); }); }); }); }); ;T: metadata{ :dependencieso:Set: @hash} I"environment-version;TTI"environment-paths;TTI"rails-env;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTI"bfile-digest:///Users/izik/www/sparse/izi_lightup/spec/javascripts/crit-utils/wait_for_spec.js;TTF: requiredo;;}F: stubbedo;;}F: linkso;;}F: charsetI" utf-8;F: digest"%ú}ã× µQ‰1XóSUvq'ùþ‡0¾lø€øˆ©àm¾&: lengthid:dependencies_digest"%y…Tb„HA\G\¾ìƒ¢ZES|vy…¢m¹q^pI¬8:idI"E83d307f8ae1b061f31dc8a940c84976bb5fb331d228510755613930fc660c5e8;F: mtimel+y;]b