UNPKG

@patternslib/patternslib

Version:

Patternslib is a JavaScript library that enables designers to build rich interactive prototypes without the need for writing any Javascript. All events are triggered by classes and other attributes in the HTML, without abusing the HTML as a programming la

33 lines (27 loc) 843 B
import $ from "jquery"; import pattern from "./menu"; describe("pat-menu", function () { beforeEach(function () { $("<div/>", { id: "lab" }).appendTo(document.body); }); afterEach(function () { $("#lab").remove(); }); describe("init tests", function () { it("adds class closed on init", function () { var $lab = $("#lab"); $lab.html( [ '<ul class="pat-menu">', "<li>First Item</li>", "<li>Second Item</li>", "<li>Third Item</li>", "</ul>", ].join("\n") ); var $list = $("ul.pat-menu"); pattern.init($list); expect($($list).children().not(".closed").length).toBe(0); }); }); });