Add createCardFooter tests
This commit is contained in:
parent
7a68ec8bac
commit
f250e3adda
1 changed files with 23 additions and 1 deletions
|
@ -267,7 +267,6 @@
|
||||||
|
|
||||||
// BEGIN createCollapsibleCard unit tests
|
// BEGIN createCollapsibleCard unit tests
|
||||||
QUnit.module("createCollapsibleCardBody");
|
QUnit.module("createCollapsibleCardBody");
|
||||||
// form, sectionIdStr, sectionDescription, sectionCompleted, ruleViolations
|
|
||||||
|
|
||||||
QUnit.test("incomplete section renders", function(assert) {
|
QUnit.test("incomplete section renders", function(assert) {
|
||||||
let form = document.createElement("form");
|
let form = document.createElement("form");
|
||||||
|
@ -301,6 +300,29 @@
|
||||||
let expectedHTML = `<div id="section-1-collapse" class="collapse show"><div class="card-body"><div></div><p>Section Description</p><form></form></div></div>`;
|
let expectedHTML = `<div id="section-1-collapse" class="collapse show"><div class="card-body"><div></div><p>Section Description</p><form></form></div></div>`;
|
||||||
assert.deepEqual(collapseDiv.outerHTML, expectedHTML, "collapseDiv html and expectedHTML are identical");
|
assert.deepEqual(collapseDiv.outerHTML, expectedHTML, "collapseDiv html and expectedHTML are identical");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// BEGIN createCardFooter unit tests
|
||||||
|
QUnit.module("createCardFooter");
|
||||||
|
|
||||||
|
QUnit.test("card footer no rule violations does not render", function(assert) {
|
||||||
|
let ruleViolations = [];
|
||||||
|
let cardFooter = createCardFooter(ruleViolations);
|
||||||
|
assert.strictEqual(cardFooter, null, "cardFooter is null");
|
||||||
|
});
|
||||||
|
|
||||||
|
QUnit.test("card footer with one rule violation renders", function(assert) {
|
||||||
|
let ruleViolations = [{"label": "Fare limits", "rule_break_text": "You did a bad thing"}];
|
||||||
|
let cardFooter = createCardFooter(ruleViolations);
|
||||||
|
let expectedHTML = `<div class="card-footer"><div class="alert alert-danger"><div class="alert-heading">Rule Violations</div><hr><p><strong>Fare limits</strong><br>You did a bad thing</p></div></div>`;
|
||||||
|
assert.deepEqual(cardFooter.outerHTML, expectedHTML, "cardFooter html and expectedHTML are identical");
|
||||||
|
});
|
||||||
|
|
||||||
|
QUnit.test("card footer with multiple rule violation renders", function(assert) {
|
||||||
|
let ruleViolations = [{"label": "Fare limits", "rule_break_text": "You did a bad thing"}, {"label": "Fare limits", "rule_break_text": "Now you've done it"}];
|
||||||
|
let cardFooter = createCardFooter(ruleViolations);
|
||||||
|
let expectedHTML = `<div class="card-footer"><div class="alert alert-danger"><div class="alert-heading">Rule Violations</div><hr><p><strong>Fare limits</strong><br>You did a bad thing</p><p><strong>Fare limits</strong><br>Now you've done it</p></div></div>`;
|
||||||
|
assert.deepEqual(cardFooter.outerHTML, expectedHTML, "cardFooter html and expectedHTML are identical");
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue