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

adobe / spectrum-web-components / 14094674923

26 Mar 2025 10:27PM CUT coverage: 86.218% (-11.8%) from 98.002%
14094674923

Pull #5221

github

web-flow
Merge 2a1ea92e7 into 3184c1e6a
Pull Request #5221: RFC | leverage css module imports in components

1737 of 2032 branches covered (85.48%)

Branch coverage included in aggregate %.

14184 of 16434 relevant lines covered (86.31%)

85.29 hits per line

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

40.58
/packages/picker/src/MobileController.ts
1
/*
6✔
2
Copyright 2024 Adobe. All rights reserved.
6✔
3
This file is licensed to you under the Apache License, Version 2.0 (the "License");
6✔
4
you may not use this file except in compliance with the License. You may obtain a copy
6✔
5
of the License at http://www.apache.org/licenses/LICENSE-2.0
6✔
6
Unless required by applicable law or agreed to in writing, software distributed under
6✔
7
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
6✔
8
OF ANY KIND, either express or implied. See the License for the specific language
6✔
9
governing permissions and limitations under the License.
6✔
10
*/
6✔
11

6✔
12
import {
6✔
13
    InteractionController,
6✔
14
    InteractionTypes,
6✔
15
    SAFARI_FOCUS_RING_CLASS,
6✔
16
} from './InteractionController.js';
6✔
17
import { isWebKit } from '@spectrum-web-components/shared';
6✔
18

6✔
19
export class MobileController extends InteractionController {
6✔
20
    override type = InteractionTypes.mobile;
×
21

6✔
22
    handleClick(): void {
6✔
23
        if (this.host.disabled) {
×
24
            return;
×
25
        }
×
26
        if (this.preventNextToggle == 'no') {
×
27

×
28
            this.host.toggle();
×
29
        }
×
30
        this.preventNextToggle = 'no';
×
31
    }
×
32

6✔
33
    public override handlePointerdown(): void {
6✔
34
        this.preventNextToggle = this.open ? 'yes' : 'no';
×
35
        if (isWebKit()) {
×
36
            this.target.classList.add(SAFARI_FOCUS_RING_CLASS);
×
37
        }
×
38
    }
×
39

6✔
40
    private handleFocusOut(): void {
6✔
41
        if (this.host.open) {
×
42
            return;
×
43
        }
×
44
        if (
×
45
            isWebKit() &&
×
46
            this.target.classList.contains(SAFARI_FOCUS_RING_CLASS)
×
47
        ) {
×
48
            this.target.classList.remove(SAFARI_FOCUS_RING_CLASS);
×
49
        }
×
50
    }
×
51

6✔
52
    override init(): void {
6✔
53
        // Clean up listeners if they've already been bound
×
54
        this.abortController?.abort();
×
55
        this.abortController = new AbortController();
×
56
        const { signal } = this.abortController;
×
57
        this.target.addEventListener('click', () => this.handleClick(), {
×
58
            signal,
×
59
        });
×
60
        this.target.addEventListener(
×
61
            'pointerdown',
×
62
            () => this.handlePointerdown(),
×
63
            { signal }
×
64
        );
×
65
        this.target.addEventListener('focusout', () => this.handleFocusOut(), {
×
66
            signal,
×
67
        });
×
68
    }
×
69
}
6✔
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