Skip to content

Commit 1c0798c

Browse files
authoredFeb 10, 2025··
fix: redundant popup log (#4830)
1 parent 2d902fd commit 1c0798c

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed
 

Diff for: ‎lib/helper/extras/Popup.js

+22-22
Original file line numberDiff line numberDiff line change
@@ -2,66 +2,66 @@
22
* Class to handle the interaction with the Dialog (Popup) Class from Puppeteer
33
*/
44
class Popup {
5-
constructor(popup, defaultAction) {
6-
this._popup = popup || null;
7-
this._actionType = '';
8-
this._defaultAction = defaultAction || '';
5+
constructor(popup = null, defaultAction = '') {
6+
this._popup = popup
7+
this._actionType = ''
8+
this._defaultAction = defaultAction
99
}
1010

1111
_assertValidActionType(action) {
1212
if (['accept', 'cancel'].indexOf(action) === -1) {
13-
throw new Error('Invalid Popup action type. Only "accept" or "cancel" actions are accepted');
13+
throw new Error('Invalid Popup action type. Only "accept" or "cancel" actions are accepted')
1414
}
1515
}
1616

1717
set defaultAction(action) {
18-
this._assertValidActionType(action);
19-
this._defaultAction = action;
18+
this._assertValidActionType(action)
19+
this._defaultAction = action
2020
}
2121

2222
get defaultAction() {
23-
return this._defaultAction;
23+
return this._defaultAction
2424
}
2525

2626
get popup() {
27-
return this._popup;
27+
return this._popup
2828
}
2929

3030
set popup(popup) {
3131
if (this._popup) {
32-
console.error('Popup already exists and was not closed. Popups must always be closed by calling either I.acceptPopup() or I.cancelPopup()');
32+
return
3333
}
34-
this._popup = popup;
34+
this._popup = popup
3535
}
3636

3737
get actionType() {
38-
return this._actionType;
38+
return this._actionType
3939
}
4040

4141
set actionType(action) {
42-
this._assertValidActionType(action);
43-
this._actionType = action;
42+
this._assertValidActionType(action)
43+
this._actionType = action
4444
}
4545

4646
clear() {
47-
this._popup = null;
48-
this._actionType = '';
47+
this._popup = null
48+
this._actionType = ''
4949
}
5050

5151
assertPopupVisible() {
5252
if (!this._popup) {
53-
throw new Error('There is no Popup visible');
53+
throw new Error('There is no Popup visible')
5454
}
5555
}
5656

5757
assertPopupActionType(type) {
58-
this.assertPopupVisible();
59-
const expectedAction = this._actionType || this._defaultAction;
58+
this.assertPopupVisible()
59+
const expectedAction = this._actionType || this._defaultAction
6060
if (expectedAction !== type) {
61-
throw new Error(`Popup action does not fit the expected action type. Expected popup action to be '${expectedAction}' not '${type}`);
61+
throw new Error(`Popup action does not fit the expected action type. Expected popup action to be '${expectedAction}' not '${type}`)
6262
}
63-
this.clear();
63+
this.clear()
6464
}
6565
}
6666

67-
module.exports = Popup;
67+
module.exports = Popup

0 commit comments

Comments
 (0)
Please sign in to comment.