| 533 | describe("repeatx/repeaty to repeat string mapping", () => { |
| 534 | // Helper: mirrors the logic in readImageLayer |
| 535 | function deriveRepeat(data) { |
| 536 | const rx = data.repeatx === true || data.repeatx === "1"; |
| 537 | const ry = data.repeaty === true || data.repeaty === "1"; |
| 538 | let repeat = data.properties?.repeat; |
| 539 | if (typeof repeat === "undefined" && (rx || ry)) { |
| 540 | if (rx && ry) { |
| 541 | repeat = "repeat"; |
| 542 | } else if (rx) { |
| 543 | repeat = "repeat-x"; |
| 544 | } else { |
| 545 | repeat = "repeat-y"; |
| 546 | } |
| 547 | } |
| 548 | return repeat; |
| 549 | } |
| 550 | |
| 551 | it("should derive repeat-x from JSON boolean repeatx=true", () => { |
| 552 | expect(deriveRepeat({ repeatx: true })).toEqual("repeat-x"); |