TypeScript/tests/cases/fourslash/formatTemplateLiteral.ts

40 lines
1.1 KiB
TypeScript
Raw Normal View History

/// <reference path="fourslash.ts"/>
////var x = `sadasdasdasdasfegsfd
/////*1*/rasdesgeryt35t35y35 e4 ergt er 35t 3535 `;
////var y = `1${2}/*2*/3`;
2015-10-05 00:02:22 +02:00
////
/////*formatStart*/
////let z= `foo`;/*3*/
////let w= `bar${3}`;/*4*/
2015-08-27 15:59:10 +02:00
////String.raw
2015-10-05 00:02:22 +02:00
//// `template`;/*5*/
////String.raw`foo`;/*6*/
////String.raw `bar${3}`;/*7*/
////`Write ${ JSON.stringify("") } and ${ (765) } and ${ 346 }`;/*spaceInside*/
/////*formatEnd*/
goTo.marker("1");
2018-01-12 02:43:27 +01:00
edit.insert("\n"); // edit will trigger formatting - should succeeed
goTo.marker("2");
2018-01-12 02:43:27 +01:00
edit.insert("\n");
verify.indentationIs(0);
2015-08-27 15:59:10 +02:00
verify.currentLineContentIs("3`;")
2015-10-05 00:02:22 +02:00
format.selection("formatStart", "formatEnd");
2015-08-27 15:59:10 +02:00
goTo.marker("3");
2015-08-28 16:13:15 +02:00
verify.currentLineContentIs("let z = `foo`;");
2015-08-27 15:59:10 +02:00
goTo.marker("4");
2015-08-28 16:13:15 +02:00
verify.currentLineContentIs("let w = `bar${3}`;");
2015-08-27 15:59:10 +02:00
goTo.marker("5");
2015-08-28 16:12:30 +02:00
verify.currentLineContentIs(" `template`;");
goTo.marker("6");
verify.currentLineContentIs("String.raw`foo`;");
2015-08-28 16:12:30 +02:00
goTo.marker("7");
verify.currentLineContentIs("String.raw`bar${3}`;");
2015-10-05 00:02:22 +02:00
goTo.marker("spaceInside");
verify.currentLineContentIs('`Write ${JSON.stringify("")} and ${(765)} and ${346}`;');