@@ -27,6 +27,7 @@ import { ElementWidgetActions } from "../../../src/stores/widgets/ElementWidgetA
27
27
import { VoiceBroadcastInfoEventType , VoiceBroadcastRecording } from "../../../src/voice-broadcast" ;
28
28
import { SdkContextClass } from "../../../src/contexts/SDKContext" ;
29
29
import ActiveWidgetStore from "../../../src/stores/ActiveWidgetStore" ;
30
+ import SettingsStore from "../../../src/settings/SettingsStore" ;
30
31
31
32
jest . mock ( "matrix-widget-api/lib/ClientWidgetApi" ) ;
32
33
@@ -44,7 +45,7 @@ describe("StopGapWidget", () => {
44
45
id : "test" ,
45
46
creatorUserId : "@alice:example.org" ,
46
47
type : "example" ,
47
- url : "https://example.org?user-id=$matrix_user_id&device-id=$org.matrix.msc3819.matrix_device_id&base-url=$org.matrix.msc4039.matrix_base_url" ,
48
+ url : "https://example.org?user-id=$matrix_user_id&device-id=$org.matrix.msc3819.matrix_device_id&base-url=$org.matrix.msc4039.matrix_base_url&theme=$org.matrix.msc2873.client_theme " ,
48
49
roomId : "!1:example.org" ,
49
50
} ,
50
51
room : mkRoom ( client , "!1:example.org" ) ,
@@ -63,9 +64,15 @@ describe("StopGapWidget", () => {
63
64
} ) ;
64
65
65
66
it ( "should replace parameters in widget url template" , ( ) => {
67
+ const originGetValue = SettingsStore . getValue ;
68
+ const spy = jest . spyOn ( SettingsStore , "getValue" ) . mockImplementation ( ( setting ) => {
69
+ if ( setting === "theme" ) return "my-theme-for-testing" ;
70
+ return originGetValue ( setting ) ;
71
+ } ) ;
66
72
expect ( widget . embedUrl ) . toBe (
67
- "https://example.org/?user-id=%40userId%3Amatrix.org&device-id=ABCDEFGHI&base-url=https%3A%2F%2Fmatrix-client.matrix.org&widgetId=test&parentUrl=http%3A%2F%2Flocalhost%2F" ,
73
+ "https://example.org/?user-id=%40userId%3Amatrix.org&device-id=ABCDEFGHI&base-url=https%3A%2F%2Fmatrix-client.matrix.org&theme=my-theme-for-testing& widgetId=test&parentUrl=http%3A%2F%2Flocalhost%2F" ,
68
74
) ;
75
+ spy . mockClear ( ) ;
69
76
} ) ;
70
77
71
78
it ( "feeds incoming to-device messages to the widget" , async ( ) => {
0 commit comments