Skip to content

Commit

Permalink
Add test cases/clarify comment
Browse files Browse the repository at this point in the history
  • Loading branch information
twschiller committed Jun 17, 2024
1 parent 6672d13 commit 3359226
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ describe("TextWidget", () => {
expect(isVarValue("@123")).toBe(false);
expect(isVarValue("@")).toBe(false);
expect(isVarValue("@myObject.optionalProperty?")).toBe(false);
expect(isVarValue("?")).toBe(false);
expect(isVarValue("?@abc")).toBe(false);
});

test("isVarLike", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/fields/schemaFields/widgets/TextWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function schemaSupportsTemplates(schema: Schema): boolean {
// -@: Check for a @ character at the beginning of the string.
// -(?!\d): Ensure the first character of the identifier is not a digit.
// -([\w$]+): Capture the initial identifier, which can consist of letters, digits, underscores, or dollar signs.
// -((\??\.[\w$]+)|(\[(\d+|"[^"]+")\]))*: Match any number of properties or array indices, separated by periods or enclosed in square brackets.\.[\w$]+: A property preceded by a period, consisting of letters, digits, underscores, or dollar signs.
// -((\??\.[\w$]+)|(\[(\d+|"[^"]+")\]))*: Match any number of properties or array indices, separated by periods (potentially with an optional chaining question mark) or enclosed in square brackets.\.[\w$]+: A property preceded by a period, consisting of letters, digits, underscores, or dollar signs.
// -\[(\d+|"[^"]+")\]: Either an array index consisting of one or more digits, or a property name wrapped in double quotes and containing any characters except double quotes, both enclosed in square brackets.
// -$: Assert the end of the string.
const objectPathRegex =
Expand Down

0 comments on commit 3359226

Please sign in to comment.