UNPKG

wix-storybook-utils

Version:

Utilities for automated component documentation within Storybook

97 lines 4.23 kB
import { createStoryBuilder } from './story-page.driver'; import React from 'react'; describe('StoryPage', function () { it('should render simple storyPage', function () { var _a = createStoryBuilder(), input = _a.input, output = _a.output; expect(input).toBe(output); }); it('given feature example should render it', function () { var _a = createStoryBuilder() .addExamples({ _random: '</div>' }) .addFeatureExample({ title: 'title', description: 'description', example: '_random', }), input = _a.input, output = _a.output; expect(input).toBe(output); }); it('given feature example without code example should not render it', function () { var _a = createStoryBuilder().addFeatureExample({ title: 'title', description: 'description', example: '_random', }), input = _a.input, output = _a.output; expect(input).toBe(output); }); it('given feature example as empty', function () { var _a = createStoryBuilder().addFeatureExample([]), input = _a.input, output = _a.output; expect(input).toBe(output); }); it('given common use case example', function () { var _a = createStoryBuilder() .addExamples({ _random: '</div>' }) .addCommonUseCasesExample({ title: 'title', description: 'description', example: '_random', }), input = _a.input, output = _a.output; expect(input).toBe(output); }); it('given common use case example as empty should not render it', function () { var _a = createStoryBuilder().addCommonUseCasesExample([]), input = _a.input, output = _a.output; expect(input).toBe(output); }); it('given description should render it', function () { var _a = createStoryBuilder().addDescription('Hello'), input = _a.input, output = _a.output; expect(input).toBe(output); }); it('given dodont should render it', function () { var _a = createStoryBuilder().addDoDont({ do: ['one'], dont: ['two'], }), input = _a.input, output = _a.output; expect(input).toBe(output); }); it('given dodont as empty arrays should not render it', function () { var _a = createStoryBuilder().addDoDont({ do: [], dont: [], }), input = _a.input, output = _a.output; expect(input).toBe(output); }); it('given includedComponents as empty array should not render it', function () { var _a = createStoryBuilder().addIncludedComponents([]), input = _a.input, output = _a.output; expect(input).toBe(output); }); it('given includedComponents should render it', function () { var _a = createStoryBuilder().addIncludedComponents([ { category: 'Category', title: 'FirstComponent', optional: true }, { category: 'Category', title: 'SecondComponent' }, ]), input = _a.input, output = _a.output; expect(input).toBe(output); }); it('given demo should render it', function () { var _a = createStoryBuilder().addDemo(React.createElement("div", null, "This is test")), input = _a.input, output = _a.output; expect(input).toBe(output); }); it('given demo as demo should render it', function () { var _a = createStoryBuilder().addDemo('<div>This is test</div>'), input = _a.input, output = _a.output; expect(input).toBe(output); }); it('given empty demo should not render it', function () { var _a = createStoryBuilder().addDemo(null), input = _a.input, output = _a.output; expect(input).toBe(output); }); it('given an example with wide: true should render it', function () { var _a = createStoryBuilder() .addExamples({ _random: '</div>' }) .addFeatureExample({ title: 'title', description: 'description', example: '_random', wide: true, }), input = _a.input, output = _a.output; expect(input).toBe(output); }); }); //# sourceMappingURL=story-page.test.js.map