mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Avoid error when testing through jest about removing event listenner
Avoid:
```
TypeError: Cannot read properties of null (reading 'removeEventListener')
at extended.disconnect (/home/runner/work/openfoodnetwork/openfoodnetwork/app/webpacker/controllers/dropdown_controller.js:32:14)
at Context.disconnect (/home/runner/work/openfoodnetwork/openfoodnetwork/node_modules/stimulus/dist/stimulus.umd.js:1441:25)
```
This commit is contained in:
@@ -23,6 +23,10 @@ describe("Dropdown controller", () => {
|
||||
</div>`;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
document.body.innerHTML = "";
|
||||
});
|
||||
|
||||
it("hide menu by default", () => {
|
||||
const menu = document.getElementById("menu");
|
||||
expect(menu.classList.contains("hidden")).toBe(true);
|
||||
|
||||
Reference in New Issue
Block a user