Skip to content

Commit

Permalink
zoom: 0 wasn't being treated as zoom: 1
Browse files Browse the repository at this point in the history
  • Loading branch information
chearon committed Oct 25, 2024
1 parent 1ee7872 commit 87cdae9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ function computeStyle(parentStyle: Style, style: SpecifiedStyle) {
computed.zoom = style.zoom.value / 100;
}

if (style.zoom === 0) style.zoom = 1;
if (style.zoom === 0) computed.zoom = 1;

return new Style(computed, parentStyle);
}
Expand Down
10 changes: 10 additions & 0 deletions test/flow.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1721,4 +1721,14 @@ describe('Flow', function () {
expect(block.borderArea.y).to.equal(0);
});
});

describe.only('Zoom', function () {
it('treats 0 as 100%', function () {
this.layout('<div style="zoom: 0; margin-left: 1px;"></div>');

/** @type import('../src/layout-flow').BlockContainer */
const t = this.get('div');
expect(t.borderArea.x).to.equal(1);
});
});
});

0 comments on commit 87cdae9

Please sign in to comment.