@rowsncolumns/ui 16.0.0 → 16.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/editor-pm/schema.d.ts.map +1 -1
- package/dist/cjs/editor-pm/schema.js +8 -1
- package/dist/cjs/editor-pm/use-dropdown-change-pm.d.ts.map +1 -1
- package/dist/cjs/editor-pm/use-dropdown-change-pm.js +15 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/editor-pm/schema.d.ts.map +1 -1
- package/dist/esm/editor-pm/schema.js +8 -1
- package/dist/esm/editor-pm/use-dropdown-change-pm.d.ts.map +1 -1
- package/dist/esm/editor-pm/use-dropdown-change-pm.js +15 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +9 -6
- package/dist/cjs/editor-pm/use-parameter-suggestions.test.d.ts +0 -2
- package/dist/cjs/editor-pm/use-parameter-suggestions.test.d.ts.map +0 -1
- package/dist/cjs/editor-pm/use-parameter-suggestions.test.js +0 -122
- package/dist/esm/editor-pm/use-parameter-suggestions.test.d.ts +0 -2
- package/dist/esm/editor-pm/use-parameter-suggestions.test.d.ts.map +0 -1
- package/dist/esm/editor-pm/use-parameter-suggestions.test.js +0 -66
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../editor-pm/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../editor-pm/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,eAAO,MAAM,MAAM,oKA0LjB,CAAC"}
|
|
@@ -129,10 +129,17 @@ export var schema = new Schema({
|
|
|
129
129
|
},
|
|
130
130
|
parseDOM: [{ tag: "sub" }, { style: "vertical-align=sub" }],
|
|
131
131
|
},
|
|
132
|
+
// Per-run text color (`TextFormat.color`). The `data-run-color` attribute lets a host
|
|
133
|
+
// (the formula bar) suppress run colors without touching the formula-syntax highlighting,
|
|
134
|
+
// which ProseMirror also paints as `<span style="color: …">` inline decorations.
|
|
132
135
|
color: {
|
|
133
136
|
attrs: { color: {} },
|
|
134
137
|
toDOM: function (mark) {
|
|
135
|
-
return [
|
|
138
|
+
return [
|
|
139
|
+
"span",
|
|
140
|
+
{ style: "color: ".concat(mark.attrs.color), "data-run-color": "" },
|
|
141
|
+
0,
|
|
142
|
+
];
|
|
136
143
|
},
|
|
137
144
|
parseDOM: [
|
|
138
145
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-dropdown-change-pm.d.ts","sourceRoot":"","sources":["../../../editor-pm/use-dropdown-change-pm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAG5D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGpD,KAAK,UAAU,GAAG;IAChB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAAC;IACxC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,IAAI,UAAU,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,aAAa,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;IACxE,eAAe,EAAE,WAAW,GAAG,SAAS,CAAC;IACzC,WAAW,EAAE,WAAW,GAAG,SAAS,CAAC;IACrC,aAAa,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IACxC,cAAc,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS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UAAU,YAEF,UAAU,SAsKpB,CAAC"}
|
|
@@ -102,8 +102,22 @@ export var useDropdownChangePM = function (_a) {
|
|
|
102
102
|
case "thisrow":
|
|
103
103
|
textToInsert = "@";
|
|
104
104
|
break;
|
|
105
|
+
case "specialitem": {
|
|
106
|
+
var prevChar = insertPos_1 > 0
|
|
107
|
+
? state_1.doc.textBetween(insertPos_1 - 1, insertPos_1)
|
|
108
|
+
: "";
|
|
109
|
+
// Excel's autocomplete inserts a special item in its two-part form: at `Table[` the
|
|
110
|
+
// pick becomes `Table[[#Headers],` and the column list follows; inside an open
|
|
111
|
+
// two-part form (`Table[[#Headers],`) it is bracketed like a column.
|
|
112
|
+
textToInsert =
|
|
113
|
+
prevChar === "["
|
|
114
|
+
? "[".concat(value, "],")
|
|
115
|
+
: prevChar === ","
|
|
116
|
+
? "[".concat(value, "]")
|
|
117
|
+
: value;
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
105
120
|
case "namedrange":
|
|
106
|
-
case "specialitem":
|
|
107
121
|
case "parameter":
|
|
108
122
|
textToInsert = value;
|
|
109
123
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../../index.ts","../../utils.ts","../../vitest.config.ts","../../arrow/index.tsx","../../button/index.tsx","../../calendar/index.tsx","../../card/index.tsx","../../cell-tooltip/index.tsx","../../circular-loader/index.tsx","../../color-picker/index.tsx","../../color-picker/style.tsx","../../command/index.tsx","../../conditional-wrapper/index.tsx","../../dialog/index.tsx","../../dropdown/index.tsx","../../editor/constants.ts","../../editor/editor-error-boundary.tsx","../../editor/style.tsx","../../editor/suggestions-dropdown.tsx","../../editor-pm/constants.ts","../../editor-pm/decoration-plugin.ts","../../editor-pm/helpers.ts","../../editor-pm/index.tsx","../../editor-pm/mention-nodeview.tsx","../../editor-pm/mentions-dropdown.tsx","../../editor-pm/mentions-plugin.ts","../../editor-pm/placeholder-plugin.ts","../../editor-pm/prosemirror-editor.tsx","../../editor-pm/schema.ts","../../editor-pm/types.ts","../../editor-pm/unfocused-selection-plugin.ts","../../editor-pm/use-dropdown-change-pm.ts","../../editor-pm/use-editor-change-pm.ts","../../editor-pm/use-editor-decorator-pm.ts","../../editor-pm/use-editor-keydown-pm.ts","../../editor-pm/use-mention-keydown.ts","../../editor-pm/use-parameter-suggestions.
|
|
1
|
+
{"root":["../../index.ts","../../utils.ts","../../vitest.config.ts","../../arrow/index.tsx","../../button/index.tsx","../../calendar/index.tsx","../../card/index.tsx","../../cell-tooltip/index.tsx","../../circular-loader/index.tsx","../../color-picker/index.tsx","../../color-picker/style.tsx","../../command/index.tsx","../../conditional-wrapper/index.tsx","../../dialog/index.tsx","../../dropdown/index.tsx","../../editor/constants.ts","../../editor/editor-error-boundary.tsx","../../editor/style.tsx","../../editor/suggestions-dropdown.tsx","../../editor-pm/constants.ts","../../editor-pm/decoration-plugin.ts","../../editor-pm/helpers.ts","../../editor-pm/index.tsx","../../editor-pm/mention-nodeview.tsx","../../editor-pm/mentions-dropdown.tsx","../../editor-pm/mentions-plugin.ts","../../editor-pm/placeholder-plugin.ts","../../editor-pm/prosemirror-editor.tsx","../../editor-pm/schema.ts","../../editor-pm/types.ts","../../editor-pm/unfocused-selection-plugin.ts","../../editor-pm/use-dropdown-change-pm.ts","../../editor-pm/use-editor-change-pm.ts","../../editor-pm/use-editor-decorator-pm.ts","../../editor-pm/use-editor-keydown-pm.ts","../../editor-pm/use-mention-keydown.ts","../../editor-pm/use-parameter-suggestions.ts","../../eye-dropper/index.tsx","../../function-info/helpers.ts","../../function-info/index.tsx","../../function-info/style.tsx","../../hex-color-picker/index.tsx","../../hooks/use-cycle-reference.ts","../../hooks/use-dropdown-categories.ts","../../hooks/use-dropdown.ts","../../hooks/use-isomorphic-layout-effect.ts.ts","../../hooks/use-modal.tsx","../../hooks/use-visibility.ts","../../icon-button/index.tsx","../../input/index.tsx","../../popover/index.tsx","../../progress/index.tsx","../../select/index.tsx","../../separator/index.tsx","../../skeleton/index.tsx","../../stack/index.tsx","../../tabs/index.tsx","../../tooltip/index.tsx"],"version":"5.8.3"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../editor-pm/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../editor-pm/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,eAAO,MAAM,MAAM,oKA0LjB,CAAC"}
|
|
@@ -125,10 +125,17 @@ export const schema = new Schema({
|
|
|
125
125
|
},
|
|
126
126
|
parseDOM: [{ tag: "sub" }, { style: "vertical-align=sub" }],
|
|
127
127
|
},
|
|
128
|
+
// Per-run text color (`TextFormat.color`). The `data-run-color` attribute lets a host
|
|
129
|
+
// (the formula bar) suppress run colors without touching the formula-syntax highlighting,
|
|
130
|
+
// which ProseMirror also paints as `<span style="color: …">` inline decorations.
|
|
128
131
|
color: {
|
|
129
132
|
attrs: { color: {} },
|
|
130
133
|
toDOM(mark) {
|
|
131
|
-
return [
|
|
134
|
+
return [
|
|
135
|
+
"span",
|
|
136
|
+
{ style: `color: ${mark.attrs.color}`, "data-run-color": "" },
|
|
137
|
+
0,
|
|
138
|
+
];
|
|
132
139
|
},
|
|
133
140
|
parseDOM: [
|
|
134
141
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-dropdown-change-pm.d.ts","sourceRoot":"","sources":["../../../editor-pm/use-dropdown-change-pm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAG5D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGpD,KAAK,UAAU,GAAG;IA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AI,GAAG,IAAI,CAAC;IACxE,eAAe,EAAE,WAAW,GAAG,SAAS,CAAC;IACzC,WAAW,EAAE,WAAW,GAAG,SAAS,CAAC;IACrC,aAAa,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IACxC,cAAc,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;IAC5D,aAAa,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;CACzC,CAAC;AAEF,eAAO,MAAM,0BAA0B,GACrC,OAAO,WAAW,GAAG,SAAS,EAC9B,SAAS,MAAM,EACf,aAAa,MAAM;;;QAkBpB,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,+HAUjC,UAAU,YAEF,UAAU,SAsKpB,CAAC"}
|
|
@@ -99,8 +99,22 @@ export const useDropdownChangePM = ({ itemToString, formulaMode, getView, onSubm
|
|
|
99
99
|
case "thisrow":
|
|
100
100
|
textToInsert = "@";
|
|
101
101
|
break;
|
|
102
|
+
case "specialitem": {
|
|
103
|
+
const prevChar = insertPos > 0
|
|
104
|
+
? state.doc.textBetween(insertPos - 1, insertPos)
|
|
105
|
+
: "";
|
|
106
|
+
// Excel's autocomplete inserts a special item in its two-part form: at `Table[` the
|
|
107
|
+
// pick becomes `Table[[#Headers],` and the column list follows; inside an open
|
|
108
|
+
// two-part form (`Table[[#Headers],`) it is bracketed like a column.
|
|
109
|
+
textToInsert =
|
|
110
|
+
prevChar === "["
|
|
111
|
+
? `[${value}],`
|
|
112
|
+
: prevChar === ","
|
|
113
|
+
? `[${value}]`
|
|
114
|
+
: value;
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
102
117
|
case "namedrange":
|
|
103
|
-
case "specialitem":
|
|
104
118
|
case "parameter":
|
|
105
119
|
textToInsert = value;
|
|
106
120
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../../index.ts","../../utils.ts","../../vitest.config.ts","../../arrow/index.tsx","../../button/index.tsx","../../calendar/index.tsx","../../card/index.tsx","../../cell-tooltip/index.tsx","../../circular-loader/index.tsx","../../color-picker/index.tsx","../../color-picker/style.tsx","../../command/index.tsx","../../conditional-wrapper/index.tsx","../../dialog/index.tsx","../../dropdown/index.tsx","../../editor/constants.ts","../../editor/editor-error-boundary.tsx","../../editor/style.tsx","../../editor/suggestions-dropdown.tsx","../../editor-pm/constants.ts","../../editor-pm/decoration-plugin.ts","../../editor-pm/helpers.ts","../../editor-pm/index.tsx","../../editor-pm/mention-nodeview.tsx","../../editor-pm/mentions-dropdown.tsx","../../editor-pm/mentions-plugin.ts","../../editor-pm/placeholder-plugin.ts","../../editor-pm/prosemirror-editor.tsx","../../editor-pm/schema.ts","../../editor-pm/types.ts","../../editor-pm/unfocused-selection-plugin.ts","../../editor-pm/use-dropdown-change-pm.ts","../../editor-pm/use-editor-change-pm.ts","../../editor-pm/use-editor-decorator-pm.ts","../../editor-pm/use-editor-keydown-pm.ts","../../editor-pm/use-mention-keydown.ts","../../editor-pm/use-parameter-suggestions.
|
|
1
|
+
{"root":["../../index.ts","../../utils.ts","../../vitest.config.ts","../../arrow/index.tsx","../../button/index.tsx","../../calendar/index.tsx","../../card/index.tsx","../../cell-tooltip/index.tsx","../../circular-loader/index.tsx","../../color-picker/index.tsx","../../color-picker/style.tsx","../../command/index.tsx","../../conditional-wrapper/index.tsx","../../dialog/index.tsx","../../dropdown/index.tsx","../../editor/constants.ts","../../editor/editor-error-boundary.tsx","../../editor/style.tsx","../../editor/suggestions-dropdown.tsx","../../editor-pm/constants.ts","../../editor-pm/decoration-plugin.ts","../../editor-pm/helpers.ts","../../editor-pm/index.tsx","../../editor-pm/mention-nodeview.tsx","../../editor-pm/mentions-dropdown.tsx","../../editor-pm/mentions-plugin.ts","../../editor-pm/placeholder-plugin.ts","../../editor-pm/prosemirror-editor.tsx","../../editor-pm/schema.ts","../../editor-pm/types.ts","../../editor-pm/unfocused-selection-plugin.ts","../../editor-pm/use-dropdown-change-pm.ts","../../editor-pm/use-editor-change-pm.ts","../../editor-pm/use-editor-decorator-pm.ts","../../editor-pm/use-editor-keydown-pm.ts","../../editor-pm/use-mention-keydown.ts","../../editor-pm/use-parameter-suggestions.ts","../../eye-dropper/index.tsx","../../function-info/helpers.ts","../../function-info/index.tsx","../../function-info/style.tsx","../../hex-color-picker/index.tsx","../../hooks/use-cycle-reference.ts","../../hooks/use-dropdown-categories.ts","../../hooks/use-dropdown.ts","../../hooks/use-isomorphic-layout-effect.ts.ts","../../hooks/use-modal.tsx","../../hooks/use-visibility.ts","../../icon-button/index.tsx","../../input/index.tsx","../../popover/index.tsx","../../progress/index.tsx","../../select/index.tsx","../../separator/index.tsx","../../skeleton/index.tsx","../../stack/index.tsx","../../tabs/index.tsx","../../tooltip/index.tsx"],"version":"5.8.3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rowsncolumns/ui",
|
|
3
|
-
"version": "16.0.
|
|
3
|
+
"version": "16.0.1",
|
|
4
4
|
"author": "Vinay M",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
"scripts": {
|
|
15
15
|
"build": "tsc -b ./tsconfig.cjs.json ./tsconfig.esm.json",
|
|
16
16
|
"test": "vitest --run",
|
|
17
|
+
"types:specs": "node ../../scripts/typecheck-specs.mjs",
|
|
18
|
+
"types:specs:update": "node ../../scripts/typecheck-specs.mjs --update",
|
|
17
19
|
"clean": "rimraf dist",
|
|
18
20
|
"build:watch": "tsc -p ./tsconfig.esm.json --watch",
|
|
19
21
|
"lint": "eslint . --ext .ts,.tsx"
|
|
@@ -29,7 +31,6 @@
|
|
|
29
31
|
"dist"
|
|
30
32
|
],
|
|
31
33
|
"dependencies": {
|
|
32
|
-
"cmdk": "^1.0.0",
|
|
33
34
|
"@radix-ui/react-dialog": "^1.1.14",
|
|
34
35
|
"@radix-ui/react-dropdown-menu": "^2.1.15",
|
|
35
36
|
"@radix-ui/react-popover": "^1.1.14",
|
|
@@ -40,6 +41,7 @@
|
|
|
40
41
|
"@radix-ui/react-tooltip": "^1.2.7",
|
|
41
42
|
"class-variance-authority": "^0.7.1",
|
|
42
43
|
"clsx": "^2.1.1",
|
|
44
|
+
"cmdk": "^1.0.0",
|
|
43
45
|
"date-fns": "^4.1.0",
|
|
44
46
|
"match-sorter": "^8.2.0",
|
|
45
47
|
"prosemirror-commands": "^1.7.1",
|
|
@@ -56,12 +58,12 @@
|
|
|
56
58
|
},
|
|
57
59
|
"devDependencies": {
|
|
58
60
|
"@rowsncolumns/calculator": ">=7.3.0",
|
|
59
|
-
"@rowsncolumns/common-types": ">=5.2.
|
|
60
|
-
"@rowsncolumns/fast-formula-parser": ">=6.2.
|
|
61
|
-
"@rowsncolumns/functions": ">=15.0.
|
|
61
|
+
"@rowsncolumns/common-types": ">=5.2.34",
|
|
62
|
+
"@rowsncolumns/fast-formula-parser": ">=6.2.40",
|
|
63
|
+
"@rowsncolumns/functions": ">=15.0.1",
|
|
62
64
|
"@rowsncolumns/grid": ">=13.2.33",
|
|
63
65
|
"@rowsncolumns/icons": ">=7.2.31",
|
|
64
|
-
"@rowsncolumns/utils": ">=9.
|
|
66
|
+
"@rowsncolumns/utils": ">=9.4.0",
|
|
65
67
|
"@types/lodash": "^4.17.17",
|
|
66
68
|
"react": "^19.1.0",
|
|
67
69
|
"react-dom": "^19.1.0"
|
|
@@ -73,6 +75,7 @@
|
|
|
73
75
|
"@rowsncolumns/functions": ">=15.0.0",
|
|
74
76
|
"@rowsncolumns/grid": ">=13.2.33",
|
|
75
77
|
"@rowsncolumns/icons": ">=7.2.31",
|
|
78
|
+
"@rowsncolumns/spreadsheet": ">=10.3.0",
|
|
76
79
|
"@rowsncolumns/utils": ">=9.3.0",
|
|
77
80
|
"react": ">=18.0.0",
|
|
78
81
|
"react-dom": ">=18.0.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-parameter-suggestions.test.d.ts","sourceRoot":"","sources":["../../../editor-pm/use-parameter-suggestions.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { __awaiter, __generator } from "tslib";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { cleanup, render, screen, waitFor, act } from "@testing-library/react";
|
|
4
|
-
import { afterEach, describe, it, expect, vi } from "vitest";
|
|
5
|
-
import { useParameterSuggestions } from "./use-parameter-suggestions";
|
|
6
|
-
var TestHarness = function (_a) {
|
|
7
|
-
var functionToken = _a.functionToken, fetcher = _a.fetcher;
|
|
8
|
-
var parameterSuggestions = useParameterSuggestions({
|
|
9
|
-
functionToken: functionToken,
|
|
10
|
-
parameterIndex: 0,
|
|
11
|
-
parameterArguments: [],
|
|
12
|
-
getFunctionParameterSuggestions: fetcher,
|
|
13
|
-
}).parameterSuggestions;
|
|
14
|
-
return (React.createElement("div", { "data-testid": "items" }, parameterSuggestions.map(function (item) { return item.title; }).join(",")));
|
|
15
|
-
};
|
|
16
|
-
var makeFunctionToken = function (name) {
|
|
17
|
-
if (name === void 0) { name = "SUM"; }
|
|
18
|
-
return ({
|
|
19
|
-
image: name,
|
|
20
|
-
tokenType: { name: "Function", PATTERN: "" },
|
|
21
|
-
startColumn: 0,
|
|
22
|
-
endColumn: 0,
|
|
23
|
-
startOffset: 0,
|
|
24
|
-
endOffset: 0,
|
|
25
|
-
endLine: 0,
|
|
26
|
-
tokenTypeIdx: 0,
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
afterEach(function () { return cleanup(); });
|
|
30
|
-
describe("useParameterSuggestions", function () {
|
|
31
|
-
it("returns async suggestions for an active function", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
32
|
-
var fetcher;
|
|
33
|
-
return __generator(this, function (_a) {
|
|
34
|
-
switch (_a.label) {
|
|
35
|
-
case 0:
|
|
36
|
-
fetcher = vi
|
|
37
|
-
.fn()
|
|
38
|
-
.mockResolvedValue([{ title: "paramA", category: "parameter" }]);
|
|
39
|
-
render(React.createElement(TestHarness, { functionToken: makeFunctionToken(), fetcher: fetcher }));
|
|
40
|
-
return [4 /*yield*/, waitFor(function () {
|
|
41
|
-
return expect(screen.getByTestId("items").textContent).toBe("paramA");
|
|
42
|
-
})];
|
|
43
|
-
case 1:
|
|
44
|
-
_a.sent();
|
|
45
|
-
expect(fetcher).toHaveBeenCalledWith("SUM", 0, []);
|
|
46
|
-
return [2 /*return*/];
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
}); });
|
|
50
|
-
it("ignores stale responses when function token changes", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
51
|
-
var resolveFirst, resolveSecond, fetcher, rerender;
|
|
52
|
-
return __generator(this, function (_a) {
|
|
53
|
-
switch (_a.label) {
|
|
54
|
-
case 0:
|
|
55
|
-
resolveFirst = function () { };
|
|
56
|
-
resolveSecond = function () { };
|
|
57
|
-
fetcher = vi
|
|
58
|
-
.fn()
|
|
59
|
-
.mockImplementationOnce(function () {
|
|
60
|
-
return new Promise(function (res) {
|
|
61
|
-
resolveFirst = res;
|
|
62
|
-
});
|
|
63
|
-
})
|
|
64
|
-
.mockImplementationOnce(function () {
|
|
65
|
-
return new Promise(function (res) {
|
|
66
|
-
resolveSecond = res;
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
rerender = render(React.createElement(TestHarness, { functionToken: makeFunctionToken(), fetcher: fetcher })).rerender;
|
|
70
|
-
// Trigger second request with a new token
|
|
71
|
-
rerender(React.createElement(TestHarness, { functionToken: makeFunctionToken("AVG"), fetcher: fetcher }));
|
|
72
|
-
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
73
|
-
return __generator(this, function (_a) {
|
|
74
|
-
resolveFirst([{ title: "first", category: "parameter" }]);
|
|
75
|
-
return [2 /*return*/];
|
|
76
|
-
});
|
|
77
|
-
}); })];
|
|
78
|
-
case 1:
|
|
79
|
-
_a.sent();
|
|
80
|
-
expect(screen.getByTestId("items").textContent).toBe("");
|
|
81
|
-
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
82
|
-
return __generator(this, function (_a) {
|
|
83
|
-
resolveSecond([{ title: "second", category: "parameter" }]);
|
|
84
|
-
return [2 /*return*/];
|
|
85
|
-
});
|
|
86
|
-
}); })];
|
|
87
|
-
case 2:
|
|
88
|
-
_a.sent();
|
|
89
|
-
return [4 /*yield*/, waitFor(function () {
|
|
90
|
-
return expect(screen.getByTestId("items").textContent).toBe("second");
|
|
91
|
-
})];
|
|
92
|
-
case 3:
|
|
93
|
-
_a.sent();
|
|
94
|
-
return [2 /*return*/];
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
}); });
|
|
98
|
-
it("clears suggestions when there is no active function", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
99
|
-
var fetcher, rerender;
|
|
100
|
-
return __generator(this, function (_a) {
|
|
101
|
-
switch (_a.label) {
|
|
102
|
-
case 0:
|
|
103
|
-
fetcher = vi
|
|
104
|
-
.fn()
|
|
105
|
-
.mockResolvedValue([{ title: "paramA", category: "parameter" }]);
|
|
106
|
-
rerender = render(React.createElement(TestHarness, { functionToken: makeFunctionToken(), fetcher: fetcher })).rerender;
|
|
107
|
-
return [4 /*yield*/, waitFor(function () {
|
|
108
|
-
return expect(screen.getByTestId("items").textContent).toBe("paramA");
|
|
109
|
-
})];
|
|
110
|
-
case 1:
|
|
111
|
-
_a.sent();
|
|
112
|
-
rerender(React.createElement(TestHarness, { fetcher: fetcher }));
|
|
113
|
-
return [4 /*yield*/, waitFor(function () {
|
|
114
|
-
return expect(screen.getByTestId("items").textContent).toBe("");
|
|
115
|
-
})];
|
|
116
|
-
case 2:
|
|
117
|
-
_a.sent();
|
|
118
|
-
return [2 /*return*/];
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
}); });
|
|
122
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-parameter-suggestions.test.d.ts","sourceRoot":"","sources":["../../../editor-pm/use-parameter-suggestions.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { cleanup, render, screen, waitFor, act } from "@testing-library/react";
|
|
3
|
-
import { afterEach, describe, it, expect, vi } from "vitest";
|
|
4
|
-
import { useParameterSuggestions } from "./use-parameter-suggestions";
|
|
5
|
-
const TestHarness = ({ functionToken, fetcher, }) => {
|
|
6
|
-
const { parameterSuggestions } = useParameterSuggestions({
|
|
7
|
-
functionToken,
|
|
8
|
-
parameterIndex: 0,
|
|
9
|
-
parameterArguments: [],
|
|
10
|
-
getFunctionParameterSuggestions: fetcher,
|
|
11
|
-
});
|
|
12
|
-
return (React.createElement("div", { "data-testid": "items" }, parameterSuggestions.map((item) => item.title).join(",")));
|
|
13
|
-
};
|
|
14
|
-
const makeFunctionToken = (name = "SUM") => ({
|
|
15
|
-
image: name,
|
|
16
|
-
tokenType: { name: "Function", PATTERN: "" },
|
|
17
|
-
startColumn: 0,
|
|
18
|
-
endColumn: 0,
|
|
19
|
-
startOffset: 0,
|
|
20
|
-
endOffset: 0,
|
|
21
|
-
endLine: 0,
|
|
22
|
-
tokenTypeIdx: 0,
|
|
23
|
-
});
|
|
24
|
-
afterEach(() => cleanup());
|
|
25
|
-
describe("useParameterSuggestions", () => {
|
|
26
|
-
it("returns async suggestions for an active function", async () => {
|
|
27
|
-
const fetcher = vi
|
|
28
|
-
.fn()
|
|
29
|
-
.mockResolvedValue([{ title: "paramA", category: "parameter" }]);
|
|
30
|
-
render(React.createElement(TestHarness, { functionToken: makeFunctionToken(), fetcher: fetcher }));
|
|
31
|
-
await waitFor(() => expect(screen.getByTestId("items").textContent).toBe("paramA"));
|
|
32
|
-
expect(fetcher).toHaveBeenCalledWith("SUM", 0, []);
|
|
33
|
-
});
|
|
34
|
-
it("ignores stale responses when function token changes", async () => {
|
|
35
|
-
let resolveFirst = () => { };
|
|
36
|
-
let resolveSecond = () => { };
|
|
37
|
-
const fetcher = vi
|
|
38
|
-
.fn()
|
|
39
|
-
.mockImplementationOnce(() => new Promise((res) => {
|
|
40
|
-
resolveFirst = res;
|
|
41
|
-
}))
|
|
42
|
-
.mockImplementationOnce(() => new Promise((res) => {
|
|
43
|
-
resolveSecond = res;
|
|
44
|
-
}));
|
|
45
|
-
const { rerender } = render(React.createElement(TestHarness, { functionToken: makeFunctionToken(), fetcher: fetcher }));
|
|
46
|
-
// Trigger second request with a new token
|
|
47
|
-
rerender(React.createElement(TestHarness, { functionToken: makeFunctionToken("AVG"), fetcher: fetcher }));
|
|
48
|
-
await act(async () => {
|
|
49
|
-
resolveFirst([{ title: "first", category: "parameter" }]);
|
|
50
|
-
});
|
|
51
|
-
expect(screen.getByTestId("items").textContent).toBe("");
|
|
52
|
-
await act(async () => {
|
|
53
|
-
resolveSecond([{ title: "second", category: "parameter" }]);
|
|
54
|
-
});
|
|
55
|
-
await waitFor(() => expect(screen.getByTestId("items").textContent).toBe("second"));
|
|
56
|
-
});
|
|
57
|
-
it("clears suggestions when there is no active function", async () => {
|
|
58
|
-
const fetcher = vi
|
|
59
|
-
.fn()
|
|
60
|
-
.mockResolvedValue([{ title: "paramA", category: "parameter" }]);
|
|
61
|
-
const { rerender } = render(React.createElement(TestHarness, { functionToken: makeFunctionToken(), fetcher: fetcher }));
|
|
62
|
-
await waitFor(() => expect(screen.getByTestId("items").textContent).toBe("paramA"));
|
|
63
|
-
rerender(React.createElement(TestHarness, { fetcher: fetcher }));
|
|
64
|
-
await waitFor(() => expect(screen.getByTestId("items").textContent).toBe(""));
|
|
65
|
-
});
|
|
66
|
-
});
|