-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* More typing to base.ts * Add more types * More types
- Loading branch information
1 parent
4850f39
commit 1c53d91
Showing
13 changed files
with
115 additions
and
29 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { jest } from "@jest/globals" | ||
import { ensureUniqueId } from "../../src/utils" | ||
|
||
describe("Utils", () => { | ||
|
||
let element: HTMLElement; | ||
|
||
beforeEach(() => { | ||
element = document.createElement("div"); | ||
}) | ||
|
||
it("ensureUniqueId sets unique id on element", async () => { | ||
expect(element.id).toBe("") | ||
|
||
ensureUniqueId(element) | ||
|
||
expect(element.id).toBe("py-internal-0") | ||
}) | ||
|
||
it("ensureUniqueId sets unique id with increasing counter", async () => { | ||
const secondElement = document.createElement("div") | ||
|
||
expect(element.id).toBe("") | ||
expect(secondElement.id).toBe("") | ||
|
||
ensureUniqueId(element) | ||
ensureUniqueId(secondElement) | ||
|
||
// The counter will have been incremented on | ||
// the previous test, make sure it keeps increasing | ||
expect(element.id).toBe("py-internal-1") | ||
expect(secondElement.id).toBe("py-internal-2") | ||
}) | ||
}) |