mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-08-11 00:03:48 +00:00
Tweaks tests
This was the only place we were using the `variables` option to the widget constructor.
This commit is contained in:
parent
fc6dd83f2f
commit
874bd7b2b8
@ -16,10 +16,9 @@ describe("Widget module", function() {
|
|||||||
|
|
||||||
var widget = require("$:/core/modules/widgets/widget.js");
|
var widget = require("$:/core/modules/widgets/widget.js");
|
||||||
|
|
||||||
function createWidgetNode(parseTreeNode,wiki,variables) {
|
function createWidgetNode(parseTreeNode,wiki) {
|
||||||
return new widget.widget(parseTreeNode,{
|
return new widget.widget(parseTreeNode,{
|
||||||
wiki: wiki,
|
wiki: wiki,
|
||||||
variables: variables || {},
|
|
||||||
document: $tw.document
|
document: $tw.document
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -264,18 +263,8 @@ describe("Widget module", function() {
|
|||||||
it("should deal with attributes specified as macro invocations", function() {
|
it("should deal with attributes specified as macro invocations", function() {
|
||||||
var wiki = new $tw.Wiki();
|
var wiki = new $tw.Wiki();
|
||||||
// Construct the widget node
|
// Construct the widget node
|
||||||
var text = "<div class=<<myMacro 'something' three:'thing'>>>Content</div>";
|
var text = "\\define myMacro(one:\"paramOne\",two,three:\"paramTwo\")\nMy something $one$, $two$ or other $three$\n\\end\n<div class=<<myMacro 'something' three:'thing'>>>Content</div>";
|
||||||
var variables = {
|
var widgetNode = createWidgetNode(parseText(text,wiki),wiki);
|
||||||
myMacro: {
|
|
||||||
value: "My something $one$, $two$ or other $three$",
|
|
||||||
params: [
|
|
||||||
{name: "one", "default": "paramOne"},
|
|
||||||
{name: "two"},
|
|
||||||
{name: "three", "default": "paramTwo"}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var widgetNode = createWidgetNode(parseText(text,wiki),wiki,variables);
|
|
||||||
// Render the widget node to the DOM
|
// Render the widget node to the DOM
|
||||||
var wrapper = renderWidgetNode(widgetNode);
|
var wrapper = renderWidgetNode(widgetNode);
|
||||||
// Test the rendering
|
// Test the rendering
|
||||||
|
Loading…
x
Reference in New Issue
Block a user