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

adobe / spectrum-web-components / 13782907169

11 Mar 2025 07:50AM UTC coverage: 97.977%. Remained the same
13782907169

Pull #5181

github

web-flow
Merge 60ed4f689 into 0dadda413
Pull Request #5181: fix(lint): fixed the cem import statement

5298 of 5604 branches covered (94.54%)

Branch coverage included in aggregate %.

33650 of 34148 relevant lines covered (98.54%)

645.78 hits per line

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

84.21
/tools/shared/src/get-label-from-slot.ts
1
/*
71✔
2
Copyright 2022 Adobe. All rights reserved.
71✔
3
This file is licensed to you under the Apache License, Version 2.0 (the "License");
71✔
4
you may not use this file except in compliance with the License. You may obtain a copy
71✔
5
of the License at http://www.apache.org/licenses/LICENSE-2.0
71✔
6

71✔
7
Unless required by applicable law or agreed to in writing, software distributed under
71✔
8
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
71✔
9
OF ANY KIND, either express or implied. See the License for the specific language
71✔
10
governing permissions and limitations under the License.
71✔
11
*/
71✔
12

71✔
13
export const getLabelFromSlot = (
71✔
14
    label: string,
9✔
15
    slotEl: HTMLSlotElement
9✔
16
): string | null => {
9✔
17
    if (label) return null;
9✔
18
    const textContent = slotEl
8✔
19
        .assignedNodes()
8✔
20
        .reduce((accumulator: string, node: Node) => {
8✔
21
            if (node.textContent) {
14✔
22
                return accumulator + node.textContent;
14✔
23
            } else {
14!
24
                return accumulator;
×
25
            }
×
26
        }, '');
8✔
27
    if (textContent) {
8✔
28
        return textContent.trim();
8✔
29
    } else {
9!
30
        return null;
×
31
    }
×
32
};
9✔
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