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

adobe / spectrum-web-components / 15073691922

16 May 2025 05:07PM CUT coverage: 97.992%. First build
15073691922

Pull #5222

github

web-flow
Merge a1497f9a8 into 737ce2c7b
Pull Request #5222: chore: migrate workflows from circleci to github actions [SWC-767]

5264 of 5570 branches covered (94.51%)

Branch coverage included in aggregate %.

33627 of 34118 relevant lines covered (98.56%)

650.91 hits per line

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

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

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

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

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

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

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

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

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