From 9fa112ee343c5d4793c5c1bd7db5c78028774bc7 Mon Sep 17 00:00:00 2001 From: BigAru Date: Wed, 27 Mar 2019 14:46:28 +0100 Subject: [PATCH] test also the output from visibility tests --- ...onvertStringOrTemplateLiteral_ToStringAvailability.ts | 9 +++++++++ ...vertStringOrTemplateLiteral_ToTemplateAvailability.ts | 9 +++++++++ ...mplateLiteral_ToTemplateAvailabilityPrecedingMinus.ts | 8 ++++++++ ...TemplateLiteral_ToTemplateAvailabilityReassignment.ts | 8 ++++++++ 4 files changed, 34 insertions(+) diff --git a/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToStringAvailability.ts b/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToStringAvailability.ts index 0727209c02c..84db4c09f04 100644 --- a/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToStringAvailability.ts +++ b/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToStringAvailability.ts @@ -28,3 +28,12 @@ goTo.select("p", "o"); verify.refactorAvailable("Convert string concatenation or template literal", "Convert to string concatenation"); verify.not.refactorAvailable("Convert string concatenation or template literal", "Convert to template literal"); +edit.applyRefactor({ + refactorName: "Convert string concatenation or template literal", + actionName: "Convert to string concatenation", + actionDescription: "Convert to string concatenation", + newContent: +`const age = 22 +const name = "Eddy" +const foo = "Mr " + name + " is " + (age + 34) + " years old"`, +}); diff --git a/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateAvailability.ts b/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateAvailability.ts index deabaa61a40..cc4d41d1905 100644 --- a/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateAvailability.ts +++ b/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateAvailability.ts @@ -28,3 +28,12 @@ goTo.select("p", "o"); verify.not.refactorAvailable("Convert string concatenation or template literal", "Convert to string concatenation"); verify.refactorAvailable("Convert string concatenation or template literal", "Convert to template literal"); +edit.applyRefactor({ + refactorName: "Convert string concatenation or template literal", + actionName: "Convert to template literal", + actionDescription: "Convert to template literal", + newContent: +`const age = 22 +const name = "Eddy" +const foo = \`Mr \${name} is \${age * 4 / 2} years old\``, +}); \ No newline at end of file diff --git a/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateAvailabilityPrecedingMinus.ts b/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateAvailabilityPrecedingMinus.ts index 128bc5ddc15..33597661616 100644 --- a/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateAvailabilityPrecedingMinus.ts +++ b/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateAvailabilityPrecedingMinus.ts @@ -23,3 +23,11 @@ goTo.select("r", "q"); verify.not.refactorAvailable("Convert string concatenation or template literal", "Convert to string concatenation"); verify.refactorAvailable("Convert string concatenation or template literal", "Convert to template literal"); +edit.applyRefactor({ + refactorName: "Convert string concatenation or template literal", + actionName: "Convert to template literal", + actionDescription: "Convert to template literal", + newContent: +`const age = 22 +const foo = \`\${age * 4 - 2 / 4} years old\``, +}); \ No newline at end of file diff --git a/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateAvailabilityReassignment.ts b/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateAvailabilityReassignment.ts index 3eca754b605..8f51e6c6832 100644 --- a/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateAvailabilityReassignment.ts +++ b/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateAvailabilityReassignment.ts @@ -15,3 +15,11 @@ goTo.select("v", "u"); verify.not.refactorAvailable("Convert string concatenation or template literal", "Convert to string concatenation"); verify.refactorAvailable("Convert string concatenation or template literal", "Convert to template literal"); +edit.applyRefactor({ + refactorName: "Convert string concatenation or template literal", + actionName: "Convert to template literal", + actionDescription: "Convert to template literal", + newContent: +`let foo = "" +foo = \`Mr Bar is\${42} years old\``, +}); \ No newline at end of file