2019-01-16 13:19:58 +01:00
|
|
|
import { escape, htmlTrim } from "../src/core/utils";
|
2019-01-16 11:28:05 +01:00
|
|
|
|
|
|
|
|
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("htmlTrim", () => {
|
|
|
|
|
test("basic use", () => {
|
|
|
|
|
expect(htmlTrim("abc")).toBe("abc");
|
|
|
|
|
expect(htmlTrim(" abc")).toBe(" abc");
|
|
|
|
|
expect(htmlTrim("abc ")).toBe("abc ");
|
|
|
|
|
expect(htmlTrim(" abc ")).toBe(" abc ");
|
|
|
|
|
expect(htmlTrim("abc\n ")).toBe("abc ");
|
|
|
|
|
expect(htmlTrim("\n ")).toBe(" ");
|
|
|
|
|
expect(htmlTrim(" \n ")).toBe(" ");
|
|
|
|
|
expect(htmlTrim(" ")).toBe(" ");
|
|
|
|
|
expect(htmlTrim("")).toBe("");
|
|
|
|
|
});
|
|
|
|
|
});
|