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

adobe / spectrum-web-components / 14064809354

25 Mar 2025 04:19PM CUT coverage: 97.98% (-0.003%) from 97.983%
14064809354

Pull #5245

github

web-flow
Merge 712028514 into 0988e197c
Pull Request #5245: docs(field-group): updated docs with accessiblity information

5310 of 5616 branches covered (94.55%)

Branch coverage included in aggregate %.

33686 of 34184 relevant lines covered (98.54%)

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

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

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

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