Skip to content

Commit d62e504

Browse files
committed
test: addActivationHandlerSpy not being called when applyMode is manual
1 parent b4ab235 commit d62e504

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

packages/scenes/src/variables/groupby/GroupByVariable.test.tsx

+19-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { SceneVariableSet } from '../sets/SceneVariableSet';
1414
import userEvent from '@testing-library/user-event';
1515
import { TestContextProvider } from '../../../utils/test/TestContextProvider';
1616
import { FiltersRequestEnricher } from '../../core/types';
17+
import { allActiveGroupByVariables } from './findActiveGroupByVariablesByUid';
1718

1819
// 11.1.2 - will use SafeSerializableSceneObject
1920
// 11.1.1 - will NOT use SafeSerializableSceneObject
@@ -259,8 +260,25 @@ describe.each(['11.1.2', '11.1.1'])('GroupByVariable', (v) => {
259260
});
260261
});
261262

263+
it('does NOT call addActivationHandler when applyMode is manual', async () => {
264+
allActiveGroupByVariables.clear();
265+
266+
const { variable } = setupTest({
267+
applyMode: 'manual',
268+
});
269+
270+
const addActivationHandlerSpy = jest.spyOn(variable, 'addActivationHandler');
271+
272+
await act(async () => {
273+
await lastValueFrom(variable.validateAndUpdate());
274+
});
275+
276+
expect(addActivationHandlerSpy).not.toHaveBeenCalled();
277+
expect(allActiveGroupByVariables.size).toBe(0);
278+
});
279+
262280
// TODO enable once this repo is using @grafana/[email protected]
263-
it.skip('shows groups and orders according to first occurence of a group item', async () => {
281+
it.skip('shows groups and orders according to first occurrence of a group item', async () => {
264282
const { runRequest } = setupTest({
265283
getTagKeysProvider: async () => ({
266284
replace: true,

0 commit comments

Comments
 (0)