• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

IgniteUI / igniteui-angular / 13331632524

14 Feb 2025 02:51PM CUT coverage: 22.015% (-69.6%) from 91.622%
13331632524

Pull #15372

github

web-flow
Merge d52d57714 into bcb78ae0a
Pull Request #15372: chore(*): test ci passing

1990 of 15592 branches covered (12.76%)

431 of 964 new or added lines in 18 files covered. (44.71%)

19956 existing lines in 307 files now uncovered.

6452 of 29307 relevant lines covered (22.02%)

249.17 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.67
/projects/igniteui-angular/src/lib/services/theme/theme.token.ts
1
import { inject, InjectionToken } from "@angular/core";
2
import { mkenum } from "../../core/utils";
3
import { BehaviorSubject } from "rxjs";
4
import { DOCUMENT } from "@angular/common";
5

6
export class ThemeToken {
7
    private document = inject(DOCUMENT);
35✔
8
    public subject: BehaviorSubject<IgxTheme>;
9

10
    constructor(private t?: IgxTheme) {
35✔
11
        const globalTheme = globalThis.window
35!
12
            ?.getComputedStyle(this.document.body)
13
            .getPropertyValue("--ig-theme")
14
            .trim() || 'material' as IgxTheme;
15

16
        const _theme = t ?? globalTheme as IgxTheme;
35✔
17
        this.subject = new BehaviorSubject(_theme);
35✔
18
    }
19

20
    public onChange(callback: (theme: IgxTheme) => void) {
21
        return this.subject.subscribe(callback);
589✔
22
    }
23

24
    public set(theme: IgxTheme) {
UNCOV
25
        this.subject.next(theme);
×
26
    }
27

28
    public get theme() {
29
        return this.subject.getValue();
554✔
30
    }
31

32
    public get preferToken() {
33
        return !!this.t;
2,753✔
34
    }
35
}
36

37
export const THEME_TOKEN = new InjectionToken<ThemeToken>('ThemeToken', {
2✔
38
    providedIn: 'root',
39
    factory: () => new ThemeToken()
35✔
40
});
41

42
const Theme = /*@__PURE__*/ mkenum({
2✔
43
    Material: "material",
44
    Fluent: "fluent",
45
    Bootstrap: "bootstrap",
46
    IndigoDesign: "indigo",
47
});
48

49
/**
50
 * Determines the component theme.
51
 */
52
export type IgxTheme = (typeof Theme)[keyof typeof Theme];
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc