feat(editor): Add examples for number & boolean, add new methods (#9358)

This commit is contained in:
Elias Meire
2024-05-13 16:28:27 +02:00
committed by GitHub
parent da6088d0bb
commit 7b45dc313f
7 changed files with 192 additions and 27 deletions

View File

@@ -163,6 +163,15 @@ describe('Resolution-based completions', () => {
);
});
test('should return completions for boolean literal: {{ true.| }}', () => {
// @ts-expect-error Spied function is mistyped
vi.spyOn(workflowHelpers, 'resolveParameter').mockReturnValueOnce(true);
expect(completions('{{ true.| }}')).toHaveLength(
natives({ typeName: 'boolean' }).length + extensions({ typeName: 'boolean' }).length,
);
});
test('should properly handle string that contain dollar signs', () => {
// @ts-expect-error Spied function is mistyped
vi.spyOn(workflowHelpers, 'resolveParameter').mockReturnValueOnce("You 'owe' me 200$ ");

View File

@@ -847,6 +847,7 @@ const regexes = {
numberLiteral: /\((\d+)\.?(\d*)\)\.(.*)/, // (123). or (123.4).
singleQuoteStringLiteral: /('.*')\.([^'{\s])*/, // 'abc'.
booleanLiteral: /(true|false)\.([^'{\s])*/, // true.
doubleQuoteStringLiteral: /(".*")\.([^"{\s])*/, // "abc".
dateLiteral: /\(?new Date\(\(?.*?\)\)?\.(.*)/, // new Date(). or (new Date()).
arrayLiteral: /\(?(\[.*\])\)?\.(.*)/, // [1, 2, 3].