(extra = {})
| 50 | } |
| 51 | |
| 52 | function createElementStub(extra = {}) { |
| 53 | return makeNoopProxy({ |
| 54 | style: {}, |
| 55 | classList: makeNoopProxy({ |
| 56 | add() {}, |
| 57 | remove() {}, |
| 58 | contains() { |
| 59 | return false; |
| 60 | }, |
| 61 | }), |
| 62 | children: [], |
| 63 | childNodes: [], |
| 64 | attributes: {}, |
| 65 | appendChild() {}, |
| 66 | removeChild() {}, |
| 67 | insertBefore() {}, |
| 68 | setAttribute(name, value) { |
| 69 | this.attributes[name] = String(value); |
| 70 | }, |
| 71 | getAttribute(name) { |
| 72 | return this.attributes[name] ?? null; |
| 73 | }, |
| 74 | getBoundingClientRect() { |
| 75 | return { width: 300, height: 150, top: 0, left: 0, right: 300, bottom: 150 }; |
| 76 | }, |
| 77 | addEventListener() {}, |
| 78 | removeEventListener() {}, |
| 79 | ...extra, |
| 80 | }); |
| 81 | } |
| 82 | |
| 83 | function buildWindow(input) { |
| 84 | const localStorage = makeStorage(); |
no test coverage detected