-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix:
array.lastIndexOf
without second argument (#11766)
Fixes #11756 lastIndexOf seems to be using arguments internally so passing undefined is different from not passing it
- Loading branch information
1 parent
d946066
commit d856c50
Showing
4 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"svelte": patch | ||
--- | ||
|
||
fix: support `array.lastIndexOf` without second argument |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
packages/svelte/tests/runtime-runes/samples/array-lastindexof/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { ok, test } from '../../test'; | ||
import { flushSync } from 'svelte'; | ||
|
||
export default test({ | ||
mode: ['client'], | ||
async test({ assert, logs }) { | ||
assert.equal(logs[0], logs[1]); | ||
} | ||
}); |
5 changes: 5 additions & 0 deletions
5
packages/svelte/tests/runtime-runes/samples/array-lastindexof/main.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<script> | ||
const arr = [0, 1, 2]; | ||
console.log(arr.lastIndexOf(2)); | ||
console.log(arr.lastIndexOf(2, arr.length - 1)); | ||
</script> |