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

adobe / spectrum-web-components / 12802187570

16 Jan 2025 04:36AM UTC coverage: 98.206% (-0.003%) from 98.209%
12802187570

Pull #5019

github

web-flow
Merge 012b0d7d4 into cee6892e5
Pull Request #5019: chore: fix update-spectrum-css script

5151 of 5424 branches covered (94.97%)

Branch coverage included in aggregate %.

33006 of 33430 relevant lines covered (98.73%)

380.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
/*
64✔
2
Copyright 2020 Adobe. All rights reserved.
64✔
3
This file is licensed to you under the Apache License, Version 2.0 (the "License");
64✔
4
you may not use this file except in compliance with the License. You may obtain a copy
64✔
5
of the License at http://www.apache.org/licenses/LICENSE-2.0
64✔
6

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

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

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

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

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

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

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

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

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

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

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

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

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