Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [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 | }); |