Fixed issue where $parameters did nothing with no $transclude (#8203)

* Fixed issue where $parameters did nothing with no $transclude

* Figured I should test \parameters too
This commit is contained in:
Cameron Fischer
2024-06-06 06:20:35 -04:00
committed by GitHub
parent 33bc77f46f
commit 352272905e
2 changed files with 32 additions and 0 deletions

View File

@@ -816,6 +816,26 @@ describe("Widget module", function() {
expect(wrapper.innerHTML).toBe("<p>Bval</p>");
});
it("should use default $parameters if directly rendered", function() {
var wiki = new $tw.Wiki();
var text = "<$parameters bee=default $$dollar=bill nothing empty=''>bee=<<bee>>, $dollar=<<$dollar>>, nothing=<<nothing>>, empty=<<empty>></$parameters>";
var widgetNode = createWidgetNode(parseText(text,wiki),wiki);
// Render the widget node to the DOM
var wrapper = renderWidgetNode(widgetNode);
// nothing = true in this attribute form because valueless attributes always equal true.
expect(wrapper.innerHTML).toBe("<p>bee=default, $dollar=bill, nothing=true, empty=</p>");
});
it("should use default \\parameters if directly rendered", function() {
var wiki = new $tw.Wiki();
var text = "\\parameters(bee:default $$dollar:bill nothing)\nbee=<<bee>>, $$dollar=<<$$dollar>>, nothing=<<nothing>>";
var widgetNode = createWidgetNode(parseText(text,wiki),wiki);
// Render the widget node to the DOM
var wrapper = renderWidgetNode(widgetNode);
// nothing = true in this attribute form because valueless attributes always equal true.
expect(wrapper.innerHTML).toBe("<p>bee=default, $$dollar=bill, nothing=</p>");
});
it("can have more than one macroDef variable imported", function() {
var wiki = new $tw.Wiki();
wiki.addTiddlers([