There seems to be an issue with using the $ macro on enum strings containing unicode values in karax.
You can use karun --run to run the following code, and there should be a javascript error thrown, which can be seen in the browser developer tools.
include karax / prelude
type
NavType = enum
Home = "Home",
Review = "[漢字 Review]"
var
currentNav = Review
doAssert(currentNav == Review, "Check 1 failed") # OK
doAssert($Review == "[漢字 Review]", "Check 2 failed") # OK
doAssert($currentNav == $Review, "Check 3 failed") # Fails here
proc createDom(): VNode =
result = buildHtml(tdiv()):
text "Current page: " & $currentNav
setRenderer createDom
The assertion failure message is the following, which indicates the unicode characters in the string are in their escaped form, which is why the final assertion fails.
There seems to be an issue with using the
$
macro on enum strings containing unicode values in karax. You can usekarun --run
to run the following code, and there should be a javascript error thrown, which can be seen in the browser developer tools.The assertion failure message is the following, which indicates the unicode characters in the string are in their escaped form, which is why the final assertion fails.
This same test (without the karax content) works fine as a
nim c -r
test.