Skip to content

Commit

Permalink
Hide element editor errors on save attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdeyen committed Jan 24, 2024
1 parent 38f44b9 commit 0123509
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/javascript/alchemy_admin/components/element_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export class ElementEditor extends HTMLElement {
this.setClean()
// Reset errors that might be visible from last save attempt
this.errorsDisplay.innerHTML = ""
this.elementErrors.classList.add("hidden")
this.body
.querySelectorAll(".ingredient-editor")
.forEach((el) => el.classList.remove("validation_failed"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,10 @@ describe("alchemy-element-editor", () => {
expect(editor.errorsDisplay.innerHTML).toBe("")
})

it("hides element errors", () => {
expect(editor.elementErrors.classList).toContain("hidden")
})

it("removes ingredient invalid state", () => {
expect(
editor.querySelector(`[data-ingredient-id="666"]`).classList
Expand Down

0 comments on commit 0123509

Please sign in to comment.