ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 1 | const mock = () => { |
| 2 | let storage = {}; |
| 3 | return { |
| 4 | getItem: key => (key in storage ? storage[key] : null), |
| 5 | setItem: (key, value) => (storage[key] = value || ''), |
| 6 | removeItem: key => delete storage[key], |
| 7 | clear: () => (storage = {}) |
| 8 | }; |
| 9 | }; |
| 10 | |
| 11 | Object.defineProperty(window, 'localStorage', { value: mock() }); |
| 12 | Object.defineProperty(window, 'sessionStorage', { value: mock() }); |
| 13 | Object.defineProperty(window, 'getComputedStyle', { |
| 14 | value: () => ['-webkit-appearance'], |
| 15 | |
| 16 | }); |