build(docs-infra): allow `""` as empty region in `{@example}` tags (#26514)
PR Close #26514
This commit is contained in:
parent
7bad1d356d
commit
d9d226087c
|
@ -23,7 +23,7 @@ module.exports = function exampleInlineTagDef(parseArgString, createDocMessage)
|
||||||
var unnamedArgs = tagArgs._;
|
var unnamedArgs = tagArgs._;
|
||||||
var relativePath = unnamedArgs[0];
|
var relativePath = unnamedArgs[0];
|
||||||
var regionName = tagArgs.region || (unnamedArgs.length > 1 ? unnamedArgs[1] : '');
|
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 header = tagArgs.header || (unnamedArgs.length > 2 ? unnamedArgs.slice(2).join(' ') : '');
|
||||||
var linenums = tagArgs.linenums;
|
var linenums = tagArgs.linenums;
|
||||||
// var stylePattern = tagArgs.stylePattern; // TODO: not yet implemented here
|
// var stylePattern = tagArgs.stylePattern; // TODO: not yet implemented here
|
||||||
|
|
|
@ -42,12 +42,18 @@ describe('example inline-tag-def', function() {
|
||||||
'<code-example path="test/url" region="region-1"></code-example>');
|
'<code-example path="test/url" region="region-1"></code-example>');
|
||||||
});
|
});
|
||||||
|
|
||||||
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(
|
||||||
'<code-example path="test/url"></code-example>');
|
'<code-example path="test/url"></code-example>');
|
||||||
|
|
||||||
|
expect(handler({}, 'example', 'test/url ""')).toEqual(
|
||||||
|
'<code-example path="test/url"></code-example>');
|
||||||
|
|
||||||
expect(handler({}, 'example', 'test/url \'\' Some Header')).toEqual(
|
expect(handler({}, 'example', 'test/url \'\' Some Header')).toEqual(
|
||||||
'<code-example path="test/url" header="Some Header"></code-example>');
|
'<code-example path="test/url" header="Some Header"></code-example>');
|
||||||
|
|
||||||
|
expect(handler({}, 'example', 'test/url "" Some Header')).toEqual(
|
||||||
|
'<code-example path="test/url" header="Some Header"></code-example>');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should add a header if specified', () => {
|
it('should add a header if specified', () => {
|
||||||
|
|
Loading…
Reference in New Issue