mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-02-18 07:59:50 +00:00
Compare commits
1 Commits
debugging-
...
yet-more-m
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
add7f26f04 |
@@ -25,7 +25,7 @@ Render this widget into the DOM
|
||||
*/
|
||||
TranscludeWidget.prototype.render = function(parent,nextSibling) {
|
||||
this.parentDomNode = parent;
|
||||
this.computeAttributes();
|
||||
this.computeAttributes({asList: true});
|
||||
this.execute();
|
||||
try {
|
||||
this.renderChildren(parent,nextSibling);
|
||||
|
||||
@@ -377,6 +377,7 @@ Widget.prototype.makeFakeWidgetWithVariables = function(variables) {
|
||||
Compute the current values of the attributes of the widget. Returns a hashmap of the names of the attributes that have changed.
|
||||
Options include:
|
||||
filterFn: only include attributes where filterFn(name) returns true
|
||||
asList: boolean if true returns results as an array instead of a single value
|
||||
*/
|
||||
Widget.prototype.computeAttributes = function(options) {
|
||||
options = options || {};
|
||||
@@ -389,7 +390,7 @@ Widget.prototype.computeAttributes = function(options) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
var value = self.computeAttribute(attribute),
|
||||
var value = self.computeAttribute(attribute,options),
|
||||
multiValue = null;
|
||||
if($tw.utils.isArray(value)) {
|
||||
multiValue = value;
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
title: MultiValuedVariables/TranscludeParameterDirectly
|
||||
description: Multi-valued variable passed as procedure parameter via {{{filter}}} syntax
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
\procedure showItems(itemList)
|
||||
<$text text={{{ [(itemList)join[-]] }}}/>
|
||||
\end
|
||||
|
||||
<$transclude $variable="showItems" itemList={{{ [all[tiddlers]sort[]] }}}/>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>$:/core-ExpectedResult-Output</p>
|
||||
+
|
||||
|
||||
@@ -13,12 +13,6 @@ var TEST_WIKI_TIDDLER_FILTER = "[all[tiddlers+shadows]type[text/vnd.tiddlywiki-m
|
||||
|
||||
var widget = require("$:/core/modules/widgets/widget.js");
|
||||
|
||||
// List any wikitext tests that you want to debug here
|
||||
// Code can then check for the value of $tw.debugWikiTextTests to decide whether to trigger the debugger
|
||||
var debugTitles = [
|
||||
// "MultiValuedVariables/TranscludeParameterDirectly"
|
||||
];
|
||||
|
||||
describe("Wiki-based tests", function() {
|
||||
|
||||
// Step through the test tiddlers
|
||||
@@ -45,10 +39,6 @@ describe("Wiki-based tests", function() {
|
||||
throw "Missing 'Output' tiddler";
|
||||
}
|
||||
if(wiki.tiddlerExists("ExpectedResult")) {
|
||||
// Set the debug flag if this is one of the tests we're interested in
|
||||
if(debugTitles.indexOf(title) !== -1) {
|
||||
$tw.debugWikiTextTests = true;
|
||||
}
|
||||
// Construct the widget node
|
||||
var text = "{{Output}}\n\n";
|
||||
var widgetNode = createWidgetNode(parseText(text,wiki),wiki);
|
||||
@@ -61,8 +51,6 @@ describe("Wiki-based tests", function() {
|
||||
widgetNode.invokeActionString(wiki.getTiddlerText("Actions"));
|
||||
refreshWidgetNode(widgetNode,wrapper);
|
||||
}
|
||||
// Clear the debug flag
|
||||
$tw.debugWikiTextTests = false;
|
||||
// Test the rendering
|
||||
expect(wrapper.innerHTML).toBe(wiki.getTiddlerText("ExpectedResult"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user