@furystack/shades-common-components 12.0.0 → 12.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/CHANGELOG.md +13 -0
- package/esm/components/command-palette/command-palette-input.spec.js +148 -148
- package/esm/components/command-palette/command-palette-input.spec.js.map +1 -1
- package/esm/components/command-palette/command-palette-suggestion-list.spec.js +258 -258
- package/esm/components/command-palette/command-palette-suggestion-list.spec.js.map +1 -1
- package/esm/components/context-menu/context-menu-manager.spec.js +211 -217
- package/esm/components/context-menu/context-menu-manager.spec.js.map +1 -1
- package/esm/components/data-grid/body.spec.js +173 -173
- package/esm/components/data-grid/body.spec.js.map +1 -1
- package/esm/components/data-grid/data-grid.spec.js +39 -130
- package/esm/components/data-grid/data-grid.spec.js.map +1 -1
- package/esm/services/click-away-service.spec.js +14 -12
- package/esm/services/click-away-service.spec.js.map +1 -1
- package/esm/services/list-service.spec.js +170 -141
- package/esm/services/list-service.spec.js.map +1 -1
- package/esm/services/tree-service.spec.js +190 -159
- package/esm/services/tree-service.spec.js.map +1 -1
- package/package.json +7 -8
- package/src/components/command-palette/command-palette-input.spec.tsx +183 -194
- package/src/components/command-palette/command-palette-suggestion-list.spec.tsx +303 -321
- package/src/components/context-menu/context-menu-manager.spec.ts +213 -258
- package/src/components/data-grid/body.spec.tsx +266 -276
- package/src/components/data-grid/data-grid.spec.tsx +137 -232
- package/src/services/click-away-service.spec.ts +14 -16
- package/src/services/list-service.spec.ts +170 -172
- package/src/services/tree-service.spec.ts +191 -207
|
@@ -49,283 +49,272 @@ describe('CommandPaletteInput', () => {
|
|
|
49
49
|
|
|
50
50
|
it('should render as custom element', async () => {
|
|
51
51
|
await usingAsync(new Injector(), async (injector) => {
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
await usingAsync(createManager(), async (manager) => {
|
|
53
|
+
const rootElement = document.getElementById('root') as HTMLDivElement
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
await sleepAsync(50)
|
|
55
|
+
initializeShadeRoot({
|
|
56
|
+
injector,
|
|
57
|
+
rootElement,
|
|
58
|
+
jsxElement: <CommandPaletteInput manager={manager} />,
|
|
59
|
+
})
|
|
62
60
|
|
|
63
|
-
|
|
64
|
-
expect(input).not.toBeNull()
|
|
61
|
+
await sleepAsync(50)
|
|
65
62
|
|
|
66
|
-
|
|
63
|
+
const input = document.querySelector('shades-command-palette-input')
|
|
64
|
+
expect(input).not.toBeNull()
|
|
65
|
+
})
|
|
67
66
|
})
|
|
68
67
|
})
|
|
69
68
|
|
|
70
69
|
it('should render an input element with placeholder', async () => {
|
|
71
70
|
await usingAsync(new Injector(), async (injector) => {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
initializeShadeRoot({
|
|
76
|
-
injector,
|
|
77
|
-
rootElement,
|
|
78
|
-
jsxElement: <CommandPaletteInput manager={manager} />,
|
|
79
|
-
})
|
|
71
|
+
await usingAsync(createManager(), async (manager) => {
|
|
72
|
+
const rootElement = document.getElementById('root') as HTMLDivElement
|
|
80
73
|
|
|
81
|
-
|
|
74
|
+
initializeShadeRoot({
|
|
75
|
+
injector,
|
|
76
|
+
rootElement,
|
|
77
|
+
jsxElement: <CommandPaletteInput manager={manager} />,
|
|
78
|
+
})
|
|
82
79
|
|
|
83
|
-
|
|
84
|
-
const inputElement = component?.querySelector('input')
|
|
85
|
-
expect(inputElement).not.toBeNull()
|
|
86
|
-
expect(inputElement?.placeholder).toBe('Type to search commands...')
|
|
80
|
+
await sleepAsync(50)
|
|
87
81
|
|
|
88
|
-
|
|
82
|
+
const component = document.querySelector('shades-command-palette-input') as HTMLElement
|
|
83
|
+
const inputElement = component?.querySelector('input')
|
|
84
|
+
expect(inputElement).not.toBeNull()
|
|
85
|
+
expect(inputElement?.placeholder).toBe('Type to search commands...')
|
|
86
|
+
})
|
|
89
87
|
})
|
|
90
88
|
})
|
|
91
89
|
|
|
92
90
|
it('should start with width 0% when closed', async () => {
|
|
93
91
|
await usingAsync(new Injector(), async (injector) => {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
initializeShadeRoot({
|
|
99
|
-
injector,
|
|
100
|
-
rootElement,
|
|
101
|
-
jsxElement: <CommandPaletteInput manager={manager} />,
|
|
102
|
-
})
|
|
92
|
+
await usingAsync(createManager(), async (manager) => {
|
|
93
|
+
manager.isOpened.setValue(false)
|
|
94
|
+
const rootElement = document.getElementById('root') as HTMLDivElement
|
|
103
95
|
|
|
104
|
-
|
|
96
|
+
initializeShadeRoot({
|
|
97
|
+
injector,
|
|
98
|
+
rootElement,
|
|
99
|
+
jsxElement: <CommandPaletteInput manager={manager} />,
|
|
100
|
+
})
|
|
105
101
|
|
|
106
|
-
|
|
107
|
-
expect(component.hasAttribute('data-opened')).toBe(false)
|
|
102
|
+
await sleepAsync(50)
|
|
108
103
|
|
|
109
|
-
|
|
104
|
+
const component = document.querySelector('shades-command-palette-input') as HTMLElement
|
|
105
|
+
expect(component.hasAttribute('data-opened')).toBe(false)
|
|
106
|
+
})
|
|
110
107
|
})
|
|
111
108
|
})
|
|
112
109
|
|
|
113
110
|
it('should have width 100% when opened', async () => {
|
|
114
111
|
await usingAsync(new Injector(), async (injector) => {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
initializeShadeRoot({
|
|
120
|
-
injector,
|
|
121
|
-
rootElement,
|
|
122
|
-
jsxElement: <CommandPaletteInput manager={manager} />,
|
|
123
|
-
})
|
|
112
|
+
await usingAsync(createManager(), async (manager) => {
|
|
113
|
+
manager.isOpened.setValue(true)
|
|
114
|
+
const rootElement = document.getElementById('root') as HTMLDivElement
|
|
124
115
|
|
|
125
|
-
|
|
116
|
+
initializeShadeRoot({
|
|
117
|
+
injector,
|
|
118
|
+
rootElement,
|
|
119
|
+
jsxElement: <CommandPaletteInput manager={manager} />,
|
|
120
|
+
})
|
|
126
121
|
|
|
127
|
-
|
|
128
|
-
expect(component.hasAttribute('data-opened')).toBe(true)
|
|
122
|
+
await sleepAsync(50)
|
|
129
123
|
|
|
130
|
-
|
|
124
|
+
const component = document.querySelector('shades-command-palette-input') as HTMLElement
|
|
125
|
+
expect(component.hasAttribute('data-opened')).toBe(true)
|
|
126
|
+
})
|
|
131
127
|
})
|
|
132
128
|
})
|
|
133
129
|
|
|
134
130
|
it('should animate width when opening', async () => {
|
|
135
131
|
await usingAsync(new Injector(), async (injector) => {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
132
|
+
await usingAsync(createManager(), async (manager) => {
|
|
133
|
+
manager.isOpened.setValue(false)
|
|
134
|
+
const rootElement = document.getElementById('root') as HTMLDivElement
|
|
135
|
+
|
|
136
|
+
initializeShadeRoot({
|
|
137
|
+
injector,
|
|
138
|
+
rootElement,
|
|
139
|
+
jsxElement: <CommandPaletteInput manager={manager} />,
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
await sleepAsync(50)
|
|
143
|
+
animateCalls = []
|
|
144
|
+
|
|
145
|
+
manager.isOpened.setValue(true)
|
|
146
|
+
await sleepAsync(50)
|
|
147
|
+
|
|
148
|
+
const widthAnimation = animateCalls.find(
|
|
149
|
+
(call) =>
|
|
150
|
+
Array.isArray(call.keyframes) &&
|
|
151
|
+
call.keyframes.some((kf: Keyframe) => kf.width === '0%') &&
|
|
152
|
+
call.keyframes.some((kf: Keyframe) => kf.width === '100%'),
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
expect(widthAnimation).toBeDefined()
|
|
156
|
+
expect((widthAnimation?.options as KeyframeAnimationOptions)?.duration).toBe(300)
|
|
144
157
|
})
|
|
145
|
-
|
|
146
|
-
await sleepAsync(50)
|
|
147
|
-
animateCalls = []
|
|
148
|
-
|
|
149
|
-
manager.isOpened.setValue(true)
|
|
150
|
-
await sleepAsync(50)
|
|
151
|
-
|
|
152
|
-
const widthAnimation = animateCalls.find(
|
|
153
|
-
(call) =>
|
|
154
|
-
Array.isArray(call.keyframes) &&
|
|
155
|
-
call.keyframes.some((kf: Keyframe) => kf.width === '0%') &&
|
|
156
|
-
call.keyframes.some((kf: Keyframe) => kf.width === '100%'),
|
|
157
|
-
)
|
|
158
|
-
|
|
159
|
-
expect(widthAnimation).toBeDefined()
|
|
160
|
-
expect((widthAnimation?.options as KeyframeAnimationOptions)?.duration).toBe(300)
|
|
161
|
-
|
|
162
|
-
manager[Symbol.dispose]()
|
|
163
158
|
})
|
|
164
159
|
})
|
|
165
160
|
|
|
166
161
|
it('should animate width when closing', async () => {
|
|
167
162
|
await usingAsync(new Injector(), async (injector) => {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
163
|
+
await usingAsync(createManager(), async (manager) => {
|
|
164
|
+
manager.isOpened.setValue(true)
|
|
165
|
+
const rootElement = document.getElementById('root') as HTMLDivElement
|
|
166
|
+
|
|
167
|
+
initializeShadeRoot({
|
|
168
|
+
injector,
|
|
169
|
+
rootElement,
|
|
170
|
+
jsxElement: <CommandPaletteInput manager={manager} />,
|
|
171
|
+
})
|
|
172
|
+
|
|
173
|
+
await sleepAsync(50)
|
|
174
|
+
animateCalls = []
|
|
175
|
+
|
|
176
|
+
manager.isOpened.setValue(false)
|
|
177
|
+
await sleepAsync(50)
|
|
178
|
+
|
|
179
|
+
const widthAnimation = animateCalls.find(
|
|
180
|
+
(call) =>
|
|
181
|
+
Array.isArray(call.keyframes) &&
|
|
182
|
+
call.keyframes.some((kf: Keyframe) => kf.width === '100%') &&
|
|
183
|
+
call.keyframes.some((kf: Keyframe) => kf.width === '0%'),
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
expect(widthAnimation).toBeDefined()
|
|
176
187
|
})
|
|
177
|
-
|
|
178
|
-
await sleepAsync(50)
|
|
179
|
-
animateCalls = []
|
|
180
|
-
|
|
181
|
-
manager.isOpened.setValue(false)
|
|
182
|
-
await sleepAsync(50)
|
|
183
|
-
|
|
184
|
-
const widthAnimation = animateCalls.find(
|
|
185
|
-
(call) =>
|
|
186
|
-
Array.isArray(call.keyframes) &&
|
|
187
|
-
call.keyframes.some((kf: Keyframe) => kf.width === '100%') &&
|
|
188
|
-
call.keyframes.some((kf: Keyframe) => kf.width === '0%'),
|
|
189
|
-
)
|
|
190
|
-
|
|
191
|
-
expect(widthAnimation).toBeDefined()
|
|
192
|
-
|
|
193
|
-
manager[Symbol.dispose]()
|
|
194
188
|
})
|
|
195
189
|
})
|
|
196
190
|
|
|
197
191
|
it('should clear input value when opening', async () => {
|
|
198
192
|
await usingAsync(new Injector(), async (injector) => {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
initializeShadeRoot({
|
|
204
|
-
injector,
|
|
205
|
-
rootElement,
|
|
206
|
-
jsxElement: <CommandPaletteInput manager={manager} />,
|
|
207
|
-
})
|
|
193
|
+
await usingAsync(createManager(), async (manager) => {
|
|
194
|
+
manager.isOpened.setValue(false)
|
|
195
|
+
const rootElement = document.getElementById('root') as HTMLDivElement
|
|
208
196
|
|
|
209
|
-
|
|
197
|
+
initializeShadeRoot({
|
|
198
|
+
injector,
|
|
199
|
+
rootElement,
|
|
200
|
+
jsxElement: <CommandPaletteInput manager={manager} />,
|
|
201
|
+
})
|
|
210
202
|
|
|
211
|
-
|
|
212
|
-
const inputElement = component?.querySelector('input') as HTMLInputElement
|
|
213
|
-
inputElement.value = 'some text'
|
|
203
|
+
await sleepAsync(50)
|
|
214
204
|
|
|
215
|
-
|
|
216
|
-
|
|
205
|
+
const component = document.querySelector('shades-command-palette-input') as HTMLElement
|
|
206
|
+
const inputElement = component?.querySelector('input') as HTMLInputElement
|
|
207
|
+
inputElement.value = 'some text'
|
|
217
208
|
|
|
218
|
-
|
|
209
|
+
manager.isOpened.setValue(true)
|
|
210
|
+
await sleepAsync(50)
|
|
219
211
|
|
|
220
|
-
|
|
212
|
+
expect(inputElement.value).toBe('')
|
|
213
|
+
})
|
|
221
214
|
})
|
|
222
215
|
})
|
|
223
216
|
|
|
224
217
|
it('should clear input value when closing', async () => {
|
|
225
218
|
await usingAsync(new Injector(), async (injector) => {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
initializeShadeRoot({
|
|
231
|
-
injector,
|
|
232
|
-
rootElement,
|
|
233
|
-
jsxElement: <CommandPaletteInput manager={manager} />,
|
|
234
|
-
})
|
|
219
|
+
await usingAsync(createManager(), async (manager) => {
|
|
220
|
+
manager.isOpened.setValue(true)
|
|
221
|
+
const rootElement = document.getElementById('root') as HTMLDivElement
|
|
235
222
|
|
|
236
|
-
|
|
223
|
+
initializeShadeRoot({
|
|
224
|
+
injector,
|
|
225
|
+
rootElement,
|
|
226
|
+
jsxElement: <CommandPaletteInput manager={manager} />,
|
|
227
|
+
})
|
|
237
228
|
|
|
238
|
-
|
|
239
|
-
const inputElement = component?.querySelector('input') as HTMLInputElement
|
|
240
|
-
inputElement.value = 'search term'
|
|
229
|
+
await sleepAsync(50)
|
|
241
230
|
|
|
242
|
-
|
|
243
|
-
|
|
231
|
+
const component = document.querySelector('shades-command-palette-input') as HTMLElement
|
|
232
|
+
const inputElement = component?.querySelector('input') as HTMLInputElement
|
|
233
|
+
inputElement.value = 'search term'
|
|
244
234
|
|
|
245
|
-
|
|
235
|
+
manager.isOpened.setValue(false)
|
|
236
|
+
await sleepAsync(50)
|
|
246
237
|
|
|
247
|
-
|
|
238
|
+
expect(inputElement.value).toBe('')
|
|
239
|
+
})
|
|
248
240
|
})
|
|
249
241
|
})
|
|
250
242
|
|
|
251
243
|
it('should have overflow hidden style', async () => {
|
|
252
244
|
await usingAsync(new Injector(), async (injector) => {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
initializeShadeRoot({
|
|
257
|
-
injector,
|
|
258
|
-
rootElement,
|
|
259
|
-
jsxElement: <CommandPaletteInput manager={manager} />,
|
|
260
|
-
})
|
|
245
|
+
await usingAsync(createManager(), async (manager) => {
|
|
246
|
+
const rootElement = document.getElementById('root') as HTMLDivElement
|
|
261
247
|
|
|
262
|
-
|
|
248
|
+
initializeShadeRoot({
|
|
249
|
+
injector,
|
|
250
|
+
rootElement,
|
|
251
|
+
jsxElement: <CommandPaletteInput manager={manager} />,
|
|
252
|
+
})
|
|
263
253
|
|
|
264
|
-
|
|
265
|
-
const computedStyle = window.getComputedStyle(component)
|
|
266
|
-
expect(computedStyle.overflow).toBe('hidden')
|
|
254
|
+
await sleepAsync(50)
|
|
267
255
|
|
|
268
|
-
|
|
256
|
+
const component = document.querySelector('shades-command-palette-input') as HTMLElement
|
|
257
|
+
const computedStyle = window.getComputedStyle(component)
|
|
258
|
+
expect(computedStyle.overflow).toBe('hidden')
|
|
259
|
+
})
|
|
269
260
|
})
|
|
270
261
|
})
|
|
271
262
|
|
|
272
263
|
it('should use cubic-bezier easing for animations', async () => {
|
|
273
264
|
await usingAsync(new Injector(), async (injector) => {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
265
|
+
await usingAsync(createManager(), async (manager) => {
|
|
266
|
+
manager.isOpened.setValue(false)
|
|
267
|
+
const rootElement = document.getElementById('root') as HTMLDivElement
|
|
268
|
+
|
|
269
|
+
initializeShadeRoot({
|
|
270
|
+
injector,
|
|
271
|
+
rootElement,
|
|
272
|
+
jsxElement: <CommandPaletteInput manager={manager} />,
|
|
273
|
+
})
|
|
274
|
+
|
|
275
|
+
await sleepAsync(50)
|
|
276
|
+
animateCalls = []
|
|
277
|
+
|
|
278
|
+
manager.isOpened.setValue(true)
|
|
279
|
+
await sleepAsync(50)
|
|
280
|
+
|
|
281
|
+
const widthAnimation = animateCalls.find(
|
|
282
|
+
(call) => Array.isArray(call.keyframes) && call.keyframes.some((kf: Keyframe) => 'width' in kf),
|
|
283
|
+
)
|
|
284
|
+
|
|
285
|
+
expect(widthAnimation).toBeDefined()
|
|
286
|
+
expect((widthAnimation?.options as KeyframeAnimationOptions)?.easing).toBe(
|
|
287
|
+
'cubic-bezier(0.595, 0.425, 0.415, 0.845)',
|
|
288
|
+
)
|
|
282
289
|
})
|
|
283
|
-
|
|
284
|
-
await sleepAsync(50)
|
|
285
|
-
animateCalls = []
|
|
286
|
-
|
|
287
|
-
manager.isOpened.setValue(true)
|
|
288
|
-
await sleepAsync(50)
|
|
289
|
-
|
|
290
|
-
const widthAnimation = animateCalls.find(
|
|
291
|
-
(call) => Array.isArray(call.keyframes) && call.keyframes.some((kf: Keyframe) => 'width' in kf),
|
|
292
|
-
)
|
|
293
|
-
|
|
294
|
-
expect(widthAnimation).toBeDefined()
|
|
295
|
-
expect((widthAnimation?.options as KeyframeAnimationOptions)?.easing).toBe(
|
|
296
|
-
'cubic-bezier(0.595, 0.425, 0.415, 0.845)',
|
|
297
|
-
)
|
|
298
|
-
|
|
299
|
-
manager[Symbol.dispose]()
|
|
300
290
|
})
|
|
301
291
|
})
|
|
302
292
|
|
|
303
293
|
it('should fill animation forwards', async () => {
|
|
304
294
|
await usingAsync(new Injector(), async (injector) => {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
initializeShadeRoot({
|
|
310
|
-
injector,
|
|
311
|
-
rootElement,
|
|
312
|
-
jsxElement: <CommandPaletteInput manager={manager} />,
|
|
313
|
-
})
|
|
295
|
+
await usingAsync(createManager(), async (manager) => {
|
|
296
|
+
manager.isOpened.setValue(false)
|
|
297
|
+
const rootElement = document.getElementById('root') as HTMLDivElement
|
|
314
298
|
|
|
315
|
-
|
|
316
|
-
|
|
299
|
+
initializeShadeRoot({
|
|
300
|
+
injector,
|
|
301
|
+
rootElement,
|
|
302
|
+
jsxElement: <CommandPaletteInput manager={manager} />,
|
|
303
|
+
})
|
|
317
304
|
|
|
318
|
-
|
|
319
|
-
|
|
305
|
+
await sleepAsync(50)
|
|
306
|
+
animateCalls = []
|
|
320
307
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
)
|
|
308
|
+
manager.isOpened.setValue(true)
|
|
309
|
+
await sleepAsync(50)
|
|
324
310
|
|
|
325
|
-
|
|
326
|
-
|
|
311
|
+
const widthAnimation = animateCalls.find(
|
|
312
|
+
(call) => Array.isArray(call.keyframes) && call.keyframes.some((kf: Keyframe) => 'width' in kf),
|
|
313
|
+
)
|
|
327
314
|
|
|
328
|
-
|
|
315
|
+
expect(widthAnimation).toBeDefined()
|
|
316
|
+
expect((widthAnimation?.options as KeyframeAnimationOptions)?.fill).toBe('forwards')
|
|
317
|
+
})
|
|
329
318
|
})
|
|
330
319
|
})
|
|
331
320
|
})
|