From 64313377922ca9f001cb7e22868821414d32b295 Mon Sep 17 00:00:00 2001 From: dhowe Date: Sun, 28 Jan 2024 13:21:15 +0800 Subject: [PATCH] update tests --- test/dist/riscript.tests.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/dist/riscript.tests.js b/test/dist/riscript.tests.js index bea55c4..ebc926b 100644 --- a/test/dist/riscript.tests.js +++ b/test/dist/riscript.tests.js @@ -774,10 +774,10 @@ describe(title, function() { res = riscript.evaluate("$[a | b].name", context); expect(res).to.be.oneOf(["Lucy", "Sam"]); }); - it("Pass scripting as this", function() { + it("Pass context as this", function() { let checkThis = function(word) { - expect(this).eq(riscript); - return word + (this == riscript ? " success" : " failure"); + expect(this).eq(riscript.visitor.context); + return word + (this === riscript.visitor.context ? " success" : " failure"); }; let res = riscript.evaluate("[hello].checkThis", { checkThis }); expect(res).eq("hello success"); @@ -877,7 +877,7 @@ describe(title, function() { res = riscript.evaluate("The [dog | dog | dog].rhymes", 0, { silent: true }); expect(res).eq("The dog.rhymes"); let addRhyme2 = function(word) { - return word + " rhymes with bog" + this.RiTa.randi(1); + return word + " rhymes with bog" + riscript.RiTa.randi(1); }; expect(riscript.transforms.rhymes2).is.undefined; riscript.addTransform("rhymes2", addRhyme2);