@@ -95,6 +95,60 @@ describe('compiler: element transform', () => {
95
95
expect ( node . tag ) . toBe ( `$setup["Example"]` )
96
96
} )
97
97
98
+ test ( 'resolve component from setup bindings (inline)' , ( ) => {
99
+ const { root, node } = parseWithElementTransform ( `<Example/>` , {
100
+ inline : true ,
101
+ bindingMetadata : {
102
+ Example : BindingTypes . SETUP_MAYBE_REF
103
+ }
104
+ } )
105
+ expect ( root . helpers ) . not . toContain ( RESOLVE_COMPONENT )
106
+ expect ( node . tag ) . toBe ( `_unref(Example)` )
107
+ } )
108
+
109
+ test ( 'resolve component from setup bindings (inline const)' , ( ) => {
110
+ const { root, node } = parseWithElementTransform ( `<Example/>` , {
111
+ inline : true ,
112
+ bindingMetadata : {
113
+ Example : BindingTypes . SETUP_CONST
114
+ }
115
+ } )
116
+ expect ( root . helpers ) . not . toContain ( RESOLVE_COMPONENT )
117
+ expect ( node . tag ) . toBe ( `Example` )
118
+ } )
119
+
120
+ test ( 'resolve namespaced component from setup bindings' , ( ) => {
121
+ const { root, node } = parseWithElementTransform ( `<Foo.Example/>` , {
122
+ bindingMetadata : {
123
+ Foo : BindingTypes . SETUP_MAYBE_REF
124
+ }
125
+ } )
126
+ expect ( root . helpers ) . not . toContain ( RESOLVE_COMPONENT )
127
+ expect ( node . tag ) . toBe ( `$setup["Foo"].Example` )
128
+ } )
129
+
130
+ test ( 'resolve namespaced component from setup bindings (inline)' , ( ) => {
131
+ const { root, node } = parseWithElementTransform ( `<Foo.Example/>` , {
132
+ inline : true ,
133
+ bindingMetadata : {
134
+ Foo : BindingTypes . SETUP_MAYBE_REF
135
+ }
136
+ } )
137
+ expect ( root . helpers ) . not . toContain ( RESOLVE_COMPONENT )
138
+ expect ( node . tag ) . toBe ( `_unref(Foo).Example` )
139
+ } )
140
+
141
+ test ( 'resolve namespaced component from setup bindings (inline const)' , ( ) => {
142
+ const { root, node } = parseWithElementTransform ( `<Foo.Example/>` , {
143
+ inline : true ,
144
+ bindingMetadata : {
145
+ Foo : BindingTypes . SETUP_CONST
146
+ }
147
+ } )
148
+ expect ( root . helpers ) . not . toContain ( RESOLVE_COMPONENT )
149
+ expect ( node . tag ) . toBe ( `Foo.Example` )
150
+ } )
151
+
98
152
test ( 'do not resolve component from non-script-setup bindings' , ( ) => {
99
153
const bindingMetadata = {
100
154
Example : BindingTypes . SETUP_MAYBE_REF
0 commit comments