UNPKG

chromogen

Version:

simple, interaction-driven Jest test generator for Recoil and React Hooks apps

66 lines (65 loc) 1.77 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.generateTests = exports.generateFile = exports.styles = void 0; const ledger_1 = require("../utils/ledger"); const output_1 = require("../output/output"); const buttonStyle = { display: 'inline-block', margin: '8px', marginLeft: '13px', padding: '0px', height: '25px', width: '65px', borderRadius: '4px', justifyContent: 'space-evenly', border: '1px', cursor: 'pointer', color: '#90d1f0', fontSize: '10px', }; const divStyle = { display: 'flex', position: 'relative', height: '100%', top: '0px', right: '0px', bottom: '0px', width: '30vw', backgroundColor: '#222222', borderRadius: '4px', margin: 0, padding: 0, zIndex: 999999, }; const playStyle = { boxSizing: 'border-box', marginLeft: '25px', borderStyle: 'solid', borderWidth: '7px 0px 7px 14px', }; const pauseStyle = { width: '14px', height: '14px', borderWidth: '0px 0px 0px 10px', borderStyle: 'double', marginLeft: '27px', }; exports.styles = { buttonStyle, divStyle, playStyle, pauseStyle }; const generateFile = (setFile, storeMap) => { const tests = (0, exports.generateTests)(storeMap); const blob = new Blob(tests); setFile(URL.createObjectURL(blob)); return tests; }; exports.generateFile = generateFile; const generateTests = (storeMap) => { const { initialRender, transactions } = ledger_1.ledger; const finalLedger = storeMap.size > 0 ? { initialRender, transactions: transactions, } : Object.assign({}, ledger_1.ledger); return [(0, output_1.output)(finalLedger)]; }; exports.generateTests = generateTests;