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

atinc / ngx-tethys / 68ef226c-f83e-44c1-b8ed-e420a83c5d84

28 May 2025 10:31AM UTC coverage: 10.352% (-80.0%) from 90.316%
68ef226c-f83e-44c1-b8ed-e420a83c5d84

Pull #3460

circleci

pubuzhixing8
chore: xxx
Pull Request #3460: refactor(icon): migrate signal input #TINFR-1476

132 of 6823 branches covered (1.93%)

Branch coverage included in aggregate %.

10 of 14 new or added lines in 1 file covered. (71.43%)

11648 existing lines in 344 files now uncovered.

2078 of 14525 relevant lines covered (14.31%)

6.69 hits per line

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

2.56
/src/core/overlay/utils.ts
1
import { ThyPlacement, ConnectedPositionOffset } from './interface';
2
import { POSITION_MAP } from './overlay-position-map';
1✔
3
import { ConnectionPositionPair } from '@angular/cdk/overlay';
4

5
const connectionFallbackPositionsMap: { [key: string]: ThyPlacement[] } = {
6
    top: ['topLeft', 'topRight', 'bottom', 'bottomLeft', 'bottomRight'],
7
    topLeft: ['top', 'topRight', 'bottomLeft', 'bottom', 'bottomRight'],
8
    topRight: ['top', 'topLeft', 'bottomRight', 'bottom', 'bottomLeft'],
9
    bottom: ['bottomLeft', 'bottomRight', 'top', 'topLeft', 'topRight'],
10
    bottomLeft: ['bottom', 'bottomRight', 'topLeft', 'top', 'topRight'],
11
    bottomRight: ['bottom', 'bottomLeft', 'topRight', 'top', 'topLeft'],
12
    left: ['leftTop', 'leftBottom', 'right', 'rightTop', 'rightBottom'],
13
    leftTop: ['left', 'leftBottom', 'rightTop', 'right', 'rightBottom'],
14
    leftBottom: ['left', 'leftTop', 'rightBottom', 'right', 'rightTop'],
15
    right: ['rightTop', 'rightBottom', 'left', 'leftTop', 'leftBottom'],
16
    rightTop: ['right', 'rightBottom', 'leftTop', 'left', 'leftBottom'],
UNCOV
17
    rightBottom: ['right', 'rightTop', 'leftBottom', 'left', 'leftTop']
×
UNCOV
18
};
×
UNCOV
19

×
20
export function buildConnectedPositionOffset(placement: ThyPlacement, offset: number): ConnectedPositionOffset {
UNCOV
21
    const connectedPositionOffset: ConnectedPositionOffset = {};
×
UNCOV
22
    if (placement.startsWith('top')) {
×
23
        connectedPositionOffset.offsetY = -offset;
UNCOV
24
    } else if (placement.startsWith('bottom')) {
×
UNCOV
25
        connectedPositionOffset.offsetY = offset;
×
26
    } else if (placement.startsWith('left')) {
UNCOV
27
        connectedPositionOffset.offsetX = -offset;
×
UNCOV
28
    } else if (placement.startsWith('right')) {
×
29
        connectedPositionOffset.offsetX = offset;
30
    } else {
31
        // do nothings
32
    }
UNCOV
33
    return connectedPositionOffset;
×
34
}
35

UNCOV
36
export function buildConnectedPositionPair(placement: ThyPlacement, offset?: number, panelClassPrefix?: string): ConnectionPositionPair {
×
37
    const position: ConnectionPositionPair = {
38
        ...POSITION_MAP[placement],
×
39
        ...(offset ? buildConnectedPositionOffset(placement, offset) : null)
UNCOV
40
    };
×
UNCOV
41
    if (panelClassPrefix) {
×
42
        position.panelClass = `${panelClassPrefix}-${placement}`;
UNCOV
43
    }
×
44
    return position;
45
}
UNCOV
46

×
47
export function getFallbackPlacements(placement: ThyPlacement): ThyPlacement[] {
48
    return connectionFallbackPositionsMap[placement] || [];
49
}
50

51
/**
52
 * get flexible positions by placement, return placement position and it's fallback connection position
53
 * @example
54
 * getFlexiblePositions('top', 10, 'thy-overlay')
55
 * [{topPosition}, {topLeftPosition}, {topRightPosition}, {bottomPosition}, {bottomLeftPosition}, {bottomRightPosition},]
UNCOV
56
 * @returns [ConnectionPositionPair]
×
UNCOV
57
 */
×
UNCOV
58
export function getFlexiblePositions(placement: ThyPlacement, offset?: number, panelClassPrefix?: string): ConnectionPositionPair[] {
×
59
    const fallbackPlacements = getFallbackPlacements(placement);
60

61
    return [placement, ...fallbackPlacements].map(placementName => {
UNCOV
62
        return buildConnectedPositionPair(placementName, offset, panelClassPrefix);
×
UNCOV
63
    });
×
UNCOV
64
}
×
UNCOV
65

×
66
export function getPlacementByPosition(position: ConnectionPositionPair) {
67
    const keyList = ['originX', 'originY', 'overlayX', 'overlayY'];
68
    for (const placement in POSITION_MAP) {
69
        if (keyList.every(key => position[key] === POSITION_MAP[placement][key])) {
70
            return placement;
71
        }
72
    }
73
}
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