From 4fd851b3d5c620faec02ba06bf8f615864f7d500 Mon Sep 17 00:00:00 2001 From: Caleb Hearon Date: Fri, 25 Oct 2024 00:54:50 -0400 Subject: [PATCH] add more zoom tests --- test/flow.spec.js | 53 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/test/flow.spec.js b/test/flow.spec.js index 44d796f..81e683e 100644 --- a/test/flow.spec.js +++ b/test/flow.spec.js @@ -1722,7 +1722,58 @@ describe('Flow', function () { }); }); - describe.only('Zoom', function () { + describe('Zoom', function () { + it('multiplies lengths on the box model', function () { + this.layout(` +
+
+
+ `); + + /** @type import('../src/layout-flow').BlockContainer */ + const block = this.get('#t'); + expect(block.contentArea.width).to.equal(46); + expect(block.contentArea.height).to.equal(46); + }); + + it('multiplies font-size and line-height', function () { + this.layout(` +
+
sleepy
+
ada
+
+ `); + + /** @type import('../src/layout-flow').BlockContainer */ + const t1 = this.get('#t1'); + expect(t1.contentArea.height).to.equal(20); + /** @type import('../src/layout-flow').BlockContainer */ + const t2 = this.get('#t2'); + expect(t2.contentArea.height).to.equal(40); + }); + + it('multiplies left and top', function () { + this.layout(` +
+ `); + + /** @type import('../src/layout-flow').BlockContainer */ + const t = this.get('div'); + expect(t.contentArea.x).to.equal(25); + expect(t.contentArea.y).to.equal(25); + }); + + it('multiplies bottom and right', function () { + this.layout(` +
+ `); + + /** @type import('../src/layout-flow').BlockContainer */ + const t = this.get('div'); + expect(t.contentArea.x).to.equal(-25); + expect(t.contentArea.y).to.equal(-25); + }); + it('treats 0 as 100%', function () { this.layout('
');