diff --git a/public/app/features/templating/template_srv.test.ts b/public/app/features/templating/template_srv.test.ts index e96fce7f5d3..640143a289e 100644 --- a/public/app/features/templating/template_srv.test.ts +++ b/public/app/features/templating/template_srv.test.ts @@ -7,6 +7,7 @@ import { EmbeddedScene, IntervalVariable, QueryVariable, + SafeSerializableSceneObject, SceneCanvasText, SceneVariableSet, TestVariable, @@ -844,6 +845,16 @@ describe('templateSrv', () => { expect(interpolateMock.mock.calls[0][1]).toEqual('test ${test}'); }); + it('should use scene interpolator when scoped var provided via SafeSerializableSceneObject', () => { + const variable = new TestVariable({}); + const serializable = new SafeSerializableSceneObject(variable); + _templateSrv.replace('test ${test}', { __sceneObject: serializable }); + + expect(interpolateMock).toHaveBeenCalledTimes(1); + expect(interpolateMock.mock.calls[0][0]).toEqual(variable); + expect(interpolateMock.mock.calls[0][1]).toEqual('test ${test}'); + }); + it('should use scene interpolator global __grafanaSceneContext is active', () => { window.__grafanaSceneContext = new EmbeddedScene({ $variables: new SceneVariableSet({