UNPKG

vue-styleguidist

Version:
41 lines 1.82 kB
import * as React from 'react'; import { mount } from 'cypress/react'; import Context from 'rsg-components/Context/Context'; import EditorPrism from './EditorPrism'; var Provider = function Provider(_ref) { var children = _ref.children, _ref$jssThemedEditor = _ref.jssThemedEditor, jssThemedEditor = _ref$jssThemedEditor === void 0 ? true : _ref$jssThemedEditor, _ref$jsxInExamples = _ref.jsxInExamples, jsxInExamples = _ref$jsxInExamples === void 0 ? false : _ref$jsxInExamples; return /*#__PURE__*/React.createElement(Context.Provider, { value: { config: { jssThemedEditor: jssThemedEditor, jsxInExamples: jsxInExamples } } }, children); }; describe('EditorPrism Vue3', function () { it('renders vue SFC with script and setup', function () { var code = "<script lang=\"ts\">\nfunction test(){\n return 'hello'\n}\n</script>\n<script lang=\"ts\" setup>\nconst msg:string = test()\n</script>"; mount( /*#__PURE__*/React.createElement(Provider, { jsxInExamples: true }, /*#__PURE__*/React.createElement(EditorPrism, { code: code, onChange: function onChange() {} }))); cy.get('pre').should('have.text', code); }); it('renders vue SFC with all the features', function () { var code = "\n<script lang=\"ts\">\nfunction test(){\n return 'hello'\n}\n</script>\n<script lang=\"ts\" setup>\nconst msg:string = test()\n</script>\n<template>\n <div>{{ msg }}</div>\n <Checkbox />\n</template>\n<style scoped>\n .checkbox {\n color: red;\n }\n</style>\n "; mount( /*#__PURE__*/React.createElement(Provider, { jsxInExamples: true }, /*#__PURE__*/React.createElement(EditorPrism, { code: code, onChange: function onChange() {} }))); cy.get('pre').should('have.text', code); }); });