<commit_before>import { SVG_NAMESPACE, XLINK_NAMESPACE, XML_NAMESPACE } from "../src/common/dom";
import { render, checkDOMOps, expectDOMOps, $tc, $tcf, $invalid } from "./utils";
import { $t, $h, $s, $i, $m } from "../src/vdom/vnode_dom";
import { cloneVNode } from "../src/vdom/clone";
import { expect } from "chai";

describe("render", () => {
    it("'abc'", () => {
        checkDOMOps((c) => {
            const n = render<Text>($t("abc"));
            expect(n.nodeValue).to.equal("abc");
            expectDOMOps(c, 0, 0, 1, 0, 1, 0, 0);
        });
    });

    it("<div>", () => {
        checkDOMOps((c) => {
            const n = render<HTMLElement>($h("div"));
            expect(n.tagName.toLowerCase()).to.equal("div");
            expectDOMOps(c, 1, 0, 0, 0, 1, 0, 0);
        });
    });

    it("<span>", () => {
        checkDOMOps((c) => {
            const n = render<HTMLElement>($h("span"));
            expect(n.tagName.toLowerCase()).to.equal("span");
            expectDOMOps(c, 1, 0, 0, 0, 1, 0, 0);
        });
    });

    it("<div> (null props)", () => {
        checkDOMOps((c) => {
            render<HTMLElement>($h("div").props(null));
            expectDOMOps(c, 1, 0, 0, 0, 1, 0, 0);
        });
    });

    it("<div> ({} props)", () => {
        checkDOMOps((c) => {
            render<HTMLElement>($h("div").props({}));
            expectDOMOps(c, 1, 0, 0, 0, 1, 0, 0);
        });
    });

    it("<div tabIndex='1'>", () => {
        checkDOMOps((c) => {
            const n = render<HTMLElement>($h("div").props({ tabIndex: 1 }));
            expect(n.tabIndex).to.equal(1);
            expectDOMOps(c, 1, 0, 0, 0, 1, 0, 0);
        });
    });

    it("<div tabIndex='1' title='2'>", () => {
        checkDOMOps((c) => {
            const n = render<HTMLElement>($h("div").props({ tabIndex: 1, title: "2" }));
            expect(n.tabIndex).to.equal(1);
            expect(n.title).to.equal("2");
            expectDOMOps(c, 1, 0, 0, 0, 1, 0, 0);
        });
    });

    it("<div data-abc='a'", () => {
        checkDOMOps((c) => {
            const n = render<HTMLElement>($h("div").props({ "data-abc": "a" }));
            expect(n.getAttribute("data-abc")).to.equal("a");
            expectDOMOps(c, 1, 0, 0, 0, 1, 0, 0);
        });
    });

    it("<div aria-type='button'", () => {
        checkDOMOps((c) => {
            const n = render<HTMLElement>($h("div").props({ "aria-type": "button" }));
            expect(n.getAttribute("aria-type")).to.equal("button");
            expectDOMOps(c, 1, 0, 0, 0, 1, 0, 0);
        });
    });

    it("<div class=null>", () => {
        checkDOMOps((c) => {
            const n = render<HTMLElement>($h("div").className(null));
            expect(n.className).to.equal("");
            expectDOMOps(c, 1, 0, 0, 0, 1, 0, 0);
        });
    });

    it("<div class=''>", () => {
        checkDOMOps((c) => {
            const n = render<HTMLElement>($h("div", ""));
            expect(n.getAttributeNode("class")).to.not.null;
            expect(n.className).to.equal("");
            expectDOMOps(c, 1, 0, 0, 0, 1, 0, 0);
        });
    });

    it("<div class='a'>", () => {
        checkDOMOps((c) => {
            const n = render<HTMLElement>($h("div", "a"));
            expect(n.classList.length).to.equal(1);
            expect(n.classList.contains("a")).to.true;
            expectDOMOps(c, 1, 0, 0, 0, 1, 0, 0);
        });
    });

    it("<div class='a b'>", () => {
        checkDOMOps((c) => {
            const n = render<HTMLElement>($h("div", "a b"));
            expect(n.classList.length).to.equal(2);
            expect(n.classList.contains("a")).to.true;
            expect(n.classList.contains("b")).to.true;
            expectDOMOps(c, 1, 0, 0, 0, 1, 0, 0);
        });
    });

    it("<div style=null>", () => {
        checkDOMOps((c) => {
            const n = render<HTMLElement>($h("div").style(null));
            expect(n.style.cssText).to.equal("");
            expectDOMOps(c, 1, 0, 0, 0, 1, 0, 0);
        });
    });

    it("<div style={top: 10px}>", () => {
        checkDOMOps((c) => {
            const n = render<HTMLElement>($h("div").style({ top: "10px" }));
            expect(n.style.top).to.equal("10px");
            expectDOMOps(c, 1, 0, 0, 0, 1, 0, 0);
        });
    });

    it("<div style={float: 'left'}>", () => {
        checkDOMOps((c) => {
            const n = render<HTMLElement>($h("div").style({ cssFloat: "left" }));
            expect(n.style.cssFloat).to.equal("left");
            expectDOMOps(c, 1, 0, 0, 0, 1, 0, 0);
        });
    });

    it("<div style={top: 10px; left: 20px}>", () => {
        checkDOMOps((c) => {
            const n = render<HTMLElement>($h("div").style({ top: "10px", left: "20px" }));
            expect(n.style.top).to.equal("10px");
            expect(n.style.left).to.equal("20px");
            expectDOMOps(c, 1, 0, 0, 0, 1, 0, 0);
        });
    });

    it("<div></div> (null children)", () => {
        checkDOMOps((c) => {
            const n = render<HTMLElement>($h("div").children(null));
            expect(n.childNodes.length).to.equal(0);<commit_msg>Fix invalid property name in test<commit_after>import { SVG_NAMESPACE, XLINK_NAMESPACE, XML_NAMESPACE } from "../src/common/dom";
import { render, checkDOMOps, expectDOMOps, $tc, $tcf, $invalid } from "./utils";
import { $t, $h, $s, $i, $m } from "../src/vdom/vnode_dom";
import { cloneVNode } from "../src/vdom/clone";
import { expect } from "chai";

describe("render", () => {
    it("'abc'", () => {
        checkDOMOps((c) => {
            const n = render<Text>($t("abc"));
            expect(n.nodeValue).to.equal("abc");
            expectDOMOps(c, 0, 0, 1, 0, 1, 0, 0);
        });
    });

    it("<div>", () => {
        checkDOMOps((c) => {
            const n = render<HTMLElement>($h("div"));
            expect(n.tagName.toLowerCase()).to.equal("div");
            expectDOMOps(c, 1, 0, 0, 0, 1, 0, 0);
        });
    });

    it("<span>", () => {
        checkDOMOps((c) => {
            const n = render<HTMLElement>($h("span"));
            expect(n.tagName.toLowerCase()).to.equal("span");
            expectDOMOps(c, 1, 0, 0, 0, 1, 0, 0);
        });
    });

    it("<div> (null props)", () => {
        checkDOMOps((c) => {
            render<HTMLElement>($h("div").props(null));
            expectDOMOps(c, 1, 0, 0, 0, 1, 0, 0);
        });
    });

    it("<div> ({} props)", () => {
        checkDOMOps((c) => {
            render<HTMLElement>($h("div").props({}));
            expectDOMOps(c, 1, 0, 0, 0, 1, 0, 0);
        });
    });

    it("<div tabIndex='1'>", () => {
        checkDOMOps((c) => {
            const n = render<HTMLElement>($h("div").props({ tabIndex: 1 }));
            expect(n.tabIndex).to.equal(1);
            expectDOMOps(c, 1, 0, 0, 0, 1, 0, 0);
        });
    });

    it("<div tabIndex='1' title='2'>", () => {
        checkDOMOps((c) => {
            const n = render<HTMLElement>($h("div").props({ tabIndex: 1, title: "2" }));
            expect(n.tabIndex).to.equal(1);
            expect(n.title).to.equal("2");
            expectDOMOps(c, 1, 0, 0, 0, 1, 0, 0);
        });
    });

    it("<div data-abc='a'", () => {
        checkDOMOps((c) => {
            const n = render<HTMLElement>($h("div").props({ "data-abc": "a" }));
            expect(n.getAttribute("data-abc")).to.equal("a");
            expectDOMOps(c, 1, 0, 0, 0, 1, 0, 0);
        });
    });

    it("<div aria-type='button'", () => {
        checkDOMOps((c) => {
            const n = render<HTMLElement>($h("div").props({ "aria-type": "button" }));
            expect(n.getAttribute("aria-type")).to.equal("button");
            expectDOMOps(c, 1, 0, 0, 0, 1, 0, 0);
        });
    });

    it("<div class=null>", () => {
        checkDOMOps((c) => {
            const n = render<HTMLElement>($h("div").className(null));
            expect(n.className).to.equal("");
            expectDOMOps(c, 1, 0, 0, 0, 1, 0, 0);
        });
    });

    it("<div class=''>", () => {
        checkDOMOps((c) => {
            const n = render<HTMLElement>($h("div", ""));
            expect(n.getAttributeNode("class")).to.not.null;
            expect(n.className).to.equal("");
            expectDOMOps(c, 1, 0, 0, 0, 1, 0, 0);
        });
    });

    it("<div class='a'>", () => {
        checkDOMOps((c) => {
            const n = render<HTMLElement>($h("div", "a"));
            expect(n.classList.length).to.equal(1);
            expect(n.classList.contains("a")).to.true;
            expectDOMOps(c, 1, 0, 0, 0, 1, 0, 0);
        });
    });

    it("<div class='a b'>", () => {
        checkDOMOps((c) => {
            const n = render<HTMLElement>($h("div", "a b"));
            expect(n.classList.length).to.equal(2);
            expect(n.classList.contains("a")).to.true;
            expect(n.classList.contains("b")).to.true;
            expectDOMOps(c, 1, 0, 0, 0, 1, 0, 0);
        });
    });

    it("<div style=null>", () => {
        checkDOMOps((c) => {
            const n = render<HTMLElement>($h("div").style(null));
            expect(n.style.cssText).to.equal("");
            expectDOMOps(c, 1, 0, 0, 0, 1, 0, 0);
        });
    });

    it("<div style={top: 10px}>", () => {
        checkDOMOps((c) => {
            const n = render<HTMLElement>($h("div").style({ top: "10px" }));
            expect(n.style.top).to.equal("10px");
            expectDOMOps(c, 1, 0, 0, 0, 1, 0, 0);
        });
    });

    it("<div style={float: 'left'}>", () => {
        checkDOMOps((c) => {
            const n = render<HTMLElement>($h("div").style({ float: "left" }));
            expect(n.style.cssFloat).to.equal("left");
            expectDOMOps(c, 1, 0, 0, 0, 1, 0, 0);
        });
    });

    it("<div style={top: 10px; left: 20px}>", () => {
        checkDOMOps((c) => {
            const n = render<HTMLElement>($h("div").style({ top: "10px", left: "20px" }));
            expect(n.style.top).to.equal("10px");
            expect(n.style.left).to.equal("20px");
            expectDOMOps(c, 1, 0, 0, 0, 1, 0, 0);
        });
    });

    it("<div></div> (null children)", () => {
        checkDOMOps((c) => {
            const n = render<HTMLElement>($h("div").children(null));
            expect(n.childNodes.length).to.equal(0);
{'fraction_non_alphanumeric': 0.23834899719019476, 'fraction_numerical': 0.028873171204340665, 'mean_word_length': 1.9953569355774812, 'pattern_counts': {'":': 4, '<': 75, '<?xml version=': 0, '>': 145, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1737903', 'n_tokens_mistral': 3919, 'n_tokens_neox': 3630, 'n_words': 646}