UNPKG

wix-storybook-utils

Version:

Utilities for automated component documentation within Storybook

58 lines 2.29 kB
import { __assign } from "tslib"; import * as React from 'react'; import { mount } from 'enzyme'; import { deepAssign } from '../../test/utils/deep-assign'; import Markdown from '../Markdown'; import AutoExample from '../AutoExample'; import StoryPage from './index'; import { AutoTestkit } from '../AutoTestkit'; var default_1 = /** @class */ (function () { function default_1() { var _this = this; this.defaultProps = { metadata: { props: {}, }, config: {}, component: function () { return React.createElement("div", null); }, componentProps: {}, exampleProps: {}, examples: null, }; this.when = { created: function (props) { return (_this.component = mount(React.createElement(StoryPage, __assign({}, deepAssign(_this.defaultProps, props))))); }, }; this.openTab = function (title) { return _this.component.find("li[data-hook=\"".concat(title, "\"]")).simulate('click'); }; this.debug = function () { return console.log(_this.component.debug()); }; this.get = { readme: function () { return _this.component .find('[data-hook="metadata-readme-markdown"]') .prop('source'); }, import: function () { return _this.component .find('[data-hook="metadata-import-markdown"]') .prop('source'); }, codeBlock: function () { return _this.component.find('[data-hook="metadata-codeblock"]').find(Markdown); }, autoExample: function () { return _this.component.find(AutoExample); }, api: { markdown: function () { return _this.component.find('[data-hook="api-markdown"]'); }, }, testkit: { markdown: function () { return _this.component.find('[data-hook="testkit-markdown"]'); }, autoGenerated: function () { return _this.component.find(AutoTestkit); }, }, }; } return default_1; }()); export default default_1; //# sourceMappingURL=testkit.js.map