Add displayReport tests

This commit is contained in:
Preston Doman 2019-03-12 16:52:48 -07:00
parent a3ffb3d9dc
commit 296cafee92
2 changed files with 446 additions and 1 deletions

View file

@ -88,6 +88,29 @@
</div> </div>
</template> </template>
<template id="view-report">
<div class="modal fade" id="viewReportModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="viewReportModalLabel"></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-view">
<div class="text-center">
<i class="fas fa-spinner fa-3x fa-spin"></i>
<br>
<br>
<h5>Loading Report ...</h5>
</div>
</div>
</div>
</div>
</div>
</template>
<template id="collapse-card"> <template id="collapse-card">
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
@ -560,6 +583,36 @@
assert.deepEqual(collapseCard.outerHTML.replace(/>\s+</g, "><"), expectedHTML, "card and expectedHTML are identical"); assert.deepEqual(collapseCard.outerHTML.replace(/>\s+</g, "><"), expectedHTML, "card and expectedHTML are identical");
}); });
// BEGIN animateButton tests
QUnit.module("animateButton");
QUnit.test("animated button renders", function(assert) {
let saveButton = document.createElement("button");
saveButton.type = "submit";
saveButton.classList.add("btn", "btn-primary", "save-section");
saveButton.innerHTML = "Save";
animateButton(saveButton, "Saving ...");
let expectedHTML = `<button type="submit" class="btn btn-primary save-section" disabled=""><span class="spinner-border spinner-border-sm"></span>Saving ...</button>`;
assert.deepEqual(saveButton.outerHTML, expectedHTML, "save button and expectedHTML are identical");
});
// BEGIN displayReport tests
QUnit.module("displayReport", {
beforeEach : function() {
let qunitFixture = document.getElementById("qunit-fixture");
let viewReport = document.getElementById("view-report");
let clone = document.importNode(viewReport.content, true);
qunitFixture.appendChild(clone);
}
});
QUnit.test("field type is boolean and value is false", function(assert) {
let parsedData = viewReportTest1;
displayReport(parsedData);
let viewReport = document.getElementById("viewReportModal");
let expectedHTML = viewReportTest1Expected;
assert.deepEqual(viewReport.outerHTML, expectedHTML, "view report and expectedHTML are identical");
});
</script> </script>
</body> </body>
</html> </html>

File diff suppressed because one or more lines are too long