Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(enterKeyHint): remove check on only Chrome browser #933

Merged
merged 2 commits into from
Apr 5, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,20 @@ describe('isChrome', () => {
});

describe('Samsung Browser', () => {
test('returns false with a Samsung Galaxy S10 (mobile) user agent', () => {
test('returns true with a Samsung Galaxy S10 (mobile) user agent', () => {
expect(
isChrome(
'Mozilla/5.0 (Linux; Android 9; SAMSUNG SM-G977N Build/PPR1.180610.011) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/9.2 Chrome/67.0.3396.87 Mobile Safari/537.36'
)
).toEqual(false);
).toEqual(true);
});

test('returns false with a Samsung Galaxy Tab A (tablet) user agent', () => {
test('returns true with a Samsung Galaxy Tab A (tablet) user agent', () => {
expect(
isChrome(
'Mozilla/5.0 (Linux; Android 5.0.2; SAMSUNG SM-T550 Build/LRX22G) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/3.3 Chrome/38.0.2125.102 Safari/537.36'
)
).toEqual(false);
).toEqual(true);
});
});
});
Expand Down
2 changes: 0 additions & 2 deletions packages/autocomplete-core/src/utils/isChrome.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
const chromeRegex = /(crmo|crios|chrome)/i;
const edgeRegex = /edg(e|ios|a)?/i;
const samsungBrowserRegex = /samsungbrowser/i;
const chromiumRegex = /chromium/i;

export function isChrome(userAgent: string) {
return Boolean(
userAgent &&
userAgent.match(chromeRegex) &&
!userAgent.match(edgeRegex) &&
!userAgent.match(samsungBrowserRegex) &&
FabienMotte marked this conversation as resolved.
Show resolved Hide resolved
!userAgent.match(chromiumRegex)
);
}