94233: Fixed tests

This commit is contained in:
lotte
2022-09-22 17:07:09 +02:00
parent 08577f5f17
commit d68f38e848
5 changed files with 17 additions and 7 deletions

View File

@@ -1,3 +1,4 @@
/* eslint-disable max-classes-per-file */
import { Action } from '@ngrx/store';
import { type } from '../ngrx/type';
import { KeyValuePair } from '../key-value-pair.model';
@@ -38,9 +39,6 @@ export class AddAllCSSVariablesAction implements Action {
export class ClearCSSVariablesAction implements Action {
type = CSSVariableActionTypes.CLEAR;
constructor() {
}
}
export type CSSVariableAction = AddCSSVariableAction | AddAllCSSVariablesAction | ClearCSSVariablesAction;

View File

@@ -19,7 +19,7 @@ export function cssVariablesReducer(state = initialState, action: CSSVariableAct
return Object.assign({}, state, { [variable.name]: variable.value });
} case CSSVariableActionTypes.ADD_ALL: {
const variables = action.payload;
return Object.assign({}, state, ...variables.map(({ key, value }: KeyValuePair<string, string>) => {return {[key]: value}}));
return Object.assign({}, state, ...variables.map(({ key, value }: KeyValuePair<string, string>) => {return {[key]: value};}));
} case CSSVariableActionTypes.CLEAR: {
return initialState;
}

View File

@@ -87,8 +87,7 @@ export class CSSVariableService {
* @return array<KeyValuePair<string, string>>
* ex; [{key: "--color-accent", value: "#b9f500"}, {key: "--color-text", value: "#252525"}, ...]
*/
getCSSVariablesFromStylesheets(document: Document): KeyValuePair<string, string>[]
{
getCSSVariablesFromStylesheets(document: Document): KeyValuePair<string, string>[] {
// styleSheets is array-like, so we convert it to an array.
// Filter out any stylesheets not on this domain
return [...document.styleSheets]

View File

@@ -1,4 +1,5 @@
import { Observable, of as observableOf } from 'rxjs';
import { KeyValuePair } from '../key-value-pair.model';
const variables = {
'--bs-sm-min': '576px,',
@@ -19,4 +20,16 @@ export class CSSVariableServiceStub {
addCSSVariable(name: string, value: string): void {
/**/
}
addCSSVariables(variables: KeyValuePair<string, string>[]): void {
/**/
}
clearCSSVariables(): void {
/**/
}
getCSSVariablesFromStylesheets(document: Document): void {
/**/
}
}

View File

@@ -18,7 +18,7 @@ import { LocaleService } from '../../app/core/locale/locale.service';
import { Angulartics2DSpace } from '../../app/statistics/angulartics/dspace-provider';
import { MetadataService } from '../../app/core/metadata/metadata.service';
import { BreadcrumbsService } from '../../app/breadcrumbs/breadcrumbs.service';
import { CSSVariableService } from '../../app/shared/sass-helper/sass-helper.service';
import { CSSVariableService } from '../../sass-helper/css-variable.service';
import { ThemeService } from '../../app/shared/theme-support/theme.service';
import { take } from 'rxjs/operators';