Skip to content

Commit

Permalink
testing status innerHTML for node type
Browse files Browse the repository at this point in the history
  • Loading branch information
scottqueen-bixal committed Sep 30, 2021
1 parent 9e316a4 commit 877d98c
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions spec/unit/combo-box/combo-box.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ describe("combo box component", () => {
let select;
let list;
let toggle;
let status;

beforeEach(() => {
body.innerHTML = TEMPLATE;
Expand All @@ -24,6 +25,7 @@ describe("combo box component", () => {
input = root.querySelector(".usa-combo-box__input");
toggle = root.querySelector(".usa-combo-box__toggle-list");
select = root.querySelector(".usa-combo-box__select");
status = root.querySelector(".usa-combo-box__status");
list = root.querySelector(".usa-combo-box__list");
});

Expand Down Expand Up @@ -314,11 +316,18 @@ describe("combo box component", () => {
1,
"should show no results list item"
);
assert.strictEqual(
list.children[0].textContent,
"No results found",
"should show the no results list item"
);
});

it("status should not allow innerHTML", () => {
input.value = "Ap";
EVENTS.input(input);

assert.ok(!list.hidden, "should display the option list");
assert.ok(status.innerHTML, "9 results available.");

Array.from(status.childNodes).forEach((childNode) => {
assert.strictEqual(childNode.nodeType, Node.TEXT_NODE);
});
});

it("should show the list when pressing down from an empty input", () => {
Expand Down

0 comments on commit 877d98c

Please sign in to comment.