mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-24 17:10:29 +00:00
Missing tests for parameters widget
This commit is contained in:
parent
fa86631d2e
commit
8f9d5cabaa
@ -70,7 +70,7 @@ ParametersWidget.prototype.execute = function() {
|
||||
// Assign any metaparameters
|
||||
$tw.utils.each(pointer.getTransclusionMetaParameters(),function(getValue,name) {
|
||||
var variableName = self.getAttribute("$" + name);
|
||||
if(variableName !== undefined) {
|
||||
if(variableName) {
|
||||
self.setVariable(variableName,getValue(name));
|
||||
}
|
||||
});
|
||||
|
@ -330,11 +330,11 @@ Get one of the special parameters to be provided by the parameters widget
|
||||
TranscludeWidget.prototype.getTransclusionMetaParameters = function() {
|
||||
var self = this;
|
||||
return {
|
||||
"parseAsInline": function() {
|
||||
return self.parseAsInline ? "yes" : "no";
|
||||
"parseMode": function() {
|
||||
return self.parseAsInline ? "inline" : "block";
|
||||
},
|
||||
"parseTreeNodes": function() {
|
||||
return JSON.stringify(self.parseTreeNode);
|
||||
return JSON.stringify(self.parseTreeNode.children || []);
|
||||
},
|
||||
"slotFillParseTreeNodes": function() {
|
||||
return JSON.stringify(self.slotFillParseTrees);
|
||||
|
@ -0,0 +1,29 @@
|
||||
title: Transclude/Parameterised/Mode
|
||||
description: Parameterised transclusion using the $parseMode attribute
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
|
||||
<$transclude $tiddler='TiddlerOne' one='Ferret'>
|
||||
|
||||
This is a block
|
||||
|
||||
</$transclude>
|
||||
|
||||
<$transclude $tiddler='TiddlerOne'>
|
||||
This is inline
|
||||
</$transclude>
|
||||
+
|
||||
title: TiddlerOne
|
||||
|
||||
\whitespace trim
|
||||
<$parameters $parseMode="@parseMode">
|
||||
<$text text=<<@parseMode>>/>
|
||||
</$parameters>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>block</p><p>inline</p>
|
@ -0,0 +1,29 @@
|
||||
title: Transclude/Parameterised/ParseTreeNodes
|
||||
description: Parameterised transclusion using the $parseTreeNodes attribute
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
|
||||
<$transclude $tiddler='TiddlerOne' one='Ferret'>
|
||||
|
||||
This is a block
|
||||
|
||||
</$transclude>
|
||||
|
||||
<$transclude $tiddler='TiddlerOne'>
|
||||
This is inline
|
||||
</$transclude>
|
||||
+
|
||||
title: TiddlerOne
|
||||
|
||||
\whitespace trim
|
||||
<$parameters $parseTreeNodes="@parseTreeNodes">
|
||||
<$text text=<<@parseTreeNodes>>/>
|
||||
</$parameters>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>[{"type":"element","tag":"p","children":[{"type":"text","text":"This is a block","start":68,"end":83}],"start":68,"end":83}]</p><p>[{"type":"text","text":"This is inline","start":136,"end":152}]</p>
|
@ -0,0 +1,29 @@
|
||||
title: Transclude/Parameterised/SlotFillParseTreeNodes
|
||||
description: Parameterised transclusion using the $slotFillParseTreeNodes attribute
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
|
||||
<$transclude $tiddler='TiddlerOne' one='Ferret'>
|
||||
<$fill $name="one">This is first</$fill>
|
||||
<$fill $name="two">But this is second</$fill>
|
||||
</$transclude>
|
||||
|
||||
<$transclude $tiddler='TiddlerOne'>
|
||||
<$fill $name="one">This is first
|
||||
<$fill $name="two">But this is second</$fill></$fill>
|
||||
</$transclude>
|
||||
+
|
||||
title: TiddlerOne
|
||||
|
||||
\whitespace trim
|
||||
<$parameters $slotFillParseTreeNodes="@slotFillParseTreeNodes">
|
||||
<$text text={{{ [<@slotFillParseTreeNodes>jsonindexes[]join[,]] }}}/>
|
||||
</$parameters>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>one,ts-raw,two</p><p>one,ts-raw</p>
|
Loading…
Reference in New Issue
Block a user