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

adobe / spectrum-web-components / 13322647394

14 Feb 2025 04:40AM UTC coverage: 98.189%. First build
13322647394

Pull #5082

github

web-flow
Merge 88793c34c into ff7318295
Pull Request #5082: fix(menu): make submenu scrollable

5187 of 5464 branches covered (94.93%)

Branch coverage included in aggregate %.

33099 of 33528 relevant lines covered (98.72%)

386.54 hits per line

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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