mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-19 18:27:29 -05:00
* implement proposal * update docs and replace py-env * more docs * suggested proposal * update docs * add to_file parameter * remove comment from Makefile * suggested improvements * move tests from basic to py_config * retain leading slash from the first path
36 lines
947 B
TypeScript
36 lines
947 B
TypeScript
import { PyTitle } from "../../src/components/pytitle"
|
|
|
|
|
|
customElements.define("py-title", PyTitle);
|
|
|
|
|
|
describe("PyTitle", () => {
|
|
let instance: PyTitle;
|
|
|
|
beforeEach(() => {
|
|
instance = new PyTitle();
|
|
})
|
|
|
|
it("PyTitle instantiates correctly", async () => {
|
|
expect(instance).toBeInstanceOf(PyTitle);
|
|
})
|
|
|
|
it("test connectedCallback defaults", async () => {
|
|
instance.connectedCallback();
|
|
expect(instance.label).toBe("")
|
|
expect(instance.mount_name).toBe("")
|
|
expect(instance.innerHTML).toBe(`<div class=\"py-title\" id=\"\"><h1></h1></div>`)
|
|
})
|
|
|
|
it("label renders correctly on the page and updates id", async () => {
|
|
instance.innerHTML = "Hello, world!";
|
|
instance.id = "my-fancy-title";
|
|
|
|
instance.connectedCallback();
|
|
|
|
expect(instance.label).toBe("Hello, world!")
|
|
expect(instance.mount_name).toMatch("my_fancy_title");
|
|
expect(instance.innerHTML).toContain("<h1>Hello, world!</h1>")
|
|
})
|
|
})
|