honkit
Version:
HonKit is building beautiful books using Markdown.
40 lines (39 loc) • 1.67 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 resolveImages_1 = __importDefault(require("../resolveImages"));
describe("resolveImages", () => {
describe("img tag", () => {
const TEST = "<img src=\"http://www.github.com\">";
test("no error occurs and return undefined", () => {
const $ = (0, html_1.loadHtml)(TEST);
return (0, resolveImages_1.default)("hello.md", $).then(() => {
const src = $("img").attr("src");
expect(src).toBe("http://www.github.com");
});
});
});
describe("img tag with break line", () => {
const TEST = "<img \nsrc=\"http://www.github.com\">";
test("no error occurs and return undefined", () => {
const $ = (0, html_1.loadHtml)(TEST);
return (0, resolveImages_1.default)("hello.md", $).then(() => {
const src = $("img").attr("src");
expect(src).toBe("http://www.github.com");
});
});
});
describe("img tag with src with plus sign", () => {
const TEST = "<img +src=\"http://www.github.com\">";
test("no error occurs and return undefined", () => {
const $ = (0, html_1.loadHtml)(TEST);
return (0, resolveImages_1.default)("hello.md", $).then(() => {
const src = $("img").attr("src");
expect(src).toBe(undefined);
});
});
});
});