Skip to content

Commit 6cadc25

Browse files
yyx990803lovelope
authored andcommitted
revert: revert prop object validation
close vuejs#7279
1 parent 0efcedd commit 6cadc25

File tree

2 files changed

+0
-40
lines changed

2 files changed

+0
-40
lines changed

src/core/util/options.js

-23
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,6 @@ function normalizeProps (options: Object, vm: ?Component) {
292292
for (const key in props) {
293293
val = props[key]
294294
name = camelize(key)
295-
if (process.env.NODE_ENV !== 'production' && isPlainObject(val)) {
296-
validatePropObject(name, val, vm)
297-
}
298295
res[name] = isPlainObject(val)
299296
? val
300297
: { type: val }
@@ -309,26 +306,6 @@ function normalizeProps (options: Object, vm: ?Component) {
309306
options.props = res
310307
}
311308

312-
/**
313-
* Validate whether a prop object keys are valid.
314-
*/
315-
const propOptionsRE = /^(type|default|required|validator)$/
316-
317-
function validatePropObject (
318-
propName: string,
319-
prop: Object,
320-
vm: ?Component
321-
) {
322-
for (const key in prop) {
323-
if (!propOptionsRE.test(key)) {
324-
warn(
325-
`Invalid key "${key}" in validation rules object for prop "${propName}".`,
326-
vm
327-
)
328-
}
329-
}
330-
}
331-
332309
/**
333310
* Normalize all injections into Object-based format
334311
*/

test/unit/features/options/props.spec.js

-17
Original file line numberDiff line numberDiff line change
@@ -513,23 +513,6 @@ describe('Options props', () => {
513513
})
514514
})
515515

516-
it('should warn about misspelled keys in prop validation object', () => {
517-
new Vue({
518-
template: '<test></test>',
519-
components: {
520-
test: {
521-
template: '<div></div>',
522-
props: {
523-
value: { reqquired: true },
524-
count: { deafult: 1 }
525-
}
526-
}
527-
}
528-
}).$mount()
529-
expect(`Invalid key "reqquired" in validation rules object for prop "value".`).toHaveBeenWarned()
530-
expect(`Invalid key "deafult" in validation rules object for prop "count".`).toHaveBeenWarned()
531-
})
532-
533516
it('should not trigger re-render on non-changed inline literals', done => {
534517
const updated = jasmine.createSpy('updated')
535518
const vm = new Vue({

0 commit comments

Comments
 (0)