Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7410487
ve.dm.MWTransclusionNode.test.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
ve.dm.MWTransclusionNode.test.js
View Options
/*!
* VisualEditor DataModel MWTransclusionNode tests.
*
* @copyright See AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
QUnit
.
module
(
've.dm.MWTransclusionNode'
);
QUnit
.
test
.
each
(
'getWikitext'
,
{
'mix of numbered and named parameters'
:
{
mw
:
{
target
:
{
wt
:
'foo'
},
params
:
{
1
:
{
wt
:
'bar'
},
baz
:
{
wt
:
'quux'
}
}
},
wikitext
:
'{{foo|1=bar|baz=quux}}'
},
'parameter with self-closing nowiki'
:
{
mw
:
{
target
:
{
wt
:
'foo'
},
params
:
{
bar
:
{
wt
:
'l\'<nowiki />\'\'\'Étranger\'\'\''
}
}
},
wikitext
:
'{{foo|bar=l\'<nowiki />\'\'\'Étranger\'\'\'}}'
},
'parameter with self-closing nowiki without space'
:
{
mw
:
{
target
:
{
wt
:
'foo'
},
params
:
{
bar
:
{
wt
:
'l\'<nowiki/>\'\'\'Étranger\'\'\''
}
}
},
wikitext
:
'{{foo|bar=l\'<nowiki/>\'\'\'Étranger\'\'\'}}'
},
'parameter with spanning-nowiki'
:
{
mw
:
{
target
:
{
wt
:
'foo'
},
params
:
{
bar
:
{
wt
:
'You should use <nowiki>\'\'\'</nowiki> to make things bold.'
}
}
},
wikitext
:
'{{foo|bar=You should use <nowiki>\'\'\'</nowiki> to make things bold.}}'
},
'parameter with spanning-nowiki and nested transclusion'
:
{
mw
:
{
target
:
{
wt
:
'foo'
},
params
:
{
bar
:
{
wt
:
'You should try using <nowiki>{{ping|foo=bar|2=1}}</nowiki> as a transclusion!'
}
}
},
wikitext
:
'{{foo|bar=You should try using <nowiki>{{ping|foo=bar|2=1}}</nowiki> as a transclusion!}}'
},
'parameter containing another template invocation'
:
{
mw
:
{
target
:
{
wt
:
'foo'
},
params
:
{
bar
:
{
wt
:
'{{ping|foo=bar|2=1}}'
}
}
},
wikitext
:
'{{foo|bar={{ping|foo=bar|2=1}}}}'
},
'parameter containing another parameter'
:
{
mw
:
{
target
:
{
wt
:
'foo'
},
params
:
{
bar
:
{
wt
:
'{{{1}}}'
}
}
},
wikitext
:
'{{foo|bar={{{1}}}}}'
},
'parameter containing unmatched close brackets and floating pipes'
:
{
mw
:
{
target
:
{
wt
:
'foo'
},
params
:
{
bar
:
{
wt
:
'}} | {{a|{{b}}}} |'
}
}
},
wikitext
:
'{{foo|bar=<nowiki>}}</nowiki> <nowiki>|</nowiki> {{a|{{b}}}} <nowiki>|</nowiki>}}'
},
'parameter containing piped link'
:
{
mw
:
{
target
:
{
wt
:
'foo'
},
params
:
{
bar
:
{
wt
:
'[[baz|quux]]'
}
}
},
wikitext
:
'{{foo|bar=[[baz|quux]]}}'
}
},
(
assert
,
caseItem
)
=>
{
const
node
=
new
ve
.
dm
.
MWTransclusionNode
(
{
type
:
'mwTransclusion'
,
attributes
:
{
mw
:
caseItem
.
mw
}
}
);
assert
.
strictEqual
(
node
.
getWikitext
(),
caseItem
.
wikitext
);
}
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 21, 23:00 (1 d, 22 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
4a/54/1d21305163c19fd7ce8123969f60
Default Alt Text
ve.dm.MWTransclusionNode.test.js (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment