{:uriI"file:///Users/izik/www/sparse/izi_lightup/spec/javascripts/crit-utils/mini_require_spec.js?type=application/javascript&pipeline=self&id=5e45ffd9390a7206cc942ee8cde7f4e24ff07fd0281fc7042224de347650cfcc: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).toBeDefined(); }); 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"%괟G6['SJzgBG: lengthi:dependencies_digest"%`3 < g^\`LpS=hULq\U:idI"E5e45ffd9390a7206cc942ee8cde7f4e24ff07fd0281fc7042224de347650cfcc;F: mtimel+fy]b