Skip to content

Commit

Permalink
Fix internal Image component test.
Browse files Browse the repository at this point in the history
  • Loading branch information
kitschpatrol committed May 31, 2024
1 parent fd45830 commit d84bfff
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/examples/tests/TestImage.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
import { Button, Image } from '$lib';
let source = 'placeholder';
let kittenIndex = 1;
async function getRandomKittenUrl() {
const { url } = await fetch('https://source.unsplash.com/800x800/?kitten', {
method: 'HEAD',
redirect: 'follow'
});
return url;
}
let binding1InternalEventCount = 0;
let binding1ExternalEventCount = 0;
Expand All @@ -11,9 +18,8 @@
</script>

<Button
on:click={() => {
source = `https://placekitten.com/1024/1024?image=${kittenIndex}`;
kittenIndex = (kittenIndex % 16) + 1;
on:click={async () => {
source = await getRandomKittenUrl();
}}
label="Random Placeholder"
title="Load Kitten"
Expand Down Expand Up @@ -44,7 +50,6 @@
/>

<pre>Value: <span>{source}</span></pre>
<pre>Value: <span>{kittenIndex}</span></pre>
<pre>Binding 1 Internal: <span>{binding1InternalEventCount}</span></pre>
<pre>Binding 1 External: <span>{binding1ExternalEventCount}</span></pre>
<pre>Binding 2 Internal: <span>{binding2InternalEventCount}</span></pre>
Expand Down

0 comments on commit d84bfff

Please sign in to comment.