File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -199,7 +199,7 @@ export default class DocElementParser {
199199 if ( displayTextPart ) {
200200 const match : RegExpExecArray | undefined = this . _displayTextBadCharacterRegEx . exec ( displayTextPart ) ;
201201 if ( match ) {
202- documentation . reportError ( `The {@link} tag\'s display text contains an unsupported `
202+ documentation . reportError ( `The {@link} tag\'s display text contains an unsupported`
203203 + ` character: "${ match [ 0 ] } "` ) ;
204204 return undefined ;
205205 }
Original file line number Diff line number Diff line change @@ -284,7 +284,25 @@ describe('DocElementParser tests', function (): void {
284284 + ' contains spaces, encode them using %20; for display text, use a pipe delimiter ("|")' ] ) ;
285285 } ) ;
286286
287- it ( 'Should parse @link with API defintion reference' , ( ) : void => {
287+ it ( 'Should reject @link with bad display text character' , ( ) : void => {
288+ clearCapturedErrors ( ) ;
289+
290+ const docs : string = '{@link https://example.com | Ex@ample}' ;
291+ const tokenizer : Tokenizer = new Tokenizer ( docs , console . log ) ;
292+
293+ let docElements : IDocElement [ ] ;
294+ /* tslint:disable-next-line:no-any */
295+ let errorMessage : any ;
296+ try {
297+ docElements = DocElementParser . parse ( myDocumentedClass . documentation , tokenizer ) ;
298+ } catch ( error ) {
299+ errorMessage = error ;
300+ }
301+ assert . isUndefined ( errorMessage ) ;
302+ assertCapturedErrors ( [ 'The {@link} tag\'s display text contains an unsupported character: "@"' ] ) ;
303+ } ) ;
304+
305+ it ( 'Should parse @link with API definition reference' , ( ) : void => {
288306 clearCapturedErrors ( ) ;
289307 const docs : string = '{@link @microsoft/sp-core-library:Guid.equals}' ;
290308 const tokenizer : Tokenizer = new Tokenizer ( docs , console . log ) ;
You can’t perform that action at this time.
0 commit comments