honkit
Version:
HonKit is building beautiful books using Markdown.
24 lines (23 loc) • 1.02 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const html_1 = require("@honkit/html");
const addHeadingId_1 = __importDefault(require("../addHeadingId"));
describe("addHeadingId", () => {
test("should add an ID if none", () => {
const $ = (0, html_1.loadHtml)("<h1>Hello World</h1><h2>Cool !!</h2>");
return (0, addHeadingId_1.default)($).then(() => {
const html = $.html();
expect(html).toBe("<h1 id=\"hello-world\">Hello World</h1><h2 id=\"cool-\">Cool !!</h2>");
});
});
test("should not change existing IDs", () => {
const $ = (0, html_1.loadHtml)("<h1 id=\"awesome\">Hello World</h1>");
return (0, addHeadingId_1.default)($).then(() => {
const html = $.html();
expect(html).toBe("<h1 id=\"awesome\">Hello World</h1>");
});
});
});