Skip to content

Commit ed2e259

Browse files
committed
feedback
1 parent e39b959 commit ed2e259

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

packages/driver/src/cy/aliases.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export const create = (cy) => ({
7575
}
7676

7777
if (reserved.includes(alias)) {
78-
return $errUtils.throwErrByPath('as.reserved_word', { args: { alias } })
78+
$errUtils.throwErrByPath('as.reserved_word', { args: { alias } })
7979
}
8080

8181
return null
@@ -105,7 +105,7 @@ export const create = (cy) => ({
105105
? 'alias.not_registered_with_available'
106106
: 'alias.not_registered_without_available'
107107

108-
return $errUtils.throwErrByPath(errPath, {
108+
$errUtils.throwErrByPath(errPath, {
109109
onFail: log,
110110
args: { cmd, displayName, availableAliases: availableAliases.join(', ') },
111111
})

packages/driver/src/cy/ensures.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ const VALID_POSITIONS = 'topLeft top topRight left center right bottomLeft botto
1212
// they may need to work with both element arrays, or specific items
1313
// such as a single element, a single document, or single window
1414

15-
let returnFalse = () => {
16-
return false
17-
}
18-
1915
export const create = (state, expect) => {
2016
// TODO: we should probably normalize all subjects
2117
// into an array and loop through each and verify
@@ -156,9 +152,9 @@ export const create = (state, expect) => {
156152
}
157153

158154
const runVisibilityCheck = (subject, onFail, method) => {
159-
if (subject.length !== subject.filter(function () {
160-
return !method(this, 'isVisible()', { checkOpacity: false })
161-
}).length) {
155+
const visibleSubjects = subject.filter(() => !method(this, 'isVisible()', { checkOpacity: false }))
156+
157+
if (subject.length !== visibleSubjects.length) {
162158
const cmd = state('current').get('name')
163159
const reason = $dom.getReasonIsHidden(subject, { checkOpacity: false })
164160
const node = $dom.stringify(subject)
@@ -244,7 +240,7 @@ export const create = (state, expect) => {
244240
}
245241

246242
const ensureExistence = (subject) => {
247-
returnFalse = () => {
243+
const returnFalse = () => {
248244
cleanup()
249245

250246
return false

packages/driver/src/cy/mouse.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -707,8 +707,6 @@ export const create = (state, keyboard, focused, Cypress) => {
707707
return mouse
708708
}
709709

710-
export interface Mouse extends ReturnType<typeof create> {}
711-
712710
const { stopPropagation } = window.MouseEvent.prototype
713711

714712
const sendEvent = (evtName, el, evtOptions, bubbles = false, cancelable = false, Constructor, composed = false) => {
@@ -760,3 +758,5 @@ const toCoordsEventOptions = (x, y, win) => {
760758
layerY: x + scrollY,
761759
}
762760
}
761+
762+
export interface Mouse extends ReturnType<typeof create> {}

0 commit comments

Comments
 (0)