11import {
22 DEFAULT_PRELOAD_DATA_VARIABLES ,
33 ThemeData ,
4- ThemeRegistrationStorageData ,
4+ ThemeRegistrationData ,
55 THEME_CACHE_LOCAL_STORAGE_KEY ,
66} from './ThemeModel' ;
77import {
@@ -10,7 +10,6 @@ import {
1010 getDefaultBaseThemes ,
1111 getThemeKey ,
1212 getThemePreloadData ,
13- mapThemeRegistrationData ,
1413 preloadTheme ,
1514 setThemePreloadData ,
1615} from './ThemeUtils' ;
@@ -62,21 +61,18 @@ describe('getActiveThemes', () => {
6261 } ,
6362 } satisfies Record < string , ThemeData > ;
6463
65- const themeRegistration : ThemeRegistrationStorageData = {
66- base : new Map ( [ [ mockTheme . base . themeKey , mockTheme . base ] ] ) ,
67- custom : new Map ( [ [ mockTheme . custom . themeKey , mockTheme . custom ] ] ) ,
64+ const themeRegistration : ThemeRegistrationData = {
65+ base : [ mockTheme . base ] ,
66+ custom : [ mockTheme . custom ] ,
6867 } ;
6968
7069 it . each ( [ null , mockTheme . customInvalid ] ) (
7170 'should throw if base theme not found' ,
7271 customTheme => {
7372 expect ( ( ) =>
7473 getActiveThemes ( customTheme ?. themeKey ?? 'mock.themeKey' , {
75- base : new Map ( ) ,
76- custom :
77- customTheme == null
78- ? new Map ( )
79- : new Map ( [ [ customTheme . themeKey , customTheme ] ] ) ,
74+ base : [ ] ,
75+ custom : customTheme == null ? [ ] : [ customTheme ] ,
8076 } )
8177 ) . toThrowError ( `Default base theme 'default-dark' is not registered` ) ;
8278 }
@@ -153,55 +149,6 @@ describe('getThemePreloadData', () => {
153149 ) ;
154150} ) ;
155151
156- describe ( 'mapThemeRegistrationData' , ( ) => {
157- const baseThemeA : ThemeData = {
158- name : 'Default Dark' ,
159- themeKey : 'default-dark' ,
160- styleContent : 'mock.base.styleContent' ,
161- } ;
162-
163- const baseThemeB : ThemeData = {
164- name : 'Default Light' ,
165- themeKey : 'default-light' ,
166- styleContent : 'mock.base.styleContent' ,
167- } ;
168-
169- const customThemeA : ThemeData = {
170- name : 'mock.custom.A' ,
171- baseThemeKey : 'default-dark' ,
172- themeKey : 'mock.custom.a' ,
173- styleContent : 'mock.custom.styleContent' ,
174- } ;
175-
176- const customThemeB : ThemeData = {
177- name : 'mock.custom.B' ,
178- baseThemeKey : 'default-light' ,
179- themeKey : 'mock.custom.b' ,
180- styleContent : 'mock.custom.styleContent' ,
181- } ;
182-
183- it ( 'should map theme registration data to storage data' , ( ) => {
184- const base = [ baseThemeA , baseThemeB ] ;
185- const custom = [ customThemeA , customThemeB ] ;
186-
187- const actual = mapThemeRegistrationData ( {
188- base,
189- custom,
190- } ) ;
191-
192- expect ( actual ) . toEqual ( {
193- base : new Map ( [
194- [ baseThemeA . themeKey , baseThemeA ] ,
195- [ baseThemeB . themeKey , baseThemeB ] ,
196- ] ) ,
197- custom : new Map ( [
198- [ customThemeA . themeKey , customThemeA ] ,
199- [ customThemeB . themeKey , customThemeB ] ,
200- ] ) ,
201- } ) ;
202- } ) ;
203- } ) ;
204-
205152describe ( 'preloadTheme' , ( ) => {
206153 it . each ( [
207154 null ,
0 commit comments