-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implements #11240. https://github.com/user-attachments/assets/4d2f8021-3e0f-4d39-95df-bcd72bf7545b # Important Notes - Fix a Yjs document corruption bug caused by `DeepReadonly` being replaced by a stub; introduce a `DeepReadonly` implementation without Vue dependency. - Fix right panel sizing when code editor is open. - Fix right panel slide-in animation. - `Ast.Function` renamed to `Ast.FunctionDef`.
- Loading branch information
Showing
111 changed files
with
3,218 additions
and
2,485 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
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
146 changes: 146 additions & 0 deletions
146
app/common/src/utilities/data/__tests__/iterator.test.ts
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,146 @@ | ||
import { expect, test } from 'vitest' | ||
import * as iter from '../iter' | ||
|
||
interface IteratorCase<T> { | ||
iterable: Iterable<T> | ||
soleValue: T | undefined | ||
first: T | undefined | ||
last: T | undefined | ||
count: number | ||
} | ||
|
||
function makeCases(): IteratorCase<unknown>[] { | ||
return [ | ||
{ | ||
iterable: iter.empty(), | ||
soleValue: undefined, | ||
first: undefined, | ||
last: undefined, | ||
count: 0, | ||
}, | ||
{ | ||
iterable: iter.chain(iter.empty(), iter.empty()), | ||
soleValue: undefined, | ||
first: undefined, | ||
last: undefined, | ||
count: 0, | ||
}, | ||
{ | ||
iterable: iter.chain(iter.empty(), ['a'], iter.empty()), | ||
soleValue: 'a', | ||
first: 'a', | ||
last: 'a', | ||
count: 1, | ||
}, | ||
{ | ||
iterable: iter.range(10, 11), | ||
soleValue: 10, | ||
first: 10, | ||
last: 10, | ||
count: 1, | ||
}, | ||
{ | ||
iterable: iter.range(10, 20), | ||
soleValue: undefined, | ||
first: 10, | ||
last: 19, | ||
count: 10, | ||
}, | ||
{ | ||
iterable: iter.range(20, 10), | ||
soleValue: undefined, | ||
first: 20, | ||
last: 11, | ||
count: 10, | ||
}, | ||
{ | ||
iterable: [], | ||
soleValue: undefined, | ||
first: undefined, | ||
last: undefined, | ||
count: 0, | ||
}, | ||
{ | ||
iterable: ['a'], | ||
soleValue: 'a', | ||
first: 'a', | ||
last: 'a', | ||
count: 1, | ||
}, | ||
{ | ||
iterable: ['a', 'b'], | ||
soleValue: undefined, | ||
first: 'a', | ||
last: 'b', | ||
count: 2, | ||
}, | ||
{ | ||
iterable: iter.filterDefined([undefined, 'a', undefined, 'b', undefined]), | ||
soleValue: undefined, | ||
first: 'a', | ||
last: 'b', | ||
count: 2, | ||
}, | ||
{ | ||
iterable: iter.filter([7, 'a', 8, 'b', 9], el => typeof el === 'string'), | ||
soleValue: undefined, | ||
first: 'a', | ||
last: 'b', | ||
count: 2, | ||
}, | ||
{ | ||
iterable: iter.zip(['a', 'b'], iter.range(1, 2)), | ||
soleValue: ['a', 1], | ||
first: ['a', 1], | ||
last: ['a', 1], | ||
count: 1, | ||
}, | ||
{ | ||
iterable: iter.zip(['a', 'b'], iter.range(1, 3)), | ||
soleValue: undefined, | ||
first: ['a', 1], | ||
last: ['b', 2], | ||
count: 2, | ||
}, | ||
{ | ||
iterable: iter.zip(['a', 'b'], iter.range(1, 4)), | ||
soleValue: undefined, | ||
first: ['a', 1], | ||
last: ['b', 2], | ||
count: 2, | ||
}, | ||
{ | ||
iterable: iter.zipLongest(['a', 'b'], iter.range(1, 2)), | ||
soleValue: undefined, | ||
first: ['a', 1], | ||
last: ['b', undefined], | ||
count: 2, | ||
}, | ||
{ | ||
iterable: iter.zipLongest(['a', 'b'], iter.range(1, 3)), | ||
soleValue: undefined, | ||
first: ['a', 1], | ||
last: ['b', 2], | ||
count: 2, | ||
}, | ||
{ | ||
iterable: iter.zipLongest(['a', 'b'], iter.range(1, 4)), | ||
soleValue: undefined, | ||
first: ['a', 1], | ||
last: [undefined, 3], | ||
count: 3, | ||
}, | ||
] | ||
} | ||
|
||
test.each(makeCases())('tryGetSoleValue: case %#', ({ iterable, soleValue }) => { | ||
expect(iter.tryGetSoleValue(iterable)).toEqual(soleValue) | ||
}) | ||
|
||
test.each(makeCases())('last: case %#', ({ iterable, last }) => { | ||
expect(iter.last(iterable)).toEqual(last) | ||
}) | ||
|
||
test.each(makeCases())('count: case %#', ({ iterable, count }) => { | ||
expect(iter.count(iterable)).toEqual(count) | ||
}) |
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
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
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,2 @@ | ||
/** See http://www.unicode.org/reports/tr18/#Line_Boundaries */ | ||
export const LINE_BOUNDARIES = /\r\n|[\n\v\f\r\x85\u2028\u2029]/g |
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
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
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
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
Oops, something went wrong.