mirror of https://github.com/sveltejs/svelte
commit
2a45896310
@ -1,5 +1,10 @@
|
|||||||
export let legacy_mode_flag = false;
|
export let legacy_mode_flag = false;
|
||||||
|
export let tracing_mode_flag = false;
|
||||||
|
|
||||||
export function enable_legacy_mode_flag() {
|
export function enable_legacy_mode_flag() {
|
||||||
legacy_mode_flag = true;
|
legacy_mode_flag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function enable_tracing_mode_flag() {
|
||||||
|
tracing_mode_flag = true;
|
||||||
|
}
|
||||||
|
|||||||
@ -0,0 +1,3 @@
|
|||||||
|
import { enable_tracing_mode_flag } from './index.js';
|
||||||
|
|
||||||
|
enable_tracing_mode_flag();
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
import { flushSync } from 'svelte';
|
||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
compileOptions: {
|
||||||
|
dev: true
|
||||||
|
},
|
||||||
|
|
||||||
|
async test({ assert, target, warnings }) {
|
||||||
|
const [btn1, btn2, btn3, btn4, btn5, btn6, clear] = target.querySelectorAll('button');
|
||||||
|
|
||||||
|
flushSync(() => {
|
||||||
|
btn1.click();
|
||||||
|
btn2.click();
|
||||||
|
btn3.click();
|
||||||
|
btn4.click();
|
||||||
|
btn5.click();
|
||||||
|
btn6.click();
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.deepEqual(warnings, [
|
||||||
|
'Reactive `$state(...)` proxies and the values they proxy have different identities. Because of this, comparisons with `array.includes(...)` will produce unexpected results',
|
||||||
|
'Reactive `$state(...)` proxies and the values they proxy have different identities. Because of this, comparisons with `array.indexOf(...)` will produce unexpected results',
|
||||||
|
'Reactive `$state(...)` proxies and the values they proxy have different identities. Because of this, comparisons with `array.lastIndexOf(...)` will produce unexpected results'
|
||||||
|
]);
|
||||||
|
|
||||||
|
flushSync(() => clear.click());
|
||||||
|
warnings.length = 0;
|
||||||
|
|
||||||
|
flushSync(() => {
|
||||||
|
btn1.click();
|
||||||
|
btn2.click();
|
||||||
|
btn3.click();
|
||||||
|
btn4.click();
|
||||||
|
btn5.click();
|
||||||
|
btn6.click();
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.deepEqual(warnings, []);
|
||||||
|
}
|
||||||
|
});
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
<script>
|
||||||
|
let primitive = 'foo';
|
||||||
|
let object = {};
|
||||||
|
|
||||||
|
let array = $state([primitive, object]);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button onclick={() => array.includes(primitive)}>array.includes(primitive)</button>
|
||||||
|
<button onclick={() => array.includes(object)}>array.includes(object)</button>
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<button onclick={() => array.indexOf(primitive)}>array.indexOf(primitive)</button>
|
||||||
|
<button onclick={() => array.indexOf(object)}>array.indexOf(object)</button>
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<button onclick={() => array.lastIndexOf(primitive)}>array.lastIndexOf(primitive)</button>
|
||||||
|
<button onclick={() => array.lastIndexOf(object)}>array.lastIndexOf(object)</button>
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<button onclick={() => (array.length = 0)}>clear</button>
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
import { test, ok } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
html: `<svg><a href="/docs"><text class="small" x="20" y="40"></text></a></svg>`,
|
||||||
|
test({ assert, target }) {
|
||||||
|
const a = target.querySelector('a');
|
||||||
|
ok(a);
|
||||||
|
|
||||||
|
assert.equal(a.namespaceURI, 'http://www.w3.org/2000/svg');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
After Width: | Height: | Size: 109 B |
Loading…
Reference in new issue