inside
/);
+ });
+
+ it("is silent on valid nesting", () => {
+ warnIfInvalidNesting("div", "p");
+ warnIfInvalidNesting("ul", "li");
+ expect(warnSpy).not.toHaveBeenCalled();
+ });
+
+ it("is silent when either arg is missing (text nodes, comments, etc.)", () => {
+ warnIfInvalidNesting(undefined, "div");
+ warnIfInvalidNesting("p", undefined);
+ warnIfInvalidNesting(undefined, undefined);
+ expect(warnSpy).not.toHaveBeenCalled();
+ });
+
+ it("only warns once per parent-child pair (across calls)", () => {
+ // The module-level Set caches across tests, so use a distinct pair that
+ // no other test in this file exercises for warning-count assertions.
+ warnIfInvalidNesting("form", "form");
+ warnIfInvalidNesting("form", "form");
+ warnIfInvalidNesting("form", "form");
+ expect(warnSpy).toHaveBeenCalledTimes(1);
+ });
+
+ it("normalizes tag case", () => {
+ warnIfInvalidNesting("BUTTON", "INPUT");
+ expect(warnSpy).toHaveBeenCalledTimes(1);
+ expect(warnSpy.mock.calls[0][0]).toMatch(/ inside