wix-storybook-utils
Version:
Utilities for automated component documentation within Storybook
34 lines • 1.45 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var enzyme_1 = require("enzyme");
var _1 = tslib_1.__importDefault(require("./"));
describe('Markdown', function () {
var originalGlobalSelf;
// TODO: remove this ugly hack, once Markdown is not used for e2e
beforeAll(function () {
originalGlobalSelf = global.self;
Object.defineProperty(global, 'self', {
set: function (i) { return i; },
});
global.self = null;
});
afterAll(function () {
global.self = originalGlobalSelf;
});
it('should render markdown source with appropriate html', function () {
var source = "# Heading\n\nparagraph\n\n```js\n'code';\n```";
var html = (0, enzyme_1.mount)(React.createElement(_1.default, { source: source })).html();
expect(html).toContain('<h1>Heading</h1>');
expect(html).toContain('<p>paragraph</p>');
expect(html).toContain('<code class="language-js">');
expect(html).toContain("'code'</span>");
});
it('should trim source before passing it to Remarkable', function () {
var source = "\n\n 123\n ";
var html = (0, enzyme_1.mount)(React.createElement(_1.default, { source: source })).html();
expect(html).toContain('<p>123</p>');
});
});
//# sourceMappingURL=index.test.js.map