@genspectrum/dashboard-components 0.14.1 → 0.14.2
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/custom-elements.json +11 -11
- package/dist/assets/mutationOverTimeWorker-Dxnxrfe0.js.map +1 -1
- package/dist/components.d.ts +47 -51
- package/dist/components.js +17 -7
- package/dist/components.js.map +1 -1
- package/dist/util.d.ts +46 -46
- package/package.json +2 -2
- package/src/lapisApi/lapisApi.ts +1 -1
- package/src/operator/FillMissingOperator.spec.ts +1 -1
- package/src/operator/GroupByAndSumOperator.spec.ts +1 -1
- package/src/operator/GroupByOperator.spec.ts +2 -2
- package/src/operator/MapOperator.spec.ts +1 -1
- package/src/operator/MockOperator.spec.ts +1 -1
- package/src/operator/MockOperator.ts +6 -4
- package/src/operator/SortOperator.spec.ts +1 -1
- package/src/preact/aggregatedData/aggregate.stories.tsx +1 -1
- package/src/preact/components/csv-download-button.stories.tsx +2 -2
- package/src/preact/components/csv-download-button.tsx +1 -1
- package/src/preact/components/error-boundary.stories.tsx +5 -5
- package/src/preact/components/error-boundary.tsx +14 -3
- package/src/preact/components/error-display.stories.tsx +9 -9
- package/src/preact/components/fullscreen.tsx +3 -3
- package/src/preact/components/info.tsx +1 -1
- package/src/preact/components/mutation-type-selector.stories.tsx +1 -1
- package/src/preact/components/table.stories.tsx +3 -3
- package/src/preact/components/table.tsx +1 -1
- package/src/preact/dateRangeSelector/date-range-selector.stories.tsx +3 -6
- package/src/preact/dateRangeSelector/date-range-selector.tsx +2 -2
- package/src/preact/lineageFilter/lineage-filter.stories.tsx +6 -6
- package/src/preact/locationFilter/fetchAutocompletionList.ts +1 -1
- package/src/preact/locationFilter/location-filter.stories.tsx +6 -6
- package/src/preact/map/sequences-by-location.stories.tsx +1 -1
- package/src/preact/mutationFilter/mutation-filter.stories.tsx +2 -2
- package/src/preact/mutations/getMutationsGridData.ts +1 -1
- package/src/preact/mutationsOverTime/mutations-over-time-grid.tsx +3 -3
- package/src/preact/mutationsOverTime/mutations-over-time.stories.tsx +1 -1
- package/src/preact/mutationsOverTime/mutations-over-time.tsx +1 -0
- package/src/preact/numberSequencesOverTime/number-sequences-over-time.stories.tsx +1 -1
- package/src/preact/prevalenceOverTime/prevalence-over-time-bubble-chart.tsx +4 -4
- package/src/preact/prevalenceOverTime/prevalence-over-time.stories.tsx +1 -1
- package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.stories.tsx +1 -1
- package/src/preact/shared/floating-ui/hooks.ts +1 -1
- package/src/preact/textInput/text-input.stories.tsx +4 -4
- package/src/utils/map2d.ts +1 -0
- package/src/web-components/gs-app.stories.ts +7 -7
- package/src/web-components/input/gs-date-range-selector.stories.ts +6 -6
- package/src/web-components/input/gs-lineage-filter.stories.ts +1 -1
- package/src/web-components/input/gs-location-filter.stories.ts +1 -1
- package/src/web-components/input/gs-mutation-filter.stories.ts +7 -7
- package/src/web-components/input/gs-text-input.stories.ts +3 -3
- package/src/web-components/visualization/gs-aggregate.tsx +2 -2
- package/standalone-bundle/assets/mutationOverTimeWorker-CmSrq4SZ.js.map +1 -1
- package/standalone-bundle/dashboard-components.js +70 -63
- package/standalone-bundle/dashboard-components.js.map +1 -1
|
@@ -285,7 +285,7 @@ export const WithNoDateColumn: StoryObj<DateRangeSelectorProps> = {
|
|
|
285
285
|
lapisDateField: '',
|
|
286
286
|
},
|
|
287
287
|
play: async ({ canvasElement, step }) => {
|
|
288
|
-
step('expect error message', async () => {
|
|
288
|
+
await step('expect error message', async () => {
|
|
289
289
|
await expectInvalidAttributesErrorMessage(canvasElement, 'String must contain at least 1 character(s)');
|
|
290
290
|
});
|
|
291
291
|
},
|
|
@@ -295,12 +295,9 @@ async function prepare(canvasElement: HTMLElement, step: StepFunction<PreactRend
|
|
|
295
295
|
const canvas = within(canvasElement);
|
|
296
296
|
|
|
297
297
|
const filterChangedListenerMock = fn();
|
|
298
|
-
await step('Setup event listener mock', async () => {
|
|
299
|
-
canvasElement.addEventListener('gs-date-range-filter-changed', filterChangedListenerMock);
|
|
300
|
-
});
|
|
301
|
-
|
|
302
298
|
const optionChangedListenerMock = fn();
|
|
303
|
-
await step('Setup event listener mock',
|
|
299
|
+
await step('Setup event listener mock', () => {
|
|
300
|
+
canvasElement.addEventListener('gs-date-range-filter-changed', filterChangedListenerMock);
|
|
304
301
|
canvasElement.addEventListener('gs-date-range-option-changed', optionChangedListenerMock);
|
|
305
302
|
});
|
|
306
303
|
|
|
@@ -148,7 +148,7 @@ export const DateRangeSelectorInner = ({
|
|
|
148
148
|
fireFilterChangedEvent();
|
|
149
149
|
fireOptionChangedEvent({
|
|
150
150
|
dateFrom: dateFrom !== undefined ? toYYYYMMDD(dateFrom) : earliestDate,
|
|
151
|
-
dateTo: toYYYYMMDD(dateTo || new Date())
|
|
151
|
+
dateTo: toYYYYMMDD(dateTo || new Date()),
|
|
152
152
|
});
|
|
153
153
|
};
|
|
154
154
|
|
|
@@ -167,7 +167,7 @@ export const DateRangeSelectorInner = ({
|
|
|
167
167
|
fireFilterChangedEvent();
|
|
168
168
|
fireOptionChangedEvent({
|
|
169
169
|
dateFrom: dateFrom !== undefined ? toYYYYMMDD(dateFrom) : earliestDate,
|
|
170
|
-
dateTo: toYYYYMMDD(dateTo || new Date())
|
|
170
|
+
dateTo: toYYYYMMDD(dateTo || new Date()),
|
|
171
171
|
});
|
|
172
172
|
};
|
|
173
173
|
|
|
@@ -85,7 +85,7 @@ export const Default: StoryObj<LineageFilterProps> = {
|
|
|
85
85
|
play: async ({ canvasElement, step }) => {
|
|
86
86
|
const { canvas, lineageChangedListenerMock } = await prepare(canvasElement, step);
|
|
87
87
|
|
|
88
|
-
step('change lineage filter value fires event', async () => {
|
|
88
|
+
await step('change lineage filter value fires event', async () => {
|
|
89
89
|
const input = await inputField(canvas);
|
|
90
90
|
await userEvent.clear(input);
|
|
91
91
|
await userEvent.type(input, 'B.1');
|
|
@@ -105,7 +105,7 @@ export const ClearSelection: StoryObj<LineageFilterProps> = {
|
|
|
105
105
|
play: async ({ canvasElement, step }) => {
|
|
106
106
|
const { canvas, lineageChangedListenerMock } = await prepare(canvasElement, step);
|
|
107
107
|
|
|
108
|
-
step('clear selection fires event with empty filter', async () => {
|
|
108
|
+
await step('clear selection fires event with empty filter', async () => {
|
|
109
109
|
const clearSelectionButton = await canvas.findByLabelText('clear selection');
|
|
110
110
|
await userEvent.click(clearSelectionButton);
|
|
111
111
|
|
|
@@ -123,7 +123,7 @@ export const OnBlurInput: StoryObj<LineageFilterProps> = {
|
|
|
123
123
|
play: async ({ canvasElement, step }) => {
|
|
124
124
|
const { canvas, lineageChangedListenerMock } = await prepare(canvasElement, step);
|
|
125
125
|
|
|
126
|
-
step('after cleared selection by hand and then blur fires event with empty filter', async () => {
|
|
126
|
+
await step('after cleared selection by hand and then blur fires event with empty filter', async () => {
|
|
127
127
|
const input = await inputField(canvas);
|
|
128
128
|
await userEvent.clear(input);
|
|
129
129
|
await userEvent.click(canvas.getByLabelText('toggle menu'));
|
|
@@ -144,7 +144,7 @@ export const WithNoLapisField: StoryObj<LineageFilterProps> = {
|
|
|
144
144
|
lapisField: '',
|
|
145
145
|
},
|
|
146
146
|
play: async ({ canvasElement, step }) => {
|
|
147
|
-
step('expect error message', async () => {
|
|
147
|
+
await step('expect error message', async () => {
|
|
148
148
|
await expectInvalidAttributesErrorMessage(canvasElement, 'String must contain at least 1 character(s)');
|
|
149
149
|
});
|
|
150
150
|
},
|
|
@@ -154,11 +154,11 @@ async function prepare(canvasElement: HTMLElement, step: StepFunction<PreactRend
|
|
|
154
154
|
const canvas = within(canvasElement);
|
|
155
155
|
|
|
156
156
|
const lineageChangedListenerMock = fn();
|
|
157
|
-
step('Setup event listener mock', () => {
|
|
157
|
+
await step('Setup event listener mock', () => {
|
|
158
158
|
canvasElement.addEventListener('gs-lineage-filter-changed', lineageChangedListenerMock);
|
|
159
159
|
});
|
|
160
160
|
|
|
161
|
-
step('location filter is rendered with value', async () => {
|
|
161
|
+
await step('location filter is rendered with value', async () => {
|
|
162
162
|
await waitFor(async () => {
|
|
163
163
|
return expect(await inputField(canvas)).toHaveValue('A.1');
|
|
164
164
|
});
|
|
@@ -43,7 +43,7 @@ export async function fetchAutocompletionList({
|
|
|
43
43
|
|
|
44
44
|
return [...locationValues]
|
|
45
45
|
.map<EntryWithNullValues>(([json, count]) => ({
|
|
46
|
-
value: JSON.parse(json),
|
|
46
|
+
value: JSON.parse(json) as Record<string, string | null>,
|
|
47
47
|
count,
|
|
48
48
|
}))
|
|
49
49
|
.sort(compareLocationEntries(fields))
|
|
@@ -84,7 +84,7 @@ export const Primary: StoryObj<LocationFilterProps> = {
|
|
|
84
84
|
play: async ({ canvasElement, step }) => {
|
|
85
85
|
const { canvas, locationChangedListenerMock } = await prepare(canvasElement, step);
|
|
86
86
|
|
|
87
|
-
step('change location filter value fires event', async () => {
|
|
87
|
+
await step('change location filter value fires event', async () => {
|
|
88
88
|
const input = await inputField(canvas);
|
|
89
89
|
await userEvent.clear(input);
|
|
90
90
|
await userEvent.type(input, 'Germany');
|
|
@@ -107,7 +107,7 @@ export const ClearSelection: StoryObj<LocationFilterProps> = {
|
|
|
107
107
|
play: async ({ canvasElement, step }) => {
|
|
108
108
|
const { canvas, locationChangedListenerMock } = await prepare(canvasElement, step);
|
|
109
109
|
|
|
110
|
-
step('clear selection fires event with empty filter', async () => {
|
|
110
|
+
await step('clear selection fires event with empty filter', async () => {
|
|
111
111
|
const clearSelectionButton = await canvas.findByLabelText('clear selection');
|
|
112
112
|
await userEvent.click(clearSelectionButton);
|
|
113
113
|
|
|
@@ -128,7 +128,7 @@ export const OnBlurInput: StoryObj<LocationFilterProps> = {
|
|
|
128
128
|
play: async ({ canvasElement, step }) => {
|
|
129
129
|
const { canvas, locationChangedListenerMock } = await prepare(canvasElement, step);
|
|
130
130
|
|
|
131
|
-
step('after cleared selection by hand and then blur fires event with empty filter', async () => {
|
|
131
|
+
await step('after cleared selection by hand and then blur fires event with empty filter', async () => {
|
|
132
132
|
const input = await inputField(canvas);
|
|
133
133
|
await userEvent.clear(input);
|
|
134
134
|
await userEvent.click(canvas.getByLabelText('toggle menu'));
|
|
@@ -151,11 +151,11 @@ async function prepare(canvasElement: HTMLElement, step: StepFunction<PreactRend
|
|
|
151
151
|
const canvas = within(canvasElement);
|
|
152
152
|
|
|
153
153
|
const locationChangedListenerMock = fn();
|
|
154
|
-
step('Setup event listener mock', () => {
|
|
154
|
+
await step('Setup event listener mock', () => {
|
|
155
155
|
canvasElement.addEventListener('gs-location-changed', locationChangedListenerMock);
|
|
156
156
|
});
|
|
157
157
|
|
|
158
|
-
step('location filter is rendered with value', async () => {
|
|
158
|
+
await step('location filter is rendered with value', async () => {
|
|
159
159
|
await waitFor(async () => {
|
|
160
160
|
return expect(await inputField(canvas)).toHaveValue('Europe');
|
|
161
161
|
});
|
|
@@ -171,7 +171,7 @@ export const WithNoFields: StoryObj<LocationFilterProps> = {
|
|
|
171
171
|
fields: [],
|
|
172
172
|
},
|
|
173
173
|
play: async ({ canvasElement, step }) => {
|
|
174
|
-
step('expect error message', async () => {
|
|
174
|
+
await step('expect error message', async () => {
|
|
175
175
|
await expectInvalidAttributesErrorMessage(canvasElement, 'Array must contain at least 1 element(s)');
|
|
176
176
|
});
|
|
177
177
|
},
|
|
@@ -134,7 +134,7 @@ export const InvalidProps: StoryObj<SequencesByLocationProps> = {
|
|
|
134
134
|
lapisLocationField: '',
|
|
135
135
|
},
|
|
136
136
|
play: async ({ canvasElement, step }) => {
|
|
137
|
-
step('expect error message', async () => {
|
|
137
|
+
await step('expect error message', async () => {
|
|
138
138
|
await expectInvalidAttributesErrorMessage(
|
|
139
139
|
canvasElement,
|
|
140
140
|
'"lapisLocationField": String must contain at least 1 character(s)',
|
|
@@ -223,7 +223,7 @@ async function prepare(canvasElement: HTMLElement, step: StepFunction<PreactRend
|
|
|
223
223
|
const canvas = within(canvasElement);
|
|
224
224
|
|
|
225
225
|
const changedListenerMock = fn();
|
|
226
|
-
await step('Setup event listener mock',
|
|
226
|
+
await step('Setup event listener mock', () => {
|
|
227
227
|
canvasElement.addEventListener('gs-mutation-filter-changed', changedListenerMock);
|
|
228
228
|
});
|
|
229
229
|
|
|
@@ -265,5 +265,5 @@ const testNoOptionsExist = async (canvas: ReturnType<typeof within>, mutation: s
|
|
|
265
265
|
await expect(options).toHaveLength(0);
|
|
266
266
|
};
|
|
267
267
|
|
|
268
|
-
const inputField = (canvas: ReturnType<typeof within>) =>
|
|
268
|
+
const inputField = (canvas: ReturnType<typeof within>): HTMLElement =>
|
|
269
269
|
canvas.getByPlaceholderText('Enter a mutation', { exact: false });
|
|
@@ -25,7 +25,7 @@ const accumulateByPosition = (data: SubstitutionOrDeletionEntry[], sequenceType:
|
|
|
25
25
|
|
|
26
26
|
const initiallyFillPositionsToProportionAtBase = () => {
|
|
27
27
|
if (!positionsToProportionAtBase.has(position)) {
|
|
28
|
-
const empty = new Map();
|
|
28
|
+
const empty = new Map<string | undefined, number>();
|
|
29
29
|
basesOfView.forEach((base) => empty.set(base, 0));
|
|
30
30
|
empty.set(mutationEntry.mutation.valueAtReference, 1);
|
|
31
31
|
positionsToProportionAtBase.set(position, empty);
|
|
@@ -62,9 +62,9 @@ const MutationsOverTimeGrid: FunctionComponent<MutationsOverTimeGridProps> = ({
|
|
|
62
62
|
))}
|
|
63
63
|
{shownMutations.map((mutation, rowIndex) => {
|
|
64
64
|
return (
|
|
65
|
-
<Fragment key={`fragment-${mutation.
|
|
65
|
+
<Fragment key={`fragment-${mutation.code}`}>
|
|
66
66
|
<div
|
|
67
|
-
key={`mutation-${mutation.
|
|
67
|
+
key={`mutation-${mutation.code}`}
|
|
68
68
|
style={{ gridRowStart: rowIndex + 2, gridColumnStart: 1 }}
|
|
69
69
|
>
|
|
70
70
|
<MutationCell mutation={mutation} />
|
|
@@ -80,7 +80,7 @@ const MutationsOverTimeGrid: FunctionComponent<MutationsOverTimeGridProps> = ({
|
|
|
80
80
|
return (
|
|
81
81
|
<div
|
|
82
82
|
style={{ gridRowStart: rowIndex + 2, gridColumnStart: columnIndex + 2 }}
|
|
83
|
-
key={`${mutation.
|
|
83
|
+
key={`${mutation.code}-${date.dateString}`}
|
|
84
84
|
>
|
|
85
85
|
<ProportionCell
|
|
86
86
|
value={value}
|
|
@@ -164,7 +164,7 @@ export const WithNoLapisDateFieldField: StoryObj<MutationsOverTimeProps> = {
|
|
|
164
164
|
lapisDateField: '',
|
|
165
165
|
},
|
|
166
166
|
play: async ({ canvasElement, step }) => {
|
|
167
|
-
step('expect error message', async () => {
|
|
167
|
+
await step('expect error message', async () => {
|
|
168
168
|
await expectInvalidAttributesErrorMessage(canvasElement, 'String must contain at least 1 character(s)');
|
|
169
169
|
});
|
|
170
170
|
},
|
|
@@ -78,6 +78,7 @@ export const MutationsOverTimeInner: FunctionComponent<MutationsOverTimeProps> =
|
|
|
78
78
|
|
|
79
79
|
const { data, error, isLoading } = useWebWorker<MutationOverTimeQuery, MutationOverTimeWorkerResponse>(
|
|
80
80
|
messageToWorker,
|
|
81
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
81
82
|
MutationOverTimeWorker,
|
|
82
83
|
);
|
|
83
84
|
|
|
@@ -129,7 +129,7 @@ export const WithNoLapisDateField: StoryObj<NumberSequencesOverTimeProps> = {
|
|
|
129
129
|
lapisDateField: '',
|
|
130
130
|
},
|
|
131
131
|
play: async ({ canvasElement, step }) => {
|
|
132
|
-
step('expect error message', async () => {
|
|
132
|
+
await step('expect error message', async () => {
|
|
133
133
|
await expectInvalidAttributesErrorMessage(canvasElement, 'String must contain at least 1 character(s)');
|
|
134
134
|
});
|
|
135
135
|
},
|
|
@@ -87,13 +87,13 @@ const PrevalenceOverTimeBubbleChart = ({
|
|
|
87
87
|
intersect: false,
|
|
88
88
|
callbacks: {
|
|
89
89
|
title: (context) => {
|
|
90
|
-
const dataset = nonNullDateRangeData[context[0].datasetIndex
|
|
91
|
-
const dataPoint = dataset.content[context[0].dataIndex
|
|
90
|
+
const dataset = nonNullDateRangeData[context[0].datasetIndex];
|
|
91
|
+
const dataPoint = dataset.content[context[0].dataIndex];
|
|
92
92
|
return dataPoint.dateRange?.toString();
|
|
93
93
|
},
|
|
94
94
|
label: (context) => {
|
|
95
|
-
const dataset = nonNullDateRangeData[context.datasetIndex
|
|
96
|
-
const dataPoint = dataset.content[context.dataIndex
|
|
95
|
+
const dataset = nonNullDateRangeData[context.datasetIndex];
|
|
96
|
+
const dataPoint = dataset.content[context.dataIndex];
|
|
97
97
|
|
|
98
98
|
const percentage = (dataPoint.prevalence * 100).toFixed(2);
|
|
99
99
|
const count = dataPoint.count.toFixed(0);
|
|
@@ -254,7 +254,7 @@ export const WithNoLapisDateField: StoryObj<PrevalenceOverTimeProps> = {
|
|
|
254
254
|
lapisDateField: '',
|
|
255
255
|
},
|
|
256
256
|
play: async ({ canvasElement, step }) => {
|
|
257
|
-
step('expect error message', async () => {
|
|
257
|
+
await step('expect error message', async () => {
|
|
258
258
|
await expectInvalidAttributesErrorMessage(canvasElement, 'String must contain at least 1 character(s)');
|
|
259
259
|
});
|
|
260
260
|
},
|
|
@@ -188,7 +188,7 @@ export const WithNoLapisDateField: StoryObj<RelativeGrowthAdvantageProps> = {
|
|
|
188
188
|
lapisDateField: '',
|
|
189
189
|
},
|
|
190
190
|
play: async ({ canvasElement, step }) => {
|
|
191
|
-
step('expect error message', async () => {
|
|
191
|
+
await step('expect error message', async () => {
|
|
192
192
|
await expectInvalidAttributesErrorMessage(canvasElement, 'String must contain at least 1 character(s)');
|
|
193
193
|
});
|
|
194
194
|
},
|
|
@@ -92,13 +92,13 @@ export const RemoveInitialValue: StoryObj<TextInputProps> = {
|
|
|
92
92
|
const canvas = within(canvasElement);
|
|
93
93
|
|
|
94
94
|
const changedListenerMock = fn();
|
|
95
|
-
await step('Setup event listener mock',
|
|
95
|
+
await step('Setup event listener mock', () => {
|
|
96
96
|
canvasElement.addEventListener('gs-text-input-changed', changedListenerMock);
|
|
97
97
|
});
|
|
98
98
|
|
|
99
|
-
await waitFor(() => {
|
|
99
|
+
await waitFor(async () => {
|
|
100
100
|
const input = canvas.getByPlaceholderText('Enter a host name', { exact: false });
|
|
101
|
-
expect(input).toHaveValue('Homo sapiens');
|
|
101
|
+
await expect(input).toHaveValue('Homo sapiens');
|
|
102
102
|
});
|
|
103
103
|
|
|
104
104
|
await step('Remove initial value', async () => {
|
|
@@ -122,7 +122,7 @@ export const WithNoLapisField: StoryObj<TextInputProps> = {
|
|
|
122
122
|
lapisField: '',
|
|
123
123
|
},
|
|
124
124
|
play: async ({ canvasElement, step }) => {
|
|
125
|
-
step('expect error message', async () => {
|
|
125
|
+
await step('expect error message', async () => {
|
|
126
126
|
await expectInvalidAttributesErrorMessage(canvasElement, 'String must contain at least 1 character(s)');
|
|
127
127
|
});
|
|
128
128
|
},
|
package/src/utils/map2d.ts
CHANGED
|
@@ -150,6 +150,7 @@ export class Map2dView<Key1 extends object | string, Key2 extends object | strin
|
|
|
150
150
|
this.keysSecondAxis = new Map(map.keysSecondAxis);
|
|
151
151
|
|
|
152
152
|
if (map instanceof Map2dView) {
|
|
153
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- the generics match, we know that.
|
|
153
154
|
this.baseMap = map.baseMap;
|
|
154
155
|
}
|
|
155
156
|
this.baseMap = map;
|
|
@@ -50,9 +50,9 @@ export const Default: StoryObj<{ lapis: string }> = {
|
|
|
50
50
|
play: async ({ canvasElement }) => {
|
|
51
51
|
const canvas = within(canvasElement);
|
|
52
52
|
|
|
53
|
-
await waitFor(() => {
|
|
54
|
-
expect(canvas.getByText(LAPIS_URL)).toBeVisible();
|
|
55
|
-
expect(canvas.getByText('"name": "ORF1a",', { exact: false })).toBeVisible();
|
|
53
|
+
await waitFor(async () => {
|
|
54
|
+
await expect(canvas.getByText(LAPIS_URL)).toBeVisible();
|
|
55
|
+
await expect(canvas.getByText('"name": "ORF1a",', { exact: false })).toBeVisible();
|
|
56
56
|
});
|
|
57
57
|
},
|
|
58
58
|
};
|
|
@@ -66,8 +66,8 @@ export const WithNoLapisUrl: StoryObj<{ lapis: string }> = {
|
|
|
66
66
|
play: async ({ canvasElement }) => {
|
|
67
67
|
const canvas = within(canvasElement);
|
|
68
68
|
|
|
69
|
-
await waitFor(() => {
|
|
70
|
-
expect(canvas.getByText("Error: Invalid LAPIS URL: 'notAValidUrl'", { exact: false })).toBeVisible();
|
|
69
|
+
await waitFor(async () => {
|
|
70
|
+
await expect(canvas.getByText("Error: Invalid LAPIS URL: 'notAValidUrl'", { exact: false })).toBeVisible();
|
|
71
71
|
});
|
|
72
72
|
},
|
|
73
73
|
};
|
|
@@ -103,8 +103,8 @@ export const FailsToFetchReferenceGenome: StoryObj<{ lapis: string }> = {
|
|
|
103
103
|
play: async ({ canvasElement }) => {
|
|
104
104
|
const canvas = within(canvasElement);
|
|
105
105
|
|
|
106
|
-
await waitFor(() => {
|
|
107
|
-
expect(canvas.getByText('Error: Cannot fetch reference genome.', { exact: false })).toBeVisible();
|
|
106
|
+
await waitFor(async () => {
|
|
107
|
+
await expect(canvas.getByText('Error: Cannot fetch reference genome.', { exact: false })).toBeVisible();
|
|
108
108
|
});
|
|
109
109
|
},
|
|
110
110
|
};
|
|
@@ -16,7 +16,7 @@ const codeExample = String.raw`
|
|
|
16
16
|
<gs-date-range-selector
|
|
17
17
|
dateRangeOptions='[{ "label": "Year 2021", "dateFrom": "2021-01-01", "dateTo": "2021-12-31" }]'
|
|
18
18
|
earliestDate="1970-01-01"
|
|
19
|
-
|
|
19
|
+
value="Year 2021"
|
|
20
20
|
width="100%"
|
|
21
21
|
lapisDateField="myDateColumn"
|
|
22
22
|
></gs-date-range-selector>`;
|
|
@@ -99,15 +99,15 @@ export const FiresEvents: StoryObj<Required<DateRangeSelectorProps>> = {
|
|
|
99
99
|
|
|
100
100
|
const filterChangedListenerMock = fn();
|
|
101
101
|
const optionChangedListenerMock = fn();
|
|
102
|
-
await step('Setup event listener mock',
|
|
102
|
+
await step('Setup event listener mock', () => {
|
|
103
103
|
canvasElement.addEventListener('gs-date-range-filter-changed', filterChangedListenerMock);
|
|
104
104
|
canvasElement.addEventListener('gs-date-range-option-changed', optionChangedListenerMock);
|
|
105
105
|
});
|
|
106
106
|
|
|
107
107
|
await step('Expect last 6 months to be selected', async () => {
|
|
108
108
|
await expect(selectField(canvas)).toHaveValue('Last month');
|
|
109
|
-
await waitFor(() => {
|
|
110
|
-
expect(dateToPicker(canvas)).toHaveValue(toYYYYMMDD(new Date()));
|
|
109
|
+
await waitFor(async () => {
|
|
110
|
+
await expect(dateToPicker(canvas)).toHaveValue(toYYYYMMDD(new Date()));
|
|
111
111
|
});
|
|
112
112
|
});
|
|
113
113
|
|
|
@@ -133,5 +133,5 @@ export const FiresEvents: StoryObj<Required<DateRangeSelectorProps>> = {
|
|
|
133
133
|
},
|
|
134
134
|
};
|
|
135
135
|
|
|
136
|
-
const dateToPicker = (canvas: ReturnType<typeof within>) => canvas.getByPlaceholderText('Date to');
|
|
137
|
-
const selectField = (canvas: ReturnType<typeof within>) => canvas.getByRole('combobox');
|
|
136
|
+
const dateToPicker = (canvas: ReturnType<typeof within>): HTMLElement => canvas.getByPlaceholderText('Date to');
|
|
137
|
+
const selectField = (canvas: ReturnType<typeof within>): HTMLElement => canvas.getByRole('combobox');
|
|
@@ -181,7 +181,7 @@ export const FiresEvent: StoryObj<Required<LineageFilterProps>> = {
|
|
|
181
181
|
|
|
182
182
|
const inputField = () => canvas.getByPlaceholderText('Enter a lineage');
|
|
183
183
|
const listenerMock = fn();
|
|
184
|
-
await step('Setup event listener mock',
|
|
184
|
+
await step('Setup event listener mock', () => {
|
|
185
185
|
canvasElement.addEventListener('gs-lineage-filter-changed', listenerMock);
|
|
186
186
|
});
|
|
187
187
|
|
|
@@ -188,7 +188,7 @@ export const FiresEvent: StoryObj<LocationFilterProps> = {
|
|
|
188
188
|
const inputField = () => canvas.getByRole('combobox');
|
|
189
189
|
|
|
190
190
|
const listenerMock = fn();
|
|
191
|
-
await step('Setup event listener mock',
|
|
191
|
+
await step('Setup event listener mock', () => {
|
|
192
192
|
canvasElement.addEventListener('gs-location-changed', listenerMock);
|
|
193
193
|
});
|
|
194
194
|
|
|
@@ -72,7 +72,7 @@ export const FiresFilterChangedEvent: StoryObj<MutationFilterProps> = {
|
|
|
72
72
|
|
|
73
73
|
const inputField = () => canvas.getByPlaceholderText('Enter a mutation', { exact: false });
|
|
74
74
|
const listenerMock = fn();
|
|
75
|
-
await step('Setup event listener mock',
|
|
75
|
+
await step('Setup event listener mock', () => {
|
|
76
76
|
canvasElement.addEventListener('gs-mutation-filter-changed', listenerMock);
|
|
77
77
|
});
|
|
78
78
|
|
|
@@ -154,18 +154,18 @@ export const MultiSegmentedReferenceGenomes: StoryObj<MutationFilterProps> = {
|
|
|
154
154
|
|
|
155
155
|
const inputField = () => canvas.getByPlaceholderText('Enter a mutation', { exact: false });
|
|
156
156
|
|
|
157
|
-
await waitFor(() => {
|
|
157
|
+
await waitFor(async () => {
|
|
158
158
|
const placeholderText = inputField().getAttribute('placeholder');
|
|
159
159
|
|
|
160
|
-
expect(placeholderText).toEqual(
|
|
160
|
+
await expect(placeholderText).toEqual(
|
|
161
161
|
'Enter a mutation (e.g. seg1:23T, ins_seg1:10462:A, gene1:57Q, ins_gene1:31:N)',
|
|
162
162
|
);
|
|
163
163
|
});
|
|
164
164
|
|
|
165
|
-
await waitFor(() => {
|
|
166
|
-
expect(canvas.getByText('seg1:123T')).toBeVisible();
|
|
167
|
-
expect(canvas.getByText('gene2:56')).toBeVisible();
|
|
168
|
-
|
|
165
|
+
await waitFor(async () => {
|
|
166
|
+
await expect(canvas.getByText('seg1:123T')).toBeVisible();
|
|
167
|
+
await expect(canvas.getByText('gene2:56')).toBeVisible();
|
|
168
|
+
await expect(canvas.getByText('ins_seg2:78:AAA')).toBeVisible();
|
|
169
169
|
});
|
|
170
170
|
},
|
|
171
171
|
};
|
|
@@ -113,7 +113,7 @@ export const FiresEvents: StoryObj<Required<TextInputProps>> = {
|
|
|
113
113
|
|
|
114
114
|
const inputField = () => canvas.getByPlaceholderText('Enter host name');
|
|
115
115
|
const listenerMock = fn();
|
|
116
|
-
await step('Setup event listener mock',
|
|
116
|
+
await step('Setup event listener mock', () => {
|
|
117
117
|
canvasElement.addEventListener('gs-text-input-changed', listenerMock);
|
|
118
118
|
});
|
|
119
119
|
|
|
@@ -140,8 +140,8 @@ export const FiresEvents: StoryObj<Required<TextInputProps>> = {
|
|
|
140
140
|
});
|
|
141
141
|
|
|
142
142
|
await step('Verify event is fired with correct detail', async () => {
|
|
143
|
-
await waitFor(() => {
|
|
144
|
-
expect(listenerMock).toHaveBeenCalledWith(
|
|
143
|
+
await waitFor(async () => {
|
|
144
|
+
await expect(listenerMock).toHaveBeenCalledWith(
|
|
145
145
|
expect.objectContaining({
|
|
146
146
|
detail: {
|
|
147
147
|
host: 'Homo sapiens',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { customElement, property } from 'lit/decorators.js';
|
|
2
2
|
import type { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
3
3
|
|
|
4
|
-
import { Aggregate, type AggregateProps
|
|
4
|
+
import { Aggregate, type AggregateProps } from '../../preact/aggregatedData/aggregate';
|
|
5
5
|
import { type Equals, type Expect } from '../../utils/typeAssertions';
|
|
6
6
|
import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsStyles';
|
|
7
7
|
|
|
@@ -47,7 +47,7 @@ export class AggregateComponent extends PreactLitAdapterWithGridJsStyles {
|
|
|
47
47
|
* A list of tabs with views that this component should provide.
|
|
48
48
|
*/
|
|
49
49
|
@property({ type: Array })
|
|
50
|
-
views:
|
|
50
|
+
views: ('table' | 'bar')[] = ['table'];
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* The filter to apply to the data.
|