• 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

18.18
/projects/igniteui-angular/src/lib/services/direction/directionality.ts
1
import { Injectable, Inject, InjectionToken, inject } from '@angular/core';
2
import { DOCUMENT } from '@angular/common';
3

4
/**
5
 * @hidden
6
 */
7
export type Direction = 'ltr' | 'rtl';
8

9
/**
10
 * @hidden
11
 */
12
export function DIR_DOCUMENT_FACTORY(): Document {
UNCOV
13
    return inject(DOCUMENT);
×
14
}
15

16
/**
17
 * Injection token is used to inject the document into Directionality
18
 * which factory could be faked for testing purposes.
19
 *
20
 * We can't provide and mock the DOCUMENT token from platform-browser because configureTestingModule
21
 * allows override of the default providers, directive, pipes, modules of the test injector
22
 * which causes errors.
23
 *
24
 * @hidden
25
 */
26
export const DIR_DOCUMENT = /*@__PURE__*/new InjectionToken<Document>('dir-doc', {
2✔
27
    providedIn: 'root',
28
    factory: DIR_DOCUMENT_FACTORY
29
});
30

31
/**
32
 * @hidden
33
 *
34
 * Bidirectional service that extracts the value of the direction attribute on the body or html elements.
35
 *
36
 * The dir attribute over the body element takes precedence.
37
 */
38
@Injectable({
39
    providedIn: 'root'
40
})
41
export class IgxDirectionality {
2✔
42
    private _dir: Direction;
43
    private _document: Document;
44

45
    public get value(): Direction {
UNCOV
46
        return this._dir;
×
47
    }
48

49
    public get document() {
UNCOV
50
        return this._document;
×
51
    }
52

53
    public get rtl() {
UNCOV
54
        return this._dir === 'rtl';
×
55
    }
56

57
    constructor(@Inject(DIR_DOCUMENT) document) {
UNCOV
58
        this._document = document;
×
UNCOV
59
        const bodyDir = this._document.body ? this._document.body.dir : null;
×
UNCOV
60
        const htmlDir = this._document.documentElement ? this._document.documentElement.dir : null;
×
UNCOV
61
        const extractedDir = bodyDir || htmlDir;
×
UNCOV
62
        this._dir = (extractedDir === 'ltr' || extractedDir === 'rtl') ? extractedDir : 'ltr';
×
63
    }
64
}
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