Skip to content

Commit

Permalink
test: updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Anidetrix committed Jun 17, 2020
1 parent 49b18ff commit 15f0b79
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 98 deletions.
87 changes: 0 additions & 87 deletions __tests__/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3385,93 +3385,6 @@ console.log(modules_06c16b9a.module, modules_c2f65cd3.composition, modules_b033f
"
`;

exports[`modules inject-object: js 1`] = `
"/** @type {HTMLElement[]} */
var containers = [];
/** @type {{prepend:HTMLStyleElement,append:HTMLStyleElement}[]} */
var styleTags = [];
/**
* @param {string} css
* @param {object} [options={}]
* @param {boolean} [options.prepend]
* @param {boolean} [options.singleTag]
* @param {string} [options.container]
* @param {Record<string,string>} [options.attributes]
* @returns {void}
*/
function injector_86728f90 (css, options) {
if (!css || typeof document === \\"undefined\\") return;
if (typeof options === \\"undefined\\") options = {};
var position = options.prepend === true ? \\"prepend\\" : \\"append\\";
var singleTag = typeof options.singleTag !== \\"undefined\\" ? options.singleTag : false;
var container =
typeof options.container !== \\"undefined\\"
? document.querySelector(options.container)
: document.getElementsByTagName(\\"head\\")[0];
function createStyleTag() {
var styleTag = document.createElement(\\"style\\");
styleTag.setAttribute(\\"type\\", \\"text/css\\");
if (options.attributes) {
var k = Object.keys(options.attributes);
for (var i = 0; i < k.length; i++) {
styleTag.setAttribute(k[i], options.attributes[k[i]]);
}
}
var pos = position === \\"prepend\\" ? \\"afterbegin\\" : \\"beforeend\\";
container.insertAdjacentElement(pos, styleTag);
return styleTag;
}
/** @type {HTMLStyleElement} */
var styleTag;
if (singleTag) {
var id = containers.indexOf(container);
if (id === -1) {
id = containers.push(container) - 1;
styleTags[id] = {};
}
if (styleTags[id] && styleTags[id][position]) {
styleTag = styleTags[id][position];
} else {
styleTag = styleTags[id][position] = createStyleTag();
}
} else {
styleTag = createStyleTag();
}
// strip potential UTF-8 BOM if css was read from a file
if (css.charCodeAt(0) === 0xfeff) css = css.substring(1);
if (styleTag.styleSheet) {
styleTag.styleSheet.cssText += css;
} else {
styleTag.appendChild(document.createTextNode(css));
}
}
const css_6856db17 = \\".style_module {\\\\n color: #1F4F7F;\\\\n}\\\\n\\\\n.style_module2 {\\\\n}\\\\n\\";
const modules_06c16b9a = {\\"primary\\":\\"#BF4040\\",\\"secondary\\":\\"#1F4F7F\\",\\"module\\":\\"style_module\\",\\"module2\\":\\"style_module2 composed_composition composition2_compositioned\\"};
injector_86728f90(css_6856db17);
const css_99f8382e = \\"@media screen and (min-width: 900px) {\\\\n .composed_composition {\\\\n background-color: aqua;\\\\n }\\\\n}\\\\n\\\\n.composed_composition {\\\\n background-color: #BF4040;\\\\n}\\\\n\\";
const modules_c2f65cd3 = {\\"primary\\":\\"#BF4040\\",\\"composition\\":\\"composed_composition composition2_compositioned\\"};
injector_86728f90(css_99f8382e);
const css_1f7ddd56 = \\".composition2_compositioned {\\\\n width: 30%;\\\\n}\\\\n\\";
const modules_b033f21c = {\\"compositioned\\":\\"composition2_compositioned\\"};
injector_86728f90(css_1f7ddd56);
console.log(modules_06c16b9a.module, modules_c2f65cd3.composition, modules_b033f21c.compositioned);
"
`;

exports[`modules named-exports: js 1`] = `
"/** @type {HTMLElement[]} */
var containers = [];
Expand Down
11 changes: 0 additions & 11 deletions __tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,17 +192,6 @@ validateMany("modules", [
input: "modules/index.js",
options: { modules: true },
},
{
title: "inject-object",
input: "modules/index.js",
options: {
modules: {
getReplacements: () => {
/* noop */
},
},
},
},
{
title: "generate-scoped-name",
input: "modules-duplication/index.js",
Expand Down

0 comments on commit 15f0b79

Please sign in to comment.