diff --git a/packages/runtime-vapor/__tests__/componentEmits.spec.ts b/packages/runtime-vapor/__tests__/componentEmits.spec.ts index 7c3bfe69ed4..8c8a56085ba 100644 --- a/packages/runtime-vapor/__tests__/componentEmits.spec.ts +++ b/packages/runtime-vapor/__tests__/componentEmits.spec.ts @@ -195,8 +195,17 @@ describe('component: emit', () => { ).not.toHaveBeenWarned() }) - test.todo('validator warning', () => { - // TODO: warning validator + test('validator warning', () => { + define({ + emits: { + foo: (arg: number) => arg > 0, + }, + setup(_, { emit }) { + emit('foo', -1) + return [] + }, + }).render() + expect(`event validation failed for event "foo"`).toHaveBeenWarned() }) test('.once', () => { @@ -415,8 +424,4 @@ describe('component: emit', () => { await nextTick() expect(fn).not.toHaveBeenCalled() }) - - // NOTE: not supported mixins - // test.todo('merge string array emits', async () => {}) - // test.todo('merge object emits', async () => {}) }) diff --git a/packages/runtime-vapor/src/componentEmits.ts b/packages/runtime-vapor/src/componentEmits.ts index f26c6813505..60007037ef3 100644 --- a/packages/runtime-vapor/src/componentEmits.ts +++ b/packages/runtime-vapor/src/componentEmits.ts @@ -18,7 +18,7 @@ export function normalizeEmitsOptions( let normalized: ObjectEmitsOptions if (isArray(raw)) { normalized = {} - for (const key in raw) normalized[key] = null + for (const key of raw) normalized[key] = null } else { normalized = raw }