• 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/carousel/engine/carousel-slide.ts
1
import { ChangeDetectorRef, QueryList, Renderer2 } from '@angular/core';
2
import { Platform } from '@angular/cdk/platform';
3
import { Observable, Subject } from 'rxjs';
4
import { IThyCarouselComponent } from '../carousel.token';
UNCOV
5
import { ThyDistanceVector } from '../typings';
×
6
import { ThyCarouselItemDirective } from '../carousel-item.directive';
7
import { ThyCarouselBaseEngine } from '../engine/carousel-base';
UNCOV
8

×
UNCOV
9
export class ThyCarouselSlideEngine extends ThyCarouselBaseEngine {
×
UNCOV
10
    constructor(thyCarouselComponent: IThyCarouselComponent, cdr: ChangeDetectorRef, renderer: Renderer2, platform: Platform) {
×
11
        super(thyCarouselComponent, cdr, renderer, platform);
UNCOV
12
    }
×
UNCOV
13

×
UNCOV
14
    private prepareHorizontalContext(activeIndex: number): void {
×
15
        if (activeIndex >= this.maxIndex) {
16
            this.renderer.setStyle(this.firstEl, 'left', `${this.length * this.contentWidth}px`);
UNCOV
17
            this.renderer.setStyle(this.lastEl, 'left', null);
×
18
        } else if (activeIndex <= 0) {
19
            this.renderer.setStyle(this.firstEl, 'left', null);
20
            this.renderer.setStyle(this.lastEl, 'left', `${-this.length * this.contentWidth}px`);
UNCOV
21
        } else {
×
UNCOV
22
            this.resetContext();
×
23
        }
24
    }
UNCOV
25

×
26
    private resetContext() {
27
        this.renderer.setStyle(this.lastEl, 'left', null);
UNCOV
28
        this.renderer.setStyle(this.firstEl, 'left', null);
×
UNCOV
29
    }
×
UNCOV
30

×
UNCOV
31
    initializeCarouselContents(contents: QueryList<ThyCarouselItemDirective> | null): void {
×
UNCOV
32
        this.initializeContents(contents);
×
UNCOV
33
    }
×
UNCOV
34

×
35
    dragging(pointerVector: ThyDistanceVector, rect: DOMRect): void {
UNCOV
36
        const { x } = pointerVector;
×
37
        const { width, height } = rect;
38
        this.contentWidth = width;
UNCOV
39
        this.contentHeight = height;
×
UNCOV
40
        const activeIndex = this.carouselComponent!.activeIndex;
×
UNCOV
41
        if (this.length > 1) {
×
42
            this.prepareHorizontalContext(activeIndex);
UNCOV
43
        }
×
UNCOV
44
        this.renderer.setStyle(this.wrapperEl, 'transform', `translate3d(${-activeIndex * this.contentWidth + x}px,0 , 0)`);
×
UNCOV
45
    }
×
UNCOV
46

×
47
    switch(to: number, from: number): Observable<void> {
UNCOV
48
        const switch$ = new Subject<void>();
×
UNCOV
49
        if (Math.abs(from - to) === 1 || from === to) {
×
UNCOV
50
            this.prepareHorizontalContext(to);
×
UNCOV
51
        }
×
UNCOV
52
        this.renderer.setStyle(this.wrapperEl, `transition-duration`, `${this.playTime}ms`);
×
53
        this.renderer.setStyle(this.wrapperEl, `transform`, `translate3d(${-to * this.contentWidth}px,0 , 0)`);
UNCOV
54
        setTimeout(() => {
×
55
            switch$.next();
56
        }, 0);
UNCOV
57
        setTimeout(() => {
×
UNCOV
58
            this.resetContext();
×
UNCOV
59
            this.renderer.setStyle(this.wrapperEl, `transition-duration`, `0s`);
×
60
            this.renderer.setStyle(
61
                this.wrapperEl,
62
                `transform`,
63
                `translate3d(${-((to + this.length) % this.length) * this.contentWidth}px,0 , 0)`
64
            );
65
            switch$.complete();
66
        }, this.playTime);
67
        return switch$.asObservable();
68
    }
69

70
    correctionOffset(): void {
71
        super.correctionOffset();
72
        const { activeIndex } = this.carouselComponent!;
73
        this.renderer.setStyle(this.wrapperEl, `transform`, `translate3d(${-activeIndex * this.contentWidth}px,0 , 0)`);
74
    }
75
}
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