mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
We need to wait for the images to load. R=esprehn@chromium.org Review URL: https://codereview.chromium.org/817853006
33 lines
801 B
Plaintext
33 lines
801 B
Plaintext
<sky>
|
|
<import src="../resources/run-after-display.sky" as="runAfterDisplay" />
|
|
<import src="/sky/examples/flights-app/flights-app.sky" />
|
|
<script>
|
|
var app;
|
|
|
|
function imagesLoaded() {
|
|
var images = app.shadowRoot.querySelectorAll('img');
|
|
for (var i = 0; i < images.length; i++) {
|
|
if (!images[i].complete)
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function checkImagesLoaded() {
|
|
if (!imagesLoaded()) {
|
|
setTimeout(checkImagesLoaded, 10);
|
|
return;
|
|
}
|
|
runAfterDisplay(function() {
|
|
internals.notifyTestComplete(internals.renderTreeAsText());
|
|
});
|
|
}
|
|
|
|
addEventListener("load", function() {
|
|
app = document.createElement("flights-app");
|
|
document.querySelector("sky").appendChild(app);
|
|
checkImagesLoaded();
|
|
});
|
|
</script>
|
|
</sky>
|