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

adobe / spectrum-web-components / 13782907169

11 Mar 2025 07:50AM CUT 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

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 {
931✔
14
    return typeof window !== 'undefined' && window.navigator != null
931✔
15
        ? re.test(window.navigator.userAgent)
931!
16
        : false;
×
17
}
931✔
18

66✔
19
function testPlatform(re: RegExp): boolean {
2,851✔
20
    return typeof window !== 'undefined' && window.navigator != null
2,851✔
21
        ? re.test(window.navigator.platform)
2,851!
22
        : false;
×
23
}
2,851✔
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,189✔
32
}
1,189✔
33

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

66✔
42
export function isIOS(): boolean {
66✔
43
    return isIPhone() || isIPad();
830✔
44
}
830✔
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/);
551✔
71
}
551✔
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