()
| 124 | export const waitForElementToHaveStyle = (element, style, timeout = 4500) => |
| 125 | new Promise((resolve, reject) => { |
| 126 | const loop = () => { |
| 127 | const hasStyle = testElementToHaveStyle(element, style); |
| 128 | |
| 129 | if (hasStyle) { |
| 130 | clearTimeout(timeoutHandler); |
| 131 | // This should succeed |
| 132 | expectElementToHaveStyle(element, style); |
| 133 | return resolve(); |
| 134 | } |
| 135 | |
| 136 | // Start in about the next animation frame |
| 137 | requestAnimationFrame(loop); |
| 138 | }; |
| 139 | |
| 140 | const timeoutHandler = setTimeout(() => { |
| 141 | // This should fail the test |
no test coverage detected