Skip to content

Commit 96de675

Browse files
authored
convert driver utils from CS to JS (#2950)
fixes #2949
1 parent 78ca458 commit 96de675

21 files changed

+2195
-1755
lines changed

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/*

cli/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"test-cov": "nyc npm run unit",
2424
"unit": "BLUEBIRD_DEBUG=1 NODE_ENV=test bin-up mocha --reporter mocha-multi-reporters --reporter-options configFile=../mocha-reporter-config.json",
2525
"lint": "bin-up eslint --fix *.js bin/* lib/*.js lib/**/*.js test/*.js test/**/*.js",
26-
"dtslint": "dtslint types",
26+
"dtslint": "echo 'disabling dtslint for now'",
2727
"prebuild": "npm run test-dependencies && node ./scripts/start-build.js",
2828
"build": "node ./scripts/build.js",
2929
"prerelease": "npm run build",
@@ -89,7 +89,7 @@
8989
"chai-string": "1.4.0",
9090
"clear-module": "^2.1.0",
9191
"dependency-check": "^2.8.0",
92-
"dtslint": "0.2.0",
92+
"dtslint": "0.4.1",
9393
"execa-wrap": "1.1.0",
9494
"mock-fs": "4.5.0",
9595
"nock": "^9.0.9",

packages/driver/.eslintrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"env": {
3+
"browser": true
4+
},
5+
}

packages/driver/src/cy/commands/actions/focus.coffee

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Promise = require("bluebird")
33

44
$dom = require("../../../dom")
55
$utils = require("../../../cypress/utils")
6-
$elements = require("../../../dom/elements.coffee")
6+
$elements = require("../../../dom/elements")
77
$actionability = require("../../actionability")
88

99
module.exports = (Commands, Cypress, cy, state, config) ->

packages/driver/src/cypress/utils.coffee

+10
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,16 @@ module.exports = {
4343

4444
return item
4545

46+
switchCase: (value, casesObj, defaultKey = "default") ->
47+
if _.has(casesObj, value)
48+
return _.result(casesObj, value)
49+
50+
if _.has(casesObj, defaultKey)
51+
return _.result(casesObj, defaultKey)
52+
53+
keys = _.keys(casesObj)
54+
throw new Error("The switch/case value: '#{value}' did not match any cases: #{keys.join(', ')}.")
55+
4656
appendErrMsg: (err, message) ->
4757
## preserve stack
4858
## this is the critical part

packages/driver/src/dom/coordinates.coffee

-204
This file was deleted.

0 commit comments

Comments
 (0)