Skip to content

Commit

Permalink
Merge branch 'master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed Sep 1, 2019
2 parents 702dd43 + 0661508 commit a093b23
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/compiler/ast/doc/JSDoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class JSDoc extends JSDocBase<ts.JSDoc> {

return innerTextWithStars.split(/\n/).map(line => {
const starPos = line.indexOf("*");
if (starPos === -1)
if (starPos === -1 || line.substring(0, starPos).trim() !== "")
return line;
const substringStart = line[starPos + 1] === " " ? starPos + 2 : starPos + 1;
return line.substring(substringStart);
Expand Down
5 changes: 5 additions & 0 deletions src/tests/compiler/ast/doc/jsDocTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ describe(nameof(JSDoc), () => {
it("should return the correct inner text when using slash r slash n", () => {
doTest("/**\r\n * Description\r\n * @param - Test\r\n */function identifier() {}", "Description\r\n@param - Test");
});

it("should not modify content's stars", () => {
doTest("/** Performs `counter *= 2`.*/function identifier() {}", "Performs `counter *= 2`.");
doTest("/**\nPerforms `counter *= 2`.\n*/function identifier() {}", "Performs `counter *= 2`.");
});
});

describe(nameof<JSDoc>(n => n.set), () => {
Expand Down

0 comments on commit a093b23

Please sign in to comment.