MCPcopy Index your code
hub / github.com/ZeeCoder/container-query / loop

Function loop

tests/utils/index.js:126–138  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

124export 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

Callers 2

Tested by

no test coverage detected