|
| 1 | +import { css, minify, StyleSheet, StyleSheetServer, StyleSheetTestUtils } from '../typings'; |
| 2 | + |
| 3 | +// StyleSheet |
| 4 | +const withNumberOrString = StyleSheet.create({ |
| 5 | + first: { |
| 6 | + height: '', |
| 7 | + width: 0, |
| 8 | + }, |
| 9 | +}); |
| 10 | + |
| 11 | +const withPseudo = StyleSheet.create({ |
| 12 | + withHover: { |
| 13 | + ':hover': { |
| 14 | + height: '', |
| 15 | + width: 0, |
| 16 | + }, |
| 17 | + }, |
| 18 | +}); |
| 19 | + |
| 20 | +const mapValue = new Map(); |
| 21 | +mapValue.set('position', 'absolute'); |
| 22 | +mapValue.set('width', 0); |
| 23 | +const withMap = StyleSheet.create({ mapValue }); |
| 24 | + |
| 25 | +StyleSheet.rehydrate(['']); |
| 26 | + |
| 27 | +StyleSheet.extend([{ |
| 28 | + selectorHandler: (selector, baseSelector, callback) => { |
| 29 | + selector.toLowerCase(); |
| 30 | + baseSelector.toLowerCase(); |
| 31 | + callback('').toLowerCase(); |
| 32 | + return ''; |
| 33 | + }, |
| 34 | +}, { |
| 35 | + selectorHandler: () => null, |
| 36 | +}]); |
| 37 | + |
| 38 | +// css |
| 39 | +const withCreateNumberOrString = css(withNumberOrString.first); |
| 40 | +const withCreatePseudo = css(withPseudo.withHover); |
| 41 | +const withCreateMap = css(withMap.mapValue); |
| 42 | +const withObject = css({}); |
| 43 | +const withUndefinied = css(undefined); |
| 44 | +const withNull = css(null); |
| 45 | +const withFalse = css(false); |
| 46 | +const withArray = css([{}]); |
| 47 | + |
| 48 | +// StyleSheetTestUtils |
| 49 | +StyleSheetTestUtils.suppressStyleInjection(); |
| 50 | +StyleSheetTestUtils.clearBufferAndResumeStyleInjection(); |
| 51 | +StyleSheetTestUtils.getBufferedStyles()[0].toLowerCase(); |
| 52 | + |
| 53 | +// StyleSheetServer |
| 54 | +const serverResult = StyleSheetServer.renderStatic(() => ''); |
| 55 | +serverResult.css.content.toLowerCase(); |
| 56 | +serverResult.css.renderedClassNames[0].toLowerCase(); |
| 57 | +serverResult.html.toLowerCase(); |
| 58 | + |
| 59 | +// minify |
| 60 | +minify(true); |
| 61 | +minify(false); |
0 commit comments