• 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

0.0
/src/core/scroll-to.service.ts
1
import { Injectable } from '@angular/core';
2
import { dom } from 'ngx-tethys/util';
3

UNCOV
4
export class ScrollToService {
×
UNCOV
5
    static _customScrollToElement(targetElement: HTMLElement, containerElement: HTMLElement) {
×
6
        const containerOffset = dom.getElementOffset(containerElement);
UNCOV
7
        const targetOffset = dom.getElementOffset(targetElement);
×
8
        // 选择项在顶部隐藏的偏移量 > 0 表示被顶部遮住隐藏
UNCOV
9
        const topOffset = containerOffset.top - targetOffset.top;
×
10
        // 选择项在底部隐藏的偏移量 > 0 表示被底部遮住隐藏
UNCOV
11
        const bottomOffset = targetOffset.top + targetOffset.height - (containerOffset.top + containerOffset.height);
×
UNCOV
12
        // 隐藏后滚动展示 targetElement 的偏移量,避免紧挨着头部或者底部
×
13
        const viewOffset = targetOffset.height;
×
14
        if (topOffset > 0) {
UNCOV
15
            containerElement.scrollTop = containerElement.scrollTop - topOffset - viewOffset;
×
16
        } else if (bottomOffset > 0) {
×
17
            containerElement.scrollTop = containerElement.scrollTop + bottomOffset + viewOffset;
18
        }
19
    }
UNCOV
20
    static scrollToElement(targetElement: HTMLElement, containerElement: HTMLElement) {
×
UNCOV
21
        if (targetElement) {
×
22
            this._customScrollToElement(targetElement, containerElement);
23
            // if (targetElement.scrollIntoView) {
24
            //     targetElement.scrollIntoView({
25
            //         behavior: 'smooth',
26
            //         block: 'center'
27
            //     });
28
            // } else {
29
            //     this._customScrollToElement(targetElement, containerElement);
30
            // }
31
        }
32
    }
33
}
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