getCurrentInstance,
h,
inject,
+ nextTick,
nodeOps,
provide,
ref,
render,
serializeInner,
+ toRaw,
toRefs,
watch,
} from '@vue/runtime-test'
-import { render as domRender, nextTick } from 'vue'
+import { render as domRender } from 'vue'
describe('component props', () => {
test('stateful', () => {
render(h(Comp, { foo: 1 }), root)
expect(props).toEqual({ foo: 1 })
expect(attrs).toEqual({ foo: 1 })
- expect(props).toBe(attrs)
+ expect(toRaw(props)).toBe(attrs)
render(h(Comp, { bar: 2 }), root)
expect(props).toEqual({ bar: 2 })
expect(attrs).toEqual({ bar: 2 })
- expect(props).toBe(attrs)
+ expect(toRaw(props)).toBe(attrs)
})
test('boolean casting', () => {
emit,
render,
renderCache,
+ props,
data,
setupState,
ctx,
inheritAttrs,
} = instance
- const props = __DEV__ ? shallowReadonly(instance.props) : instance.props
const prev = setCurrentRenderingInstance(instance)
let result
thisProxy,
proxyToUse!,
renderCache,
- props,
+ __DEV__ ? shallowReadonly(props) : props,
setupState,
data,
ctx,
result = normalizeVNode(
render.length > 1
? render(
- props,
+ __DEV__ ? shallowReadonly(props) : props,
__DEV__
? {
get attrs() {
}
: { attrs, slots, emit },
)
- : render(props, null as any /* we know it doesn't need it */),
+ : render(
+ __DEV__ ? shallowReadonly(props) : props,
+ null as any /* we know it doesn't need it */,
+ ),
)
fallthroughAttrs = Component.props
? attrs