Skip to content

Commit

Permalink
revert: revert prop object validation
Browse files Browse the repository at this point in the history
close #7279
  • Loading branch information
yyx990803 committed Dec 19, 2017
1 parent 2e0f6d5 commit 01c0750
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 40 deletions.
23 changes: 0 additions & 23 deletions src/core/util/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,6 @@ function normalizeProps (options: Object, vm: ?Component) {
for (const key in props) {
val = props[key]
name = camelize(key)
if (process.env.NODE_ENV !== 'production' && isPlainObject(val)) {
validatePropObject(name, val, vm)
}
res[name] = isPlainObject(val)
? val
: { type: val }
Expand All @@ -309,26 +306,6 @@ function normalizeProps (options: Object, vm: ?Component) {
options.props = res
}

/**
* Validate whether a prop object keys are valid.
*/
const propOptionsRE = /^(type|default|required|validator)$/

function validatePropObject (
propName: string,
prop: Object,
vm: ?Component
) {
for (const key in prop) {
if (!propOptionsRE.test(key)) {
warn(
`Invalid key "${key}" in validation rules object for prop "${propName}".`,
vm
)
}
}
}

/**
* Normalize all injections into Object-based format
*/
Expand Down
17 changes: 0 additions & 17 deletions test/unit/features/options/props.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -513,23 +513,6 @@ describe('Options props', () => {
})
})

it('should warn about misspelled keys in prop validation object', () => {
new Vue({
template: '<test></test>',
components: {
test: {
template: '<div></div>',
props: {
value: { reqquired: true },
count: { deafult: 1 }
}
}
}
}).$mount()
expect(`Invalid key "reqquired" in validation rules object for prop "value".`).toHaveBeenWarned()
expect(`Invalid key "deafult" in validation rules object for prop "count".`).toHaveBeenWarned()
})

it('should not trigger re-render on non-changed inline literals', done => {
const updated = jasmine.createSpy('updated')
const vm = new Vue({
Expand Down

0 comments on commit 01c0750

Please sign in to comment.