mirror of https://github.com/sveltejs/svelte
commit
83d60e8dfc
@ -0,0 +1,5 @@
|
||||
---
|
||||
"svelte": patch
|
||||
---
|
||||
|
||||
fix(types): export CompileResult and Warning
|
||||
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: ensure element dir properties persist with text changes
|
||||
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: disallow accessing internal Svelte props
|
||||
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: make media bindings more robust
|
||||
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
feat: allow `let props = $props()` and optimize prop read access
|
||||
@ -0,0 +1,9 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
error: {
|
||||
code: 'props_illegal_name',
|
||||
message:
|
||||
'Declaring or accessing a prop starting with `$$` is illegal (they are reserved for Svelte internals)'
|
||||
}
|
||||
});
|
||||
@ -0,0 +1,3 @@
|
||||
<script>
|
||||
let { $$slots: a } = $props();
|
||||
</script>
|
||||
@ -0,0 +1,9 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
error: {
|
||||
code: 'props_illegal_name',
|
||||
message:
|
||||
'Declaring or accessing a prop starting with `$$` is illegal (they are reserved for Svelte internals)'
|
||||
}
|
||||
});
|
||||
@ -0,0 +1,4 @@
|
||||
<script>
|
||||
let props = $props();
|
||||
props.$$slots;
|
||||
</script>
|
||||
@ -0,0 +1,29 @@
|
||||
import { test, ok } from '../../assert';
|
||||
|
||||
export default test({
|
||||
mode: ['client'],
|
||||
async test({ assert, target }) {
|
||||
const audio = target.querySelector('audio');
|
||||
const button = target.querySelector('button');
|
||||
ok(audio);
|
||||
|
||||
assert.equal(audio.muted, false);
|
||||
|
||||
audio.muted = true;
|
||||
audio.dispatchEvent(new CustomEvent('volumechange'));
|
||||
await new Promise((r) => setTimeout(r, 100));
|
||||
assert.equal(audio.muted, true, 'event');
|
||||
|
||||
button?.click();
|
||||
await new Promise((r) => setTimeout(r, 100));
|
||||
assert.equal(audio.muted, false, 'click 1');
|
||||
|
||||
button?.click();
|
||||
await new Promise((r) => setTimeout(r, 100));
|
||||
assert.equal(audio.muted, true, 'click 2');
|
||||
|
||||
button?.click();
|
||||
await new Promise((r) => setTimeout(r, 100));
|
||||
assert.equal(audio.muted, false, 'click 3');
|
||||
}
|
||||
});
|
||||
@ -0,0 +1,6 @@
|
||||
<script>
|
||||
let muted = $state(false);
|
||||
</script>
|
||||
|
||||
<audio bind:muted></audio>
|
||||
<button onclick={() => (muted = !muted)}>toggle</button>
|
||||
@ -0,0 +1,29 @@
|
||||
import { test, ok } from '../../assert';
|
||||
|
||||
export default test({
|
||||
mode: ['client'],
|
||||
async test({ assert, target }) {
|
||||
const audio = target.querySelector('audio');
|
||||
const button = target.querySelector('button');
|
||||
ok(audio);
|
||||
|
||||
assert.equal(audio.playbackRate, 0.5);
|
||||
|
||||
audio.playbackRate = 1.0;
|
||||
audio.dispatchEvent(new CustomEvent('ratechange'));
|
||||
await new Promise((r) => setTimeout(r, 100));
|
||||
assert.equal(audio.playbackRate, 1.0);
|
||||
|
||||
button?.click();
|
||||
await new Promise((r) => setTimeout(r, 100));
|
||||
assert.equal(audio.playbackRate, 2);
|
||||
|
||||
button?.click();
|
||||
await new Promise((r) => setTimeout(r, 100));
|
||||
assert.equal(audio.playbackRate, 3);
|
||||
|
||||
button?.click();
|
||||
await new Promise((r) => setTimeout(r, 100));
|
||||
assert.equal(audio.playbackRate, 4);
|
||||
}
|
||||
});
|
||||
@ -0,0 +1,6 @@
|
||||
<script>
|
||||
let playbackRate = $state(0.5);
|
||||
</script>
|
||||
|
||||
<audio bind:playbackRate></audio>
|
||||
<button onclick={() => (playbackRate += 1)}>increment</button>
|
||||
@ -0,0 +1,29 @@
|
||||
import { test, ok } from '../../assert';
|
||||
|
||||
export default test({
|
||||
mode: ['client'],
|
||||
async test({ assert, target }) {
|
||||
const audio = target.querySelector('audio');
|
||||
const button = target.querySelector('button');
|
||||
ok(audio);
|
||||
|
||||
assert.equal(audio.volume, 0.1);
|
||||
|
||||
audio.volume = 0.2;
|
||||
audio.dispatchEvent(new CustomEvent('volumechange'));
|
||||
await new Promise((r) => setTimeout(r, 100));
|
||||
assert.equal(audio.volume, 0.2);
|
||||
|
||||
button?.click();
|
||||
await new Promise((r) => setTimeout(r, 100));
|
||||
assert.equal(audio.volume, 0.2 + 0.1); // JavaScript can't add floating point numbers correctly
|
||||
|
||||
button?.click();
|
||||
await new Promise((r) => setTimeout(r, 100));
|
||||
assert.equal(audio.volume, 0.2 + 0.1 + 0.1);
|
||||
|
||||
button?.click();
|
||||
await new Promise((r) => setTimeout(r, 100));
|
||||
assert.equal(audio.volume, 0.2 + 0.1 + 0.1 + 0.1);
|
||||
}
|
||||
});
|
||||
@ -0,0 +1,6 @@
|
||||
<script>
|
||||
let volume = $state(0.1);
|
||||
</script>
|
||||
|
||||
<audio bind:volume></audio>
|
||||
<button onclick={() => (volume += 0.1)}>increment</button>
|
||||
@ -0,0 +1,17 @@
|
||||
import "svelte/internal/disclose-version";
|
||||
import * as $ from "svelte/internal/client";
|
||||
|
||||
export default function Props_identifier($$anchor, $$props) {
|
||||
$.push($$props, true);
|
||||
|
||||
let props = $.rest_props($$props, ["$$slots", "$$events", "$$legacy"]);
|
||||
|
||||
$$props.a;
|
||||
props[a];
|
||||
$$props.a.b;
|
||||
$$props.a.b = true;
|
||||
props.a = true;
|
||||
props[a] = true;
|
||||
props;
|
||||
$.pop();
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
import * as $ from "svelte/internal/server";
|
||||
|
||||
export default function Props_identifier($$payload, $$props) {
|
||||
$.push();
|
||||
|
||||
let props = $$props;
|
||||
|
||||
props.a;
|
||||
props[a];
|
||||
props.a.b;
|
||||
props.a.b = true;
|
||||
props.a = true;
|
||||
props[a] = true;
|
||||
props;
|
||||
$.pop();
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
<script>
|
||||
let props = $props();
|
||||
props.a;
|
||||
props[a];
|
||||
props.a.b;
|
||||
props.a.b = true;
|
||||
props.a = true;
|
||||
props[a] = true;
|
||||
props;
|
||||
</script>
|
||||
Loading…
Reference in new issue