make param values different to names
This commit is contained in:
parent
b621c75342
commit
5bd075d32d
|
@ -50,10 +50,10 @@ describe("Widget module", function() {
|
|||
it("should make sure that getVariableInfo returns all expected parameters", function() {
|
||||
var wiki = new $tw.Wiki();
|
||||
wiki.addTiddlers([
|
||||
{title: "A", text: "\\define macro(a:a) aaa"},
|
||||
{title: "B", text: "\\function fn(f:f) fff\n\\function x() [<fn>]"},
|
||||
{title: "C", text: "\\procedure proc(p:p) ppp"},
|
||||
{title: "D", text: "\\widget $my.widget(w:w) www"}
|
||||
{title: "A", text: "\\define macro(a:aa) aaa"},
|
||||
{title: "B", text: "\\function fn(f:ff) fff\n\\function x() [<fn>]"},
|
||||
{title: "C", text: "\\procedure proc(p:pp) ppp"},
|
||||
{title: "D", text: "\\widget $my.widget(w:ww) www"}
|
||||
]);
|
||||
var text = "\\import A B C D\n\n<$let abc=def>";
|
||||
var widgetNode = createWidgetNode(parseText(text,wiki),wiki);
|
||||
|
@ -64,17 +64,17 @@ describe("Widget module", function() {
|
|||
childNode = childNode.children[0];
|
||||
}
|
||||
|
||||
expect(childNode.getVariableInfo("macro",{allowSelfAssigned:true}).params).toEqual([{name:"a",value:"a"}]);
|
||||
expect(childNode.getVariableInfo("macro",{allowSelfAssigned:true}).params).toEqual([{name:"a",value:"aa"}]);
|
||||
|
||||
// function params
|
||||
expect(childNode.getVariableInfo("fn", {allowSelfAssigned:true}).params).toEqual([{name:"f",value:"f"}]);
|
||||
expect(childNode.getVariableInfo("fn", {allowSelfAssigned:true}).params).toEqual([{name:"f",value:"ff"}]);
|
||||
// functions have a text and a value
|
||||
expect(childNode.getVariableInfo("x", {allowSelfAssigned:true}).text).toBe("fff");
|
||||
expect(childNode.getVariableInfo("x", {allowSelfAssigned:true}).srcVariable.value).toBe("[<fn>]");
|
||||
|
||||
// procedures and widgets failed prior to v5.3.4
|
||||
expect(childNode.getVariableInfo("proc", {allowSelfAssigned:true}).params).toEqual([{name:"p",default:"p"}]);
|
||||
expect(childNode.getVariableInfo("$my.widget", {allowSelfAssigned:true}).params).toEqual([{name:"w",default:"w"}]);
|
||||
expect(childNode.getVariableInfo("proc", {allowSelfAssigned:true}).params).toEqual([{name:"p",default:"pp"}]);
|
||||
expect(childNode.getVariableInfo("$my.widget", {allowSelfAssigned:true}).params).toEqual([{name:"w",default:"ww"}]);
|
||||
|
||||
// no params expected
|
||||
expect(childNode.getVariableInfo("abc", {allowSelfAssigned:true})).toEqual({text:"def"});
|
||||
|
|
Loading…
Reference in New Issue