{:uriI"file:///Users/izik/www/sparse/izi_lightup/spec/javascripts/crit-utils/mini_require_spec.js?type=application/javascript&pipeline=self&id=b623778d4da186c80169b444035a50a641af14d742d6b3fe681656ae2c91c260:ET:load_pathI"8/Users/izik/www/sparse/izi_lightup/spec/javascripts;T: filenameI"X/Users/izik/www/sparse/izi_lightup/spec/javascripts/crit-utils/mini_require_spec.js;T: nameI"!crit-utils/mini_require_spec;T:logical_pathI")crit-utils/mini_require_spec.self.js;T:content_typeI"application/javascript;T: sourceI"describe("miniRequire", function () { function $$clean() { for (var key in window.__required) { if (__required[key].node) __required[key].node.remove(); delete(__required[key]); } } afterEach(function () { $$clean(); }); it("should exists as global function", function () { expect(miniRequire).toBeDefined(); expect(typeof miniRequire).toBe("function"); }); it("should inject new script", function () { var cnt = document.scripts.length; miniRequire("todo", "/assets/application.js"); expect(document.scripts.length - cnt).toBe(1); }); it("should inject only one script tag", function () { var cnt = document.scripts.length; miniRequire("todo", "/assets/application.js"); miniRequire("todo", "/assets/application.js"); miniRequire("todo", "/assets/application.js"); expect(document.scripts.length - cnt).toBe(1); }); it("should return subscription", function () { var sub = miniRequire("todo", "/assets/application.js"); expect(sub).toBePresent(); expect(sub.started).toBeTruthy(); expect(sub.loaded).toBeFalsy(); expect(sub.node).toBePresent(); }); it("should call callback once script loaded", function () { return new Promise(function (resolve) { var sub = miniRequire("todo", "/assets/application.js", function () { expect(sub.started).toBeTruthy(); expect(sub.loaded).toBeTruthy(); resolve(); }); }); }); }); describe("miniPreload", function () { it("should exists as global function", function () { expect(miniPreload).toBeDefined(); expect(typeof miniPreload).toBe("function"); }); }); ;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"ffile-digest:///Users/izik/www/sparse/izi_lightup/spec/javascripts/crit-utils/mini_require_spec.js;TTF: requiredo;;}F: stubbedo;;}F: linkso;;}F: charsetI" utf-8;F: digest"%!l7QZ uC?Z}7h>: lengthi:dependencies_digest"%t !V-h x fkÝ)|:idI"Eb623778d4da186c80169b444035a50a641af14d742d6b3fe681656ae2c91c260;F: mtimel+6y]b