Skip to content

Commit 07da71c

Browse files
changes for fix angular test
1 parent 0bd0be9 commit 07da71c

File tree

1 file changed

+6
-6
lines changed
  • packages/devextreme-schematics/src/add-layout/files/src/app/shared/services

1 file changed

+6
-6
lines changed

packages/devextreme-schematics/src/add-layout/files/src/app/shared/services/theme.service.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Injectable } from '@angular/core';
2-
1+
import { Inject, Injectable } from '@angular/core';
2+
import { DOCUMENT } from '@angular/common';
33
const themes = ['light', 'dark'] as const;
44
const themeClassNamePrefix = 'dx-swatch-';
55

@@ -16,9 +16,9 @@ export class ThemeService {
1616

1717
currentTheme: Theme = getNextTheme();
1818

19-
constructor() {
20-
if (!document.body.className.includes(themeClassNamePrefix)) {
21-
document.body.classList.add(themeClassNamePrefix + this.currentTheme);
19+
constructor(@Inject(DOCUMENT) private document: Document) {
20+
if (!this.document.body.className.includes(themeClassNamePrefix)) {
21+
this.document.body.classList.add(themeClassNamePrefix + this.currentTheme);
2222
}
2323
}
2424

@@ -27,7 +27,7 @@ export class ThemeService {
2727
const newTheme = getNextTheme(this.currentTheme);
2828
const isCurrentThemeDark = currentTheme === 'dark';
2929

30-
document.body.classList.replace(
30+
this.document.body.classList.replace(
3131
themeClassNamePrefix + currentTheme,
3232
themeClassNamePrefix + newTheme
3333
);

0 commit comments

Comments
 (0)