mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
bc7fe9023d
They are out of the scope for Owl.
31 lines
648 B
TypeScript
31 lines
648 B
TypeScript
import { escape, debounce } from "../src/utils";
|
|
|
|
describe("escape", () => {
|
|
test("normal strings", () => {
|
|
const text = "abc";
|
|
expect(escape(text)).toBe(text);
|
|
});
|
|
|
|
test("special symbols", () => {
|
|
const text = "<ok>";
|
|
expect(escape(text)).toBe("<ok>");
|
|
});
|
|
});
|
|
|
|
describe("debounce", () => {
|
|
test("works as expected", () => {
|
|
jest.useFakeTimers();
|
|
let n = 0;
|
|
let f = debounce(() => n++, 100);
|
|
expect(n).toBe(0);
|
|
f();
|
|
expect(n).toBe(0);
|
|
f();
|
|
expect(n).toBe(0);
|
|
jest.advanceTimersByTime(90);
|
|
expect(n).toBe(0);
|
|
jest.advanceTimersByTime(20);
|
|
expect(n).toBe(1);
|
|
});
|
|
});
|