mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
adding JSX closing tag/attribute/expression test
This commit is contained in:
@@ -429,6 +429,8 @@ namespace ts.formatting {
|
||||
case SyntaxKind.ArrayBindingPattern:
|
||||
case SyntaxKind.ObjectBindingPattern:
|
||||
case SyntaxKind.JsxElement:
|
||||
case SyntaxKind.JsxOpeningElement:
|
||||
case SyntaxKind.JsxExpression:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
//// <div className="commentBox" >
|
||||
////Hello, World!/*autoformat*/
|
||||
/////*indent*/
|
||||
//// </div>
|
||||
//// </div>/*closingTagAutoformat*/
|
||||
//// )
|
||||
////}
|
||||
////
|
||||
@@ -14,20 +14,49 @@
|
||||
//// return <div
|
||||
////className=""/*attrAutoformat*/
|
||||
/////*attrIndent*/
|
||||
//// >/*danglingBraketAutoformat*/
|
||||
////id={
|
||||
////"abc" + "cde"/*expressionAutoformat*/
|
||||
/////*expressionIndent*/
|
||||
////}
|
||||
//// >/*danglingBracketAutoformat*/
|
||||
//// </div>
|
||||
////}
|
||||
|
||||
////
|
||||
////let h5 = <h5>
|
||||
////<span>/*childJsxElementAutoformat*/
|
||||
/////*childJsxElementIndent*/
|
||||
////<span></span>/*grandchildJsxElementAutoformat*/
|
||||
////</span>/*containedClosingTagAutoformat*/
|
||||
////</h5>
|
||||
|
||||
format.document();
|
||||
goTo.marker("autoformat");
|
||||
verify.currentLineContentIs(' Hello, World!');
|
||||
goTo.marker("indent");
|
||||
verify.indentationIs(12);
|
||||
goTo.marker("closingTagAutoformat");
|
||||
verify.currentLineContentIs(" </div>");
|
||||
|
||||
goTo.marker("attrAutoformat");
|
||||
verify.currentLineContentIs(' className="">');
|
||||
verify.currentLineContentIs(' className=""');
|
||||
goTo.marker("attrIndent");
|
||||
verify.indentationIs(8);
|
||||
goTo.marker("expressionAutoformat");
|
||||
verify.currentLineContentIs(' "abc" + "cde"');
|
||||
goTo.marker("expressionIndent");
|
||||
verify.indentationIs(12);
|
||||
|
||||
|
||||
goTo.marker("danglingBracketAutoformat")
|
||||
verify.currentLineContentIs(" >");
|
||||
// TODO: verify.currentLineContentIs(" >");
|
||||
verify.currentLineContentIs(" >");
|
||||
|
||||
|
||||
goTo.marker("childJsxElementAutoformat");
|
||||
verify.currentLineContentIs(" <span>");
|
||||
goTo.marker("childJsxElementIndent");
|
||||
verify.indentationIs(8);
|
||||
goTo.marker("grandchildJsxElementAutoformat");
|
||||
verify.currentLineContentIs(" <span></span>");
|
||||
goTo.marker("containedClosingTagAutoformat");
|
||||
verify.currentLineContentIs(" </span>");
|
||||
Reference in New Issue
Block a user