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

adobe / spectrum-web-components / 13501140479

24 Feb 2025 03:05PM UTC coverage: 98.178% (-0.001%) from 98.179%
13501140479

Pull #5116

github

web-flow
Merge d65f44047 into 9d740f0c8
Pull Request #5116: chore: updated lerna publish typo

5260 of 5539 branches covered (94.96%)

Branch coverage included in aggregate %.

33328 of 33765 relevant lines covered (98.71%)

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

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

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

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