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

adobe / spectrum-web-components / 14134704076

28 Mar 2025 05:38PM CUT coverage: 98.002%. Remained the same
14134704076

Pull #5277

github

web-flow
Merge dc33d918c into 54e4c93de
Pull Request #5277: chore: update dependency @spectrum-css/breadcrumb to v10.0.1

5326 of 5622 branches covered (94.73%)

Branch coverage included in aggregate %.

33711 of 34211 relevant lines covered (98.54%)

646.51 hits per line

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

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

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

66✔
13
function testUserAgent(re: RegExp): boolean {
932✔
14
    return typeof window !== 'undefined' && window.navigator != null
932✔
15
        ? re.test(window.navigator.userAgent)
932!
16
        : false;
×
17
}
932✔
18

66✔
19
function testPlatform(re: RegExp): boolean {
2,855✔
20
    return typeof window !== 'undefined' && window.navigator != null
2,855✔
21
        ? re.test(window.navigator.platform)
2,855!
22
        : false;
×
23
}
2,855✔
24

66✔
25
/* c8 ignore next 3 */
66✔
26
export function isMac(): boolean {
66✔
27
    return testPlatform(/^Mac/);
66✔
28
}
66✔
29

66✔
30
export function isIPhone(): boolean {
66✔
31
    return testPlatform(/^iPhone/);
1,191✔
32
}
1,191✔
33

66✔
34
export function isIPad(): boolean {
66✔
35
    return (
831✔
36
        testPlatform(/^iPad/) ||
831✔
37
        // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
831✔
38
        (isMac() && navigator.maxTouchPoints > 1)
831!
39
    );
831✔
40
}
831✔
41

66✔
42
export function isIOS(): boolean {
66✔
43
    return isIPhone() || isIPad();
831✔
44
}
831✔
45

66✔
46
/* c8 ignore next 3 */
66✔
47
export function isAppleDevice(): boolean {
66✔
48
    return isMac() || isIOS();
66✔
49
}
66✔
50

66✔
51
/* c8 ignore next 3 */
66✔
52
export function isWebKit(): boolean {
66✔
53
    return testUserAgent(/AppleWebKit/) && !isChrome();
66✔
54
}
66✔
55

66✔
56
/* c8 ignore next 3 */
66✔
57
export function isChrome(): boolean {
66✔
58
    return testUserAgent(/Chrome/);
66✔
59
}
66✔
60

66✔
61
export function isFirefox(): boolean {
66✔
62
    return testUserAgent(/Firefox/) && !isSeamonkey();
8!
63
}
8✔
64

66✔
65
export function isSeamonkey(): boolean {
66✔
66
    return testUserAgent(/Seamonkey/);
×
67
}
×
68

66✔
69
export function isAndroid(): boolean {
66✔
70
    return testUserAgent(/Android/);
552✔
71
}
552✔
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