Skip to content

Commit

Permalink
Reproduce issue described in #45
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Dec 14, 2023
1 parent cfac8e7 commit 88cea34
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/node-api.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,37 @@ describe("parse", function () {
]);
});

it("multi-byte characters", function () {
let contentLength = "안녕하세요 세계".length;
let openLength = "<template>".length;
let closeLength = "</template>".length;
let output = p.parse("<template>안녕하세요 세계</template>");

expect(output).to.eql([
{
type: "expression",
tagName: "template",
contents: "안녕하세요 세계",
range: {
start: 0,
end: openLength + contentLength + closeLength,
},
contentRange: {
start: openLength,
end: openLength + contentLength,
},
startRange: {
end: openLength,
start: 0,
},
endRange: {
start: openLength + contentLength - 1,
end: openLength + contentLength + closeLength,
},
},
]);
});

it("expression position", function () {
let output = p.parse("const tpl = <template>Hello!</template>");

Expand Down

0 comments on commit 88cea34

Please sign in to comment.