Skip to content

setValue triggering "ReferenceError: $set is not defined" #1253

Closed
@wspringer

Description

@wspringer

Version

1.0.0-beta.29

Reproduction link

https://circleci.com/gh/wspringer/vue-autoextra/4

Steps to reproduce

Note that even though the test claim to be succesful, they are not.

My component is using scoped slots. If I'm setting a value on an input that has an associated model, then the first bit of setValue — setting the element's value — is okay, but when the 'input' trigger is fired, it produces this error:

console.error node_modules/vue/dist/vue.runtime.common.dev.js:621
    [Vue warn]: Error in v-on handler: "ReferenceError: $set is not defined"

    (found in <Root>)

  console.error node_modules/vue/dist/vue.runtime.common.dev.js:1884
    ReferenceError: $set is not defined
        at input (eval at createFunction (/Users/wilfred/workspace/vue-autoextra/node_modules/vue-template-compiler/build.js:4623:12), <anonymous>:3:288)
        at invokeWithErrorHandling (/Users/wilfred/workspace/vue-autoextra/node_modules/vue/dist/vue.runtime.common.dev.js:1850:26)
        at HTMLInputElement.invoker (/Users/wilfred/workspace/vue-autoextra/node_modules/vue/dist/vue.runtime.common.dev.js:2175:14)
        at HTMLInputElement.original._wrapper (/Users/wilfred/workspace/vue-autoextra/node_modules/vue/dist/vue.runtime.common.dev.js:6889:25)
        at invokeEventListeners (/Users/wilfred/workspace/vue-autoextra/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:193:27)
        at HTMLInputElementImpl._dispatch (/Users/wilfred/workspace/vue-autoextra/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:119:9)
        at HTMLInputElementImpl.dispatchEvent (/Users/wilfred/workspace/vue-autoextra/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:82:17)
        at HTMLInputElementImpl.dispatchEvent (/Users/wilfred/workspace/vue-autoextra/node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js:30:27)
        at HTMLInputElement.dispatchEvent (/Users/wilfred/workspace/vue-autoextra/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:157:21)
        at Wrapper.trigger (/Users/wilfred/workspace/vue-autoextra/node_modules/@vue/test-utils/dist/vue-test-utils.js:3759:16)
        at Wrapper.setValue (/Users/wilfred/workspace/vue-autoextra/node_modules/@vue/test-utils/dist/vue-test-utils.js:3722:10)
        at VueComponent.<anonymous> (/Users/wilfred/workspace/vue-autoextra/src/component.test.js:38:18)
        at Array.<anonymous> (/Users/wilfred/workspace/vue-autoextra/node_modules/vue/dist/vue.runtime.common.dev.js:1976:12)
        at flushCallbacks (/Users/wilfred/workspace/vue-autoextra/node_modules/vue/dist/vue.runtime.common.dev.js:1902:14)
        at process._tickCallback (internal/process/next_tick.js:68:7)

What is expected?

I'm expecting to be able to call setValue without a problem.

What is actually happening?

The trigger is not firing, causing the model to not be updated.


The test is here: https://github.com/wspringer/vue-autoextra/blob/master/src/component.test.js
The component getting tested is here: https://github.com/wspringer/vue-autoextra/blob/master/src/component.js
The expected behavior is demonstrated here: https://medium.com/east-pole/from-angular-to-vue-fb22c7ffab21

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions