Skip to content

Commit

Permalink
fix(angular): add missing parens for pipe in ternary (#5397)
Browse files Browse the repository at this point in the history
  • Loading branch information
ikatyang committed Nov 9, 2018
1 parent 9acb029 commit 423ddf9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/language-js/needs-parens.js
Expand Up @@ -513,6 +513,7 @@ function needsParens(path, options) {
case "SpreadProperty":
case "BinaryExpression":
case "LogicalExpression":
case "NGPipeExpression":
case "ExportDefaultDeclaration":
case "AwaitExpression":
case "JSXSpreadAttribute":
Expand Down
9 changes: 7 additions & 2 deletions tests/angular_interpolation/__snapshots__/jsfmt.spec.js.snap
Expand Up @@ -36,7 +36,8 @@ exports[`pipe-expression.ng - __ng_interpolation-verify 1`] = `
keyA: reallySuperLongValue,
keyB: shortValue | pipeB | pipeC: valueToPipeC
}
| aaa
| aaa,
(hideLinqPanel ? "ReportSelection.HideShowLabel_Show.String" : "ReportSelection.HideShowLabel_Hide.String") | localize:(localizationSection)
]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[
Expand All @@ -63,6 +64,10 @@ exports[`pipe-expression.ng - __ng_interpolation-verify 1`] = `
keyA: reallySuperLongValue,
keyB: shortValue | pipeB | pipeC: valueToPipeC
}
| aaa
| aaa,
(hideLinqPanel
? "ReportSelection.HideShowLabel_Show.String"
: "ReportSelection.HideShowLabel_Hide.String")
| localize: localizationSection
]
`;
3 changes: 2 additions & 1 deletion tests/angular_interpolation/pipe-expression.ng
Expand Up @@ -20,5 +20,6 @@
keyA: reallySuperLongValue,
keyB: shortValue | pipeB | pipeC: valueToPipeC
}
| aaa
| aaa,
(hideLinqPanel ? "ReportSelection.HideShowLabel_Show.String" : "ReportSelection.HideShowLabel_Hide.String") | localize:(localizationSection)
]

0 comments on commit 423ddf9

Please sign in to comment.