mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-08 07:50:24 -05:00
Remove override of lodash capitalize method (#7255)
This commit is contained in:
-4
@@ -6,7 +6,6 @@ import clean from 'underscore.string/clean'
|
||||
import count from 'underscore.string/count'
|
||||
import isBlank from 'underscore.string/isBlank'
|
||||
import toBoolean from 'underscore.string/toBoolean'
|
||||
import capitalize from 'underscore.string/capitalize'
|
||||
|
||||
const inflection = underscoreInflection(_)
|
||||
|
||||
@@ -16,7 +15,6 @@ _.mixin({
|
||||
count,
|
||||
isBlank,
|
||||
toBoolean,
|
||||
capitalize, // its mo' better the lodash version
|
||||
ordinalize: inflection.ordinalize,
|
||||
})
|
||||
|
||||
@@ -26,7 +24,6 @@ declare module 'lodash' {
|
||||
count(...args): LoDashExplicitWrapper<TValue>
|
||||
isBlank(...args): LoDashExplicitWrapper<TValue>
|
||||
toBoolean(...args): LoDashExplicitWrapper<TValue>
|
||||
capitalize(...args): LoDashExplicitWrapper<TValue>
|
||||
ordinalize(...args): LoDashExplicitWrapper<TValue>
|
||||
}
|
||||
|
||||
@@ -35,7 +32,6 @@ declare module 'lodash' {
|
||||
count(...args): LoDashExplicitWrapper<TValue>
|
||||
isBlank(...args): LoDashExplicitWrapper<TValue>
|
||||
toBoolean(...args): LoDashExplicitWrapper<TValue>
|
||||
capitalize(...args): LoDashExplicitWrapper<TValue>
|
||||
ordinalize(...args): LoDashExplicitWrapper<TValue>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ _.mixin({
|
||||
count: require('underscore.string/count'),
|
||||
isBlank: require('underscore.string/isBlank'),
|
||||
toBoolean: require('underscore.string/toBoolean'),
|
||||
capitalize: require('underscore.string/capitalize'), // its mo' better the lodash version
|
||||
ordinalize: inflection.ordinalize,
|
||||
})
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
_ = require("lodash")
|
||||
capitalize = require('underscore.string/capitalize')
|
||||
|
||||
divider = (num, char) ->
|
||||
Array(num).join(char)
|
||||
@@ -27,7 +28,7 @@ formatProp = (memo, field) ->
|
||||
{key, value} = field
|
||||
|
||||
if value?
|
||||
memo.push(_.capitalize(key) + ": " + format(value))
|
||||
memo.push(capitalize(key) + ": " + format(value))
|
||||
memo
|
||||
|
||||
cmd = (command, args = "") ->
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
_ = require("lodash")
|
||||
capitalize = require('underscore.string/capitalize')
|
||||
minimatch = require("minimatch")
|
||||
|
||||
$utils = require("./utils")
|
||||
@@ -16,7 +17,7 @@ setHeader = (xhr, key, val, transformer) ->
|
||||
if transformer
|
||||
val = transformer(val)
|
||||
|
||||
key = "X-Cypress-" + _.capitalize(key)
|
||||
key = "X-Cypress-" + capitalize(key)
|
||||
xhr.setRequestHeader(key, encodeURI(val))
|
||||
|
||||
normalize = (val) ->
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
$ = require("jquery")
|
||||
_ = require("lodash")
|
||||
capitalize = require('underscore.string/capitalize')
|
||||
methods = require("methods")
|
||||
moment = require("moment")
|
||||
|
||||
@@ -99,7 +100,7 @@ module.exports = {
|
||||
@normalizeObjWithLength(filter)
|
||||
|
||||
whereFilterHasSameKeyButDifferentValue = (value, key) ->
|
||||
upperKey = _.capitalize(key)
|
||||
upperKey = capitalize(key)
|
||||
|
||||
(_.has(filter, key) or _.has(filter, upperKey)) and
|
||||
filter[key] isnt value
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const { $, Promise } = Cypress
|
||||
const lodash = require('lodash')
|
||||
|
||||
describe('driver/src/cypress/index', () => {
|
||||
let CypressInstance
|
||||
@@ -37,6 +38,17 @@ describe('driver/src/cypress/index', () => {
|
||||
})
|
||||
})
|
||||
|
||||
context('_', () => {
|
||||
it('exposes lodash methods', () => {
|
||||
expect(Object.getOwnPropertyNames(Cypress._)).to.include.members(Object.getOwnPropertyNames(lodash))
|
||||
})
|
||||
|
||||
it('has same lodash capitalize method', () => {
|
||||
// https://github.com/cypress-io/cypress/issues/7222
|
||||
expect(Cypress._.capitalize('FOO BAR')).to.eq(lodash.capitalize('FOO BAR'))
|
||||
})
|
||||
})
|
||||
|
||||
context('#backend', () => {
|
||||
it('sets __stackCleaned__ on errors', function () {
|
||||
cy.stub(CypressInstance, 'emit')
|
||||
|
||||
Reference in New Issue
Block a user