Reword the confusing example in the #generateHTMLFromTemplate() test

This commit is contained in:
Tom Najdek 2025-04-02 14:01:11 +02:00
parent c59c1f7e7c
commit fcfb6e16d0
No known key found for this signature in database
GPG key ID: EEC61A7B4C667D77

View file

@ -682,13 +682,13 @@ describe("Zotero.Utilities.Internal", function () {
assert.equal(out4, '100 is more than 99');
// This is undocumented and unsupported behavior, but comparing strings should work
const template5 = `{{if "test" > v2}}"t" is after "f" in the alphabet{{else}}no{{endif}}`;
const template5 = `{{if "test" > v2}}"test" > "foo"{{else}}no{{endif}}`;
const out5 = Zotero.Utilities.Internal.generateHTMLFromTemplate(template5, vars);
assert.equal(out5, '"t" is after "f" in the alphabet');
assert.equal(out5, '"test" > "foo"');
const template6 = `{{if "bar" < v2 }}"f" is before "b" in the alphabet{{else}}no{{endif}}`;
const template6 = `{{if "bar" < v2 }}"bar" < "foo"{{else}}no{{endif}}`;
const out6 = Zotero.Utilities.Internal.generateHTMLFromTemplate(template6, vars);
assert.equal(out6, '"f" is before "b" in the alphabet');
assert.equal(out6, '"bar" < "foo"');
});
it("should accept hyphen-case variables and attributes", function () {