mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-02-18 16:09:52 +00:00
Compare commits
1 Commits
yet-more-m
...
debugging-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2d14826032 |
@@ -25,7 +25,7 @@ Render this widget into the DOM
|
||||
*/
|
||||
TranscludeWidget.prototype.render = function(parent,nextSibling) {
|
||||
this.parentDomNode = parent;
|
||||
this.computeAttributes({asList: true});
|
||||
this.computeAttributes();
|
||||
this.execute();
|
||||
try {
|
||||
this.renderChildren(parent,nextSibling);
|
||||
|
||||
@@ -377,7 +377,6 @@ 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 || {};
|
||||
@@ -390,7 +389,7 @@ Widget.prototype.computeAttributes = function(options) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
var value = self.computeAttribute(attribute,options),
|
||||
var value = self.computeAttribute(attribute),
|
||||
multiValue = null;
|
||||
if($tw.utils.isArray(value)) {
|
||||
multiValue = value;
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
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,6 +13,12 @@ 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
|
||||
@@ -39,6 +45,10 @@ 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);
|
||||
@@ -51,6 +61,8 @@ 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