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

IgniteUI / igniteui-angular / 13331632524

14 Feb 2025 02:51PM UTC 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

9.09
/projects/igniteui-angular/src/lib/services/overlay/position/global-position-strategy.ts
1
import { fadeIn, fadeOut } from 'igniteui-angular/animations';
2
import { HorizontalAlignment, PositionSettings, Util, VerticalAlignment } from './../utilities';
3
import { IPositionStrategy } from './IPositionStrategy';
4

5
/**
6
 * Positions the element based on the directions passed in trough PositionSettings.
7
 * These are Top/Middle/Bottom for verticalDirection and Left/Center/Right for horizontalDirection
8
 */
9
export class GlobalPositionStrategy implements IPositionStrategy {
10
    /**
11
     * PositionSettings to use when position the component in the overlay
12
     */
13
    public settings: PositionSettings;
14

15
    protected _defaultSettings: PositionSettings = {
75✔
16
        horizontalDirection: HorizontalAlignment.Center,
17
        verticalDirection: VerticalAlignment.Middle,
18
        horizontalStartPoint: HorizontalAlignment.Center,
19
        verticalStartPoint: VerticalAlignment.Middle,
20
        openAnimation: fadeIn,
21
        closeAnimation: fadeOut,
22
        minSize: { width: 0, height: 0 }
23
    };
24

25
    constructor(settings?: PositionSettings) {
26
        this.settings = Object.assign({}, this._defaultSettings, settings);
75✔
27
    }
28

29
    /**
30
     * Position the element based on the PositionStrategy implementing this interface.
31
     *
32
     * @param contentElement The HTML element to be positioned
33
     * @param size Size of the element
34
     * @param document reference to the Document object
35
     * @param initialCall should be true if this is the initial call to the method
36
     * @param target attaching target for the component to show
37
     * ```typescript
38
     * settings.positionStrategy.position(content, size, document, true);
39
     * ```
40
     */
41
    public position(contentElement: HTMLElement): void {
UNCOV
42
        contentElement.classList.add('igx-overlay__content--relative');
×
UNCOV
43
        contentElement.parentElement.classList.add('igx-overlay__wrapper--flex');
×
UNCOV
44
        this.setPosition(contentElement);
×
45
    }
46

47
    /**
48
     * Clone the strategy instance.
49
     * ```typescript
50
     * settings.positionStrategy.clone();
51
     * ```
52
     */
53
    public clone(): IPositionStrategy {
54
        return Util.cloneInstance(this);
×
55
    }
56

57
    protected setPosition(contentElement: HTMLElement) {
UNCOV
58
        switch (this.settings.horizontalDirection) {
×
59
            case HorizontalAlignment.Left:
UNCOV
60
                contentElement.parentElement.style.justifyContent = 'flex-start';
×
UNCOV
61
                break;
×
62
            case HorizontalAlignment.Center:
UNCOV
63
                contentElement.parentElement.style.justifyContent = 'center';
×
UNCOV
64
                break;
×
65
            case HorizontalAlignment.Right:
UNCOV
66
                contentElement.parentElement.style.justifyContent = 'flex-end';
×
UNCOV
67
                break;
×
68
            default:
69
                break;
×
70
        }
71

UNCOV
72
        switch (this.settings.verticalDirection) {
×
73
            case VerticalAlignment.Top:
UNCOV
74
                contentElement.parentElement.style.alignItems = 'flex-start';
×
UNCOV
75
                break;
×
76
            case VerticalAlignment.Middle:
UNCOV
77
                contentElement.parentElement.style.alignItems = 'center';
×
UNCOV
78
                break;
×
79
            case VerticalAlignment.Bottom:
UNCOV
80
                contentElement.parentElement.style.alignItems = 'flex-end';
×
UNCOV
81
                break;
×
82
            default:
83
                break;
×
84
        }
85
    }
86
}
87

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