Skip to content

Commit

Permalink
chore(core): test template literal string default values
Browse files Browse the repository at this point in the history
  • Loading branch information
tgreyuk committed May 11, 2024
1 parent a9f83e4 commit f4f068b
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 10 deletions.
3 changes: 3 additions & 0 deletions devtools/packages/fixtures/typedoc.cjs
Expand Up @@ -12,4 +12,7 @@ module.exports = {
URL: 'https://developer.mozilla.org/en-US/docs/Web/API/URL',
},
},
navigation: {
includeGroups: true,
},
};
Expand Up @@ -2,7 +2,7 @@ import { escapeChars } from '../utils';

/**
* Wraps a string in backticks.
* If the input string iself contains a backtick, pipe, or backslash (which can result in unwanted side effects) the string is escaoed unstead.
* If the input string itself contains a backtick, pipe, or backslash (which can result in unwanted side effects) the string is escaped instead.
*/
export function backTicks(text: string) {
return /(`|\||\\)/g.test(text) ? escapeChars(text) : `\`${text}\``;
Expand Down
Expand Up @@ -88,7 +88,5 @@ export function someType(this: MarkdownThemeContext, model?: SomeType): string {
return backTicks('null');
}

return /\\/.test(model?.toString())
? model?.toString()
: backTicks(model?.toString());
return backTicks(model?.toString());
}
Expand Up @@ -7,6 +7,15 @@
*/
export const stringVariable = 'stringConstWithDefaultValue';

/**
* A template variable string
*/
export const templateVariableString = `
This is a template string
/* with a comment */
And a <tag></tag>
`;

/**
* Comments for typeOperatorVariable
*/
Expand Down
Expand Up @@ -2999,6 +2999,11 @@ exports[`Navigation should gets Navigation Json for single entry point: (Output
"kind": 32,
"path": "variables/stringVariable.md"
},
{
"title": "templateVariableString",
"kind": 32,
"path": "variables/templateVariableString.md"
},
{
"title": "typeOperatorVariable",
"kind": 32,
Expand Down
Expand Up @@ -17,7 +17,7 @@ Comments for symbol
## Source
[variables.ts:38](http://source-url)
[variables.ts:47](http://source-url)
"
`;

Expand All @@ -38,7 +38,7 @@ Comments variable with symbol
## Source
[variables.ts:38](http://source-url)
[variables.ts:47](http://source-url)
"
`;

Expand All @@ -51,7 +51,7 @@ Comments for typeOperatorVariable
## Source
[variables.ts:13](http://source-url)
[variables.ts:22](http://source-url)
"
`;

Expand All @@ -66,7 +66,7 @@ Comments for typeOperatorVariable
## Source
[variables.ts:13](http://source-url)
[variables.ts:22](http://source-url)
"
`;

Expand Down Expand Up @@ -175,7 +175,7 @@ Comments for objectLiteralVariable
## Source
[variables.ts:18](http://source-url)
[variables.ts:27](http://source-url)
"
`;

Expand All @@ -202,6 +202,6 @@ Comments for objectLiteralVariable
## Source
[variables.ts:18](http://source-url)
[variables.ts:27](http://source-url)
"
`;
Expand Up @@ -569,6 +569,7 @@ exports[`Urls should gets Urls for single entry points: outputFileStrategy: memb
"variables/objectWithSymbol.md",
"variables/someQuery.md",
"variables/stringVariable.md",
"variables/templateVariableString.md",
"variables/typeOperatorVariable.md",
]
`;
Expand Down Expand Up @@ -643,6 +644,7 @@ exports[`Urls should gets Urls for single entry points: outputFileStrategy: memb
"variables/objectWithSymbol.md",
"variables/someQuery.md",
"variables/stringVariable.md",
"variables/templateVariableString.md",
"variables/typeOperatorVariable.md",
]
`;
Expand Down

0 comments on commit f4f068b

Please sign in to comment.