Skip to content

Commit

Permalink
fix: rtl scroll converter test asserting incorrect values (#6859)
Browse files Browse the repository at this point in the history
* Revert "fix: RtlScrollConverter test on high dpi systems in fast-web-utilities (#6857)"

This reverts commit a7a3c89.

* force 1x display scale factor in karma

* fix RtlScrollConverter test

- Chromium reports 0.5
- Webkit and Firefox both report 0

* Change files
  • Loading branch information
radium-v authored and janechu committed Jun 10, 2024
1 parent 27df015 commit d832f22
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"type": "none",
"comment": "fix RtlScrollConverter test for high dpi systems",
"comment": "fix RtlScrollConverter test",
"packageName": "@microsoft/fast-web-utilities",
"email": "[email protected]",
"dependentChangeType": "none"
Expand Down
1 change: 1 addition & 0 deletions packages/utilities/fast-web-utilities/karma.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const commonChromeFlags = [
"--disable-extensions",
"--disable-infobars",
"--disable-translate",
"--force-device-scale-factor=1",
];

module.exports = function (config: any) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,14 @@ describe("RtlScrollConverter", (): void => {
);
});

it("invertedGetRtlScrollConverter returns correct value", () => {
const scale = window.devicePixelRatio;
it("invertedGetRtlScrollConverter returns a value <= 0", () => {
const testElement: HTMLDivElement = getDummyDiv();
document.body.appendChild(testElement);
testElement.scrollLeft = 1;

expect(RtlScrollConverter["invertedGetRtlScrollConverter"](testElement)).to.equal(
-1 / scale
);
expect(
RtlScrollConverter["invertedGetRtlScrollConverter"](testElement)
).to.be.lessThanOrEqual(0);
});

it("reverseGetRtlScrollConverter returns correct value", () => {
Expand Down

0 comments on commit d832f22

Please sign in to comment.