Stone, Avi (as206k) | 9b2ceb3 | 2018-04-12 16:36:39 +0300 | [diff] [blame] | 1 | global['CSS'] = null; |
| 2 | |
| 3 | const mock = () => { |
| 4 | let storage = {}; |
| 5 | return { |
| 6 | getItem: key => (key in storage ? storage[key] : null), |
| 7 | setItem: (key, value) => (storage[key] = value || ''), |
| 8 | removeItem: key => delete storage[key], |
| 9 | clear: () => (storage = {}) |
| 10 | }; |
| 11 | }; |
| 12 | |
| 13 | Object.defineProperty(window, 'localStorage', { value: mock() }); |
| 14 | Object.defineProperty(window, 'sessionStorage', { value: mock() }); |
| 15 | Object.defineProperty(document, 'doctype', { |
| 16 | value: '<!DOCTYPE html>' |
| 17 | }); |
| 18 | Object.defineProperty(window, 'getComputedStyle', { |
| 19 | value: () => { |
| 20 | return { |
| 21 | display: 'none', |
| 22 | appearance: ['-webkit-appearance'] |
| 23 | }; |
| 24 | } |
| 25 | }); |
| 26 | Object.defineProperty(document.body.style, 'transform', { |
| 27 | value: () => { |
| 28 | return { |
| 29 | enumerable: true, |
| 30 | configurable: true |
| 31 | }; |
| 32 | } |
| 33 | }); |