• 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

7.69
/src/date-picker/lib/decade/decade-table.component.ts
1
import { ChangeDetectionStrategy, Component, OnChanges } from '@angular/core';
2
import { TinyDate } from 'ngx-tethys/util';
3
import { CalendarTable } from '../calendar/calendar-table.component';
4
import { DateCell, DecadeCell, DateBodyRow } from '../date/types';
5
import { NgClass } from '@angular/common';
6

7
/**
8
 * @private
9
 */
10
@Component({
1✔
11
    changeDetection: ChangeDetectionStrategy.OnPush,
UNCOV
12
    // eslint-disable-next-line @angular-eslint/component-selector
×
13
    selector: 'decade-table',
14
    exportAs: 'decadeTable',
UNCOV
15
    templateUrl: 'decade-table.component.html',
×
16
    imports: [NgClass]
17
})
UNCOV
18
export class DecadeTable extends CalendarTable implements OnChanges {
×
UNCOV
19
    MAX_ROW = 4;
×
UNCOV
20
    MAX_COL = 3;
×
21

22
    get startYear(): number {
UNCOV
23
        return parseInt(`${this.activeDate.getYear() / 100}`, 10) * 100;
×
UNCOV
24
    }
×
25
    get endYear(): number {
26
        return this.startYear + 99;
UNCOV
27
    }
×
28

29
    constructor() {
UNCOV
30
        super();
×
UNCOV
31
    }
×
UNCOV
32

×
UNCOV
33
    private chooseDecade(startYear: number): void {
×
UNCOV
34
        this.value = (this.value || new TinyDate()).setYear(startYear);
×
UNCOV
35
        this.valueChange.emit(this.value);
×
UNCOV
36
    }
×
UNCOV
37

×
38
    makeHeadRow(): DateCell[] {
39
        return [];
40
    }
UNCOV
41

×
UNCOV
42
    makeBodyRows(): DateBodyRow[] {
×
UNCOV
43
        const decades: DateBodyRow[] = [];
×
UNCOV
44
        const currentYear = this.value && this.value.getYear();
×
UNCOV
45
        const startYear = this.startYear;
×
46
        const endYear = this.endYear;
47
        const previousYear = startYear - 10;
48

×
49
        let index = 0;
50
        for (let rowIndex = 0; rowIndex < this.MAX_ROW; rowIndex++) {
51
            const row: DateBodyRow = {
UNCOV
52
                dateCells: [],
×
53
                trackByIndex: rowIndex
54
            };
UNCOV
55
            for (let colIndex = 0; colIndex < this.MAX_COL; colIndex++) {
×
UNCOV
56
                const start = previousYear + index * 10;
×
UNCOV
57
                const end = previousYear + index * 10 + 9;
×
58
                const content = `${start}-${end}`;
UNCOV
59

×
60
                const cell: DecadeCell = {
UNCOV
61
                    content,
×
62
                    title: content,
63
                    isSelected: currentYear >= start && currentYear <= end,
UNCOV
64
                    isLowerThanStart: end < startYear,
×
65
                    isBiggerThanEnd: start > endYear,
66
                    classMap: null,
67
                    onClick: () => this.chooseDecade(start),
68
                    onMouseEnter(): void {}
69
                };
70
                cell.classMap = this.getClassMap(cell);
71

UNCOV
72
                index++;
×
UNCOV
73
                row.dateCells.push(cell);
×
74
            }
75
            decades.push(row);
1✔
76
        }
77
        return decades;
1✔
78
    }
79

80
    getClassMap(cell: DecadeCell): { [key: string]: boolean } {
81
        return {
82
            [`${this.prefixCls}-decade-panel-cell`]: true,
83
            [`${this.prefixCls}-decade-panel-selected-cell`]: cell.isSelected,
84
            [`${this.prefixCls}-decade-panel-last-century-cell`]: cell.isLowerThanStart,
85
            [`${this.prefixCls}-decade-panel-next-century-cell`]: cell.isBiggerThanEnd
86
        };
87
    }
88

89
    cellClick(event: Event, cell: DecadeCell) {
90
        event.stopPropagation();
91
        cell.onClick();
92
    }
93
}
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