1
0
Fork 0
mirror of synced 2024-06-30 12:00:31 +12:00

Fixing bug #3195 with zero/falsy values not being passed out of bindings.

This commit is contained in:
mike12345567 2021-11-02 16:30:43 +00:00
parent b0a9de45cf
commit 2719f7e97e
2 changed files with 13 additions and 1 deletions

View file

@ -31,7 +31,7 @@ const HELPERS = [
}
// null/undefined values produce bad results
if (value == null || typeof value !== "string") {
return value || ""
return value == null ? "" : value
}
if (value && value.string) {
value = value.string

View file

@ -125,6 +125,18 @@ describe("check the utility functions", () => {
})
})
describe("check falsy values", () => {
it("should get a zero out when context contains it", async () => {
const output = await processString("{{ number }}", { number: 0 })
expect(output).toEqual("0")
})
it("should get false out when context contains it", async () => {
const output = await processString("{{ bool }}", { bool: false })
expect(output).toEqual("false")
})
})
describe("check manifest", () => {
it("should be able to retrieve the manifest", () => {
const manifest = getManifest()