mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-17 13:09:42 -04:00
Feat/webpack (#2998)
* First commit * Removed govuk for webpack. Modernized javascript importing. Removed dead js * Fixed tests, a few styling bugs * Fixed some table errors and regenerated backstop ref images * Updated tests for coverage * Changes from carlo suggestions
This commit is contained in:
@@ -110,4 +110,22 @@ describe("Form Validation", () => {
|
||||
expect(errorElement.style.display).toBe("none");
|
||||
});
|
||||
|
||||
test("Uses 'This field' as label when no label element exists", async () => {
|
||||
document.body.innerHTML = `
|
||||
<form data-force-focus="True">
|
||||
<input id="unlabeled-input" name="unlabeled" type="text" />
|
||||
<button type="submit">Submit</button>
|
||||
</form>
|
||||
`;
|
||||
|
||||
form = document.querySelector('form[data-force-focus="True"]');
|
||||
attachValidation();
|
||||
|
||||
form.dispatchEvent(new Event("submit", { bubbles: true }));
|
||||
await new Promise(resolve => setTimeout(resolve, 20));
|
||||
|
||||
const errorMessage = document.getElementById("unlabeled-input-error");
|
||||
expect(errorMessage.textContent).toBe("Error: This field is required.");
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user