Skip to content

Commit f389033

Browse files
committed
replace unsafe use of in operator by Object.hasOwn
1 parent 7b8ba2c commit f389033

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

packages/atomic/src/components/commerce/atomic-commerce-search-box/atomic-commerce-search-box.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@ export class AtomicCommerceSearchBox
229229
return;
230230
}
231231
if (
232-
!('redirectTo' in this.searchBoxState) ||
233-
!('afterRedirection' in this.searchBox)
232+
!Object.hasOwn(this.searchBoxState, 'redirectTo') ||
233+
!Object.hasOwn(this.searchBox, 'afterRedirection')
234234
) {
235235
return;
236236
}
@@ -306,7 +306,7 @@ export class AtomicCommerceSearchBox
306306
private isStandaloneSearchBox(
307307
searchBox: SearchBox | StandaloneSearchBox
308308
): searchBox is StandaloneSearchBox {
309-
return 'updateRedirectUrl' in searchBox;
309+
return Object.hasOwn(searchBox, 'updateRedirectUrl');
310310
}
311311

312312
private updateBreakpoints = once(() => updateBreakpoints(this));

packages/atomic/src/components/search/atomic-search-box/atomic-search-box.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ export class AtomicSearchBox implements InitializableComponent<Bindings> {
215215
private isStandaloneSearchBox(
216216
searchBox: SearchBox | StandaloneSearchBox
217217
): searchBox is StandaloneSearchBox {
218-
return 'redirectTo' in searchBox;
218+
return Object.hasOwn(searchBox, 'redirectTo');
219219
}
220220

221221
public initialize() {
@@ -254,8 +254,8 @@ export class AtomicSearchBox implements InitializableComponent<Bindings> {
254254

255255
public componentWillUpdate() {
256256
if (
257-
!('redirectTo' in this.searchBoxState) ||
258-
!('afterRedirection' in this.searchBox)
257+
!Object.hasOwn(this.searchBoxState, 'redirectTo') ||
258+
!Object.hasOwn(this.searchBox, 'afterRedirection')
259259
) {
260260
return;
261261
}

packages/atomic/src/components/search/atomic-search-box/e2e/atomic-search-box.e2e.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import {expect, test} from './fixture';
22

33
test.describe('default', () => {
4-
test.beforeEach(async ({searchBox}) => {
4+
test.beforeEach(async ({searchBox, browser}) => {
5+
browser;
56
await searchBox.load({args: {suggestionTimeout: 5000}});
67
});
78

0 commit comments

Comments
 (0)