Files
label_printing/node_modules/jsbarcode/test/browser/svgTest.js
2022-02-21 15:01:43 +01:00

31 lines
623 B
JavaScript

var parent;
function doTests(p){
parent = p;
createTests(newTest);
}
function newTest(text, options){
var testbox = document.createElement("div");
testbox.className = "testbox";
var format = (typeof options !== "undefined" && options.format) || "auto";
testbox.innerHTML = '\
<b>Format:</b> ' + format + '<br>\
<b>Input:</b> ' + text + '<br>\
<br>\
<svg class="barcode"/>';
try{
JsBarcode(testbox.querySelector('.barcode'), text, options);
}
catch(e){
testbox.className = "errorbox";
testbox.onclick = function(){
throw e;
}
}
parent.appendChild(testbox);
}