Skip to content

Commit 87f8596

Browse files
committed
fix issues/1047
1 parent bcdf5e8 commit 87f8596

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "inkjs",
3-
"version": "2.2.2",
3+
"version": "2.2.3",
44
"description": "A javascript port of inkle's ink scripting language (http://www.inklestudios.com/ink/)",
55
"main": "dist/ink-full.js",
66
"types": "ink.d.ts",

src/engine/Story.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1230,7 +1230,7 @@ export class Story extends InkObject {
12301230
this.state.PopFromOutputStream(outputCountConsumed);
12311231
// Build string out of the content we collected
12321232
let sb = new StringBuilder();
1233-
for (let strVal of contentStackForTag) {
1233+
for (let strVal of contentStackForTag.reverse()) {
12341234
sb.Append(strVal.toString());
12351235
}
12361236
let choiceTag = new Tag(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
VAR var1 = "aaa"
2+
VAR var2 = "bbb"
3+
4+
+[choice #tag {var1}{var2}]

src/tests/specs/ink/Choices.spec.ts

+11
Original file line numberDiff line numberDiff line change
@@ -278,4 +278,15 @@ describe("Choices", () => {
278278
expect(context.story.Continue()).toBe("one three");
279279
expect(context.story.currentTags).toEqual(["one", "three"]);
280280
});
281+
282+
//TestDynanicTagsInChoice
283+
it("tests tags in choice", () => {
284+
compileStory("dynamic_tags_in_choice", true);
285+
context.story.Continue();
286+
287+
expect(context.story.currentTags.length).toBe(0);
288+
expect(context.story.currentChoices.length).toBe(1);
289+
expect(context.story.currentChoices[0].text).toEqual("choice");
290+
expect(context.story.currentChoices[0].tags).toEqual(["tag aaabbb"]);
291+
});
281292
});

0 commit comments

Comments
 (0)