From d9d226087c2558745ffda6c80fa806ad10f1f4e0 Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Thu, 18 Oct 2018 14:33:46 +0300 Subject: [PATCH] build(docs-infra): allow `""` as empty region in `{@example}` tags (#26514) PR Close #26514 --- .../examples-package/inline-tag-defs/example.js | 2 +- .../examples-package/inline-tag-defs/example.spec.js | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/aio/tools/transforms/examples-package/inline-tag-defs/example.js b/aio/tools/transforms/examples-package/inline-tag-defs/example.js index 9b5f9a9cf0..b169dbd6b2 100644 --- a/aio/tools/transforms/examples-package/inline-tag-defs/example.js +++ b/aio/tools/transforms/examples-package/inline-tag-defs/example.js @@ -23,7 +23,7 @@ module.exports = function exampleInlineTagDef(parseArgString, createDocMessage) var unnamedArgs = tagArgs._; var relativePath = unnamedArgs[0]; var regionName = tagArgs.region || (unnamedArgs.length > 1 ? unnamedArgs[1] : ''); - if (regionName === '\'\'') regionName = ''; + if (regionName === '\'\'' || regionName === '""') regionName = ''; var header = tagArgs.header || (unnamedArgs.length > 2 ? unnamedArgs.slice(2).join(' ') : ''); var linenums = tagArgs.linenums; // var stylePattern = tagArgs.stylePattern; // TODO: not yet implemented here diff --git a/aio/tools/transforms/examples-package/inline-tag-defs/example.spec.js b/aio/tools/transforms/examples-package/inline-tag-defs/example.spec.js index 9421686d18..cdc75927f4 100644 --- a/aio/tools/transforms/examples-package/inline-tag-defs/example.spec.js +++ b/aio/tools/transforms/examples-package/inline-tag-defs/example.spec.js @@ -42,12 +42,18 @@ describe('example inline-tag-def', function() { ''); }); - it('should add no region if an empty (\'\') region is specified', () => { + it('should add no region if an empty (\'\'/"") region is specified', () => { expect(handler({}, 'example', 'test/url \'\'')).toEqual( ''); + expect(handler({}, 'example', 'test/url ""')).toEqual( + ''); + expect(handler({}, 'example', 'test/url \'\' Some Header')).toEqual( ''); + + expect(handler({}, 'example', 'test/url "" Some Header')).toEqual( + ''); }); it('should add a header if specified', () => {