theme-service.mock.ts (dspace-angular-dspace-7.0) | : | theme-service.mock.ts (dspace-angular-dspace-7.1) | ||
---|---|---|---|---|
import { ThemeService } from '../theme-support/theme.service'; | import { ThemeService } from '../theme-support/theme.service'; | |||
import { of as observableOf } from 'rxjs'; | import { of as observableOf } from 'rxjs'; | |||
import { ThemeConfig } from '../../../config/theme.model'; | ||||
import { isNotEmpty } from '../empty.util'; | ||||
export function getMockThemeService(themeName = 'base'): ThemeService { | export function getMockThemeService(themeName = 'base', themes?: ThemeConfig[]): | |||
return jasmine.createSpyObj('themeService', { | ThemeService { | |||
const spy = jasmine.createSpyObj('themeService', { | ||||
getThemeName: themeName, | getThemeName: themeName, | |||
getThemeName$: observableOf(themeName) | getThemeName$: observableOf(themeName), | |||
getThemeConfigFor: undefined, | ||||
}); | }); | |||
if (isNotEmpty(themes)) { | ||||
spy.getThemeConfigFor.and.callFake((name: string) => themes.find(theme => th | ||||
eme.name === name)); | ||||
} | ||||
return spy; | ||||
} | } | |||
End of changes. 4 change blocks. | ||||
3 lines changed or deleted | 14 lines changed or added |