adding JSX closing tag/attribute/expression test

This commit is contained in:
SaschaNaz
2015-08-22 03:39:15 +09:00
parent 2677b3fa26
commit eae30fd3de
2 changed files with 36 additions and 5 deletions
+2
View File
@@ -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;
+34 -5
View File
@@ -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>");