update editableOptions wrapper

This commit is contained in:
d98762625 2018-06-18 11:17:17 +01:00
parent ffb65d8ea1
commit c90f30a7a1
2 changed files with 20 additions and 0 deletions

View File

@ -56,6 +56,9 @@ function transformArgs(originalArgs, newArgs) {
if (["toggleString"].indexOf(argument.type) > -1) {
argument.string = newArgs[key].string;
argument.option = newArgs[key].option;
} else if (argument.type === "editableOption") {
// takes key: "option", key: {name, val: "string"}, key: {name, val: [...]}
argument.value = typeof newArgs[key] === "string" ? newArgs[key]: newArgs[key].value;
} else {
argument.value = newArgs[key];
}

View File

@ -27,6 +27,7 @@ import {
bitShiftRight,
cartesianProduct,
CSSMinify,
toBase64,
} from "../../../src/node/index";
import TestRegister from "../../TestRegister";
@ -115,6 +116,22 @@ color: white;
preserveComments: true,
});
assert.strictEqual(result.toString(), "header {// comment width: 100%;color: white;}");
}),
it("toBase64: editableOption", () => {
const result = toBase64("some input", {
alphabet: {
value: "0-9A-W"
},
});
assert.strictEqual(result.toString(), "SPI1R1T0");
}),
it("toBase64: editableOptions key is value", () => {
const result = toBase64("some input", {
alphabet: "0-9A-W",
});
assert.strictEqual(result.toString(), "SPI1R1T0");
})