• 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/mention/adapter/editable.adapter.ts
1
import { MentionAdapter, MentionInputorElement, SeekQueryResult } from './adapter';
2
import { Mention, MentionDefaultDataItem } from '../interfaces';
3

UNCOV
4
export class EditableMentionAdapter extends MentionAdapter {
×
5
    inputor: MentionInputorElement;
6

UNCOV
7
    constructor(inputor: MentionInputorElement) {
×
UNCOV
8
        super(inputor);
×
UNCOV
9
    }
×
UNCOV
10

×
UNCOV
11
    seekQuery(event: Event, mention: Mention): SeekQueryResult {
×
UNCOV
12
        const selectionStart = getSelection().focusOffset;
×
UNCOV
13
        const value = this.inputor.innerText.replace(/[\r\n]/g, ' ');
×
UNCOV
14
        const start = value.lastIndexOf(mention.trigger, selectionStart);
×
UNCOV
15
        const fistSpaceIndexFromStart = value.indexOf(' ', selectionStart);
×
16
        const end = fistSpaceIndexFromStart > -1 ? fistSpaceIndexFromStart : value.length;
17
        const termWithTrigger = value.substring(start, end);
18
        const startBeforeHasSpace = start > 0 && value[start - 1] === ' ';
19
        if ((startBeforeHasSpace || start === 0) && !termWithTrigger.includes(' ') && !termWithTrigger.includes(mention.trigger, 1)) {
20
            return {
21
                start: start,
22
                end: end,
×
23
                term: termWithTrigger.substring(mention.trigger.length)
24
            };
25
        } else {
UNCOV
26
            return null;
×
27
        }
×
28
    }
UNCOV
29

×
UNCOV
30
    insertMention(item: MentionDefaultDataItem): string {
×
UNCOV
31
        if ((typeof ngDevMode === 'undefined' || ngDevMode) && !this.matchedMention) {
×
32
            throw new Error(`matchedMention is null`);
33
        }
34
        const insertValue = this.getInsertValue(item);
35
        const value: string = this.inputor.innerText;
UNCOV
36
        const newValue = [
×
UNCOV
37
            value.slice(0, this.matchedMention.query.start),
×
38
            insertValue,
39
            value.slice(this.matchedMention.query.end, value.length)
UNCOV
40
        ].join('');
×
41
        this.inputor.value = newValue;
×
42
        return newValue;
43
    }
UNCOV
44

×
45
    private getInsertValue(item: MentionDefaultDataItem) {
46
        if (this.matchedMention.mention.insertTransform) {
47
            return this.matchedMention.mention.insertTransform(item).trim() + ' ';
48
        } else {
49
            return `${this.matchedMention.mention.trigger}${item['name']}`.trim() + ' ';
50
        }
51
    }
52
}
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