mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-04 02:31:33 +00:00
Replace toggle_controller with method inside generic ctrller
- move toggle method from toggle_controller inside toggle_control
ctrller
- change corresponding html attributes in view
- mode corresponding spec in toggle_controller ctrller spec
- delete now unused toggle controller + spec
This commit is contained in:
@@ -88,4 +88,24 @@ describe("ToggleControlController", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
describe("#toggleDisplay", () => {
|
||||
beforeEach(() => {
|
||||
document.body.innerHTML = `<div data-controller="toggle-control">
|
||||
<span id="button" data-action="click->toggle-control#toggleDisplay" data-toggle-show="true" />
|
||||
<div id="content" data-toggle-control-target="content" >
|
||||
content
|
||||
</div>
|
||||
</div>`;
|
||||
});
|
||||
|
||||
it("toggles the content", () => {
|
||||
const button = document.getElementById("button");
|
||||
const content = document.getElementById("content");
|
||||
expect(content.style.display).toBe("");
|
||||
|
||||
button.click();
|
||||
|
||||
expect(content.style.display).toBe("block");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user