diff --git a/tests/cases/fourslash/formatNamedExportImport.ts b/tests/cases/fourslash/formatNamedExportImport.ts index 29e58160cc1..2e22c54ae3b 100644 --- a/tests/cases/fourslash/formatNamedExportImport.ts +++ b/tests/cases/fourslash/formatNamedExportImport.ts @@ -1,28 +1,71 @@ /// -////var x = `sadasdasdasdasfegsfd -/////*1*/rasdesgeryt35t35y35 e4 ergt er 35t 3535 `; -////var y = `1${2}/*2*/3`; -////let z= `foo`/*3*/ -////let w= `bar${3}`/*4*/ -////String.raw -//// `template`/*5*/ +/////*selectionStart*/ +////export { x, y as yy, z } from "foo"/*export1*/ +////export{x, y as yy, z}from"bar"/*export2*/ +//// +////export +/////*exportOpenBrace*/{x,/*exportSpecifier1*/ +////y as yy, z/*exportSpecifier2*/ }/*exportCloseBrace*/ +//// from/*fromKeywordAutoformat*/ +/////*fromKeywordIndent*/ +////"foo"/*exportDir*/ +//// +////import {x, y as yy, z}from "baz"/*import1*/ +//// +////import/*importOpenBrace*/{x,/*importSpecifier1*/ +////y +////as yy,/*importSpecifier2*/ +////z}/*importCloseBrace*/ +////from "wow"/*importDir*/ +/////*selectionEnd*/ +//// +////export/*formatOnEnter*/{/*formatOnEnterOpenBrace*/ +/////*differentLineIndent*/x/*differentLineAutoformat*/ +////} from "abc" -goTo.marker("1"); -edit.insert("\r\n"); // edit will trigger formatting - should succeeed +format.selection("selectionStart", "selectionEnd"); -goTo.marker("2"); -edit.insert("\r\n"); -verify.indentationIs(0); -verify.currentLineContentIs("3`;") +goTo.marker("export1"); +verify.currentLineContentIs('export { x, y as yy, z } from "foo"'); +goTo.marker("export2"); +verify.currentLineContentIs('export { x, y as yy, z } from "bar"'); -goTo.marker("3"); -edit.insert(";"); -verify.currentLineContentIs("let z = `foo`;"); -goTo.marker("4"); -edit.insert(";"); -verify.currentLineContentIs("let w = `bar${3}`;"); +goTo.marker("exportOpenBrace"); +verify.currentLineContentIs("export {"); +goTo.marker("exportSpecifier1"); +verify.currentLineContentIs(" x,"); +goTo.marker("exportSpecifier2"); +verify.currentLineContentIs(" y as yy, z"); +goTo.marker("exportCloseBrace"); +verify.currentLineContentIs("}"); +goTo.marker("fromKeywordAutoformat"); +verify.currentLineContentIs("from"); +goTo.marker("fromKeywordIndent"); +verify.indentationIs(4); +goTo.marker("exportDir"); +verify.currentLineContentIs(' "foo"'); -goTo.marker("5"); -edit.insert(";"); -verify.currentLineContentIs(" `template`;"); \ No newline at end of file +goTo.marker("import1"); +verify.currentLineContentIs('import { x, y as yy, z } from "baz"'); + +goTo.marker("importOpenBrace"); +verify.currentLineContentIs("import {"); +goTo.marker("importSpecifier1"); +verify.currentLineContentIs(" x,"); +goTo.marker("importSpecifier2"); +verify.currentLineContentIs(" as yy,"); +goTo.marker("importCloseBrace"); +verify.currentLineContentIs("}"); +goTo.marker("importDir"); +verify.currentLineContentIs('from "wow"'); + +goTo.marker("formatOnEnter"); +edit.insertLine(''); +goTo.marker("formatOnEnterOpenBrace"); +verify.currentLineContentIs("{"); +goTo.marker("differentLineIndent"); +verify.indentationIs(4); +edit.insertLine(''); +goTo.marker("differentLineAutoformat"); +verify.currentLineContentIs(" x"); \ No newline at end of file