-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support '=' in the plural parameters
- Loading branch information
Showing
6 changed files
with
58 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { parse } from "@formatjs/icu-messageformat-parser"; | ||
import { parser } from "./tolgeeParser"; | ||
|
||
function icu(text: string, ignoreTag = true) { | ||
return parse(text, { | ||
captureLocation: true, | ||
ignoreTag, | ||
}); | ||
} | ||
|
||
function tolgee(text: string) { | ||
return parser.configure({ strict: true, dialect: "tags" }).parse(text); | ||
} | ||
|
||
function getText() { | ||
return expect.getState().currentTestName!.replace("simple formatter ", ""); | ||
} | ||
|
||
function matchIcu(text = getText()) { | ||
expect(() => icu(text)).not.toThrow(); | ||
expect(() => tolgee(text)).not.toThrow(); | ||
} | ||
|
||
describe("tolgee parser with tags", () => { | ||
test("This is < invalid > tag", () => { | ||
matchIcu(); | ||
}); | ||
|
||
test("Test <a>valid</a> tag", () => { | ||
matchIcu(); | ||
}); | ||
|
||
test("Test '<a>' escaped tag", () => { | ||
matchIcu(); | ||
}); | ||
|
||
test("tag escaping causing also more stuff to be escaped", () => { | ||
matchIcu("This '<a> {} is all escaped"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.