File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed
typescript/test/codeActions Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -278,6 +278,52 @@ describe('Add destructure', () => {
278278 } )
279279 } )
280280 } )
281+ describe . todo ( 'Vue support' , ( ) => {
282+ test ( 'Should handle props reactivity lose' , ( ) => {
283+ const initial = /* ts */ `
284+ const /*t*/props/*t*/ = defineProps({
285+ source: {
286+ type: Object,
287+ required: true,
288+ },
289+ });
290+ `
291+ const expected = /* ts */ `
292+ const { source } = toRefs(defineProps({
293+ source: {
294+ type: Object,
295+ required: true,
296+ },
297+ }));
298+ `
299+
300+ const { codeAction } = fourslashLikeTester ( initial , undefined , { dedent : true } )
301+
302+ codeAction ( 0 , {
303+ refactorName : 'Add Destruct' ,
304+ newContent : expected ,
305+ } )
306+ } )
307+ test ( 'Should handle `reactive` object reactivity lose' , ( ) => {
308+ const initial = /* ts */ `
309+ const /*t*/reactiveObject/*t*/ = reactive({
310+ source: 'str'
311+ });
312+ `
313+ const expected = /* ts */ `
314+ const { source } = toRefs(reactive({
315+ source: 'str'
316+ }));
317+ `
318+
319+ const { codeAction } = fourslashLikeTester ( initial , undefined , { dedent : true } )
320+
321+ codeAction ( 0 , {
322+ refactorName : 'Add Destruct' ,
323+ newContent : expected ,
324+ } )
325+ } )
326+ } )
281327
282328 describe ( 'Skip cases' , ( ) => {
283329 test ( 'Should skip if trying to destruct expression of call expression' , ( ) => {
You can’t perform that action at this time.
0 commit comments