mirror of
https://github.com/tenrok/OverlayScrollbars.git
synced 2026-06-17 02:30:37 +03:00
add rounding issues on ff visualization
This commit is contained in:
+1
-1
@@ -112,7 +112,7 @@ export const createOverflowUpdate: CreateStructureUpdateSegment = (
|
|||||||
|
|
||||||
const [updateSizeFraction, getCurrentSizeFraction] = createCache<WH<number>>(
|
const [updateSizeFraction, getCurrentSizeFraction] = createCache<WH<number>>(
|
||||||
whCacheOptions,
|
whCacheOptions,
|
||||||
fractionalSize.bind(0, _host)
|
fractionalSize.bind(0, _viewport)
|
||||||
);
|
);
|
||||||
|
|
||||||
const [updateViewportScrollSizeCache, getCurrentViewportScrollSizeCache] = createCache<
|
const [updateViewportScrollSizeCache, getCurrentViewportScrollSizeCache] = createCache<
|
||||||
|
|||||||
+38
-10
@@ -15,6 +15,7 @@ import {
|
|||||||
removeAttr,
|
removeAttr,
|
||||||
contents,
|
contents,
|
||||||
appendChildren,
|
appendChildren,
|
||||||
|
createDOM,
|
||||||
} from 'support';
|
} from 'support';
|
||||||
import { resize } from '@/testing-browser/Resize';
|
import { resize } from '@/testing-browser/Resize';
|
||||||
import { setTestResult, waitForOrFailTest } from '@/testing-browser/TestResult';
|
import { setTestResult, waitForOrFailTest } from '@/testing-browser/TestResult';
|
||||||
@@ -69,6 +70,7 @@ const expectedOverflowVisibleBehavior = (
|
|||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const msie11 = !!window.MSInputMethodContext && !!document.documentMode;
|
const msie11 = !!window.MSInputMethodContext && !!document.documentMode;
|
||||||
|
const ff = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
||||||
const msedge = window.navigator.userAgent.toLowerCase().indexOf('edge') > -1;
|
const msedge = window.navigator.userAgent.toLowerCase().indexOf('edge') > -1;
|
||||||
|
|
||||||
msie11 && addClass(document.body, 'msie11');
|
msie11 && addClass(document.body, 'msie11');
|
||||||
@@ -282,16 +284,42 @@ const checkMetrics = async (checkComparison: CheckComparisonObj) => {
|
|||||||
|
|
||||||
// ==== check scroll values:
|
// ==== check scroll values:
|
||||||
|
|
||||||
should.equal(
|
if (ff && isFractionalPixelRatio()) {
|
||||||
targetMetrics.scroll.width,
|
should.ok(
|
||||||
comparisonMetrics.scroll.width,
|
Math.abs(targetMetrics.scroll.width - comparisonMetrics.scroll.width) <= 1,
|
||||||
`Scroll width equality. (${osInstance.state().overflowAmount.x})`
|
`Scroll width equality. +-1 (${osInstance.state().overflowAmount.x})`
|
||||||
);
|
);
|
||||||
should.equal(
|
should.ok(
|
||||||
targetMetrics.scroll.height,
|
Math.abs(targetMetrics.scroll.height - comparisonMetrics.scroll.height) <= 1,
|
||||||
comparisonMetrics.scroll.height,
|
`Scroll height equality. +-1 (${osInstance.state().overflowAmount.y})`
|
||||||
`Scroll height equality. (${osInstance.state().overflowAmount.y})`
|
);
|
||||||
);
|
|
||||||
|
if (!document.querySelector('#rounding')) {
|
||||||
|
appendChildren(
|
||||||
|
targetUpdatesSlot!.parentElement!.parentElement,
|
||||||
|
createDOM('<span>Rounding issues: <span id="rounding">0</span></span>')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const roundingElm = document.querySelector('#rounding');
|
||||||
|
const scrollWidth = targetMetrics.scroll.width - comparisonMetrics.scroll.width;
|
||||||
|
const scrollHeight = targetMetrics.scroll.height - comparisonMetrics.scroll.height;
|
||||||
|
if (scrollWidth !== 0 || scrollHeight !== 0) {
|
||||||
|
console.log(scrollWidth);
|
||||||
|
console.log(scrollHeight);
|
||||||
|
roundingElm!.textContent = `${(parseInt(roundingElm!.textContent || '0', 10) || 0) + 1}`;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
should.equal(
|
||||||
|
targetMetrics.scroll.width,
|
||||||
|
comparisonMetrics.scroll.width,
|
||||||
|
`Scroll width equality. (${osInstance.state().overflowAmount.x})`
|
||||||
|
);
|
||||||
|
should.equal(
|
||||||
|
targetMetrics.scroll.height,
|
||||||
|
comparisonMetrics.scroll.height,
|
||||||
|
`Scroll height equality. (${osInstance.state().overflowAmount.y})`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
should.equal(
|
should.equal(
|
||||||
targetMetrics.hasOverflow.x,
|
targetMetrics.hasOverflow.x,
|
||||||
|
|||||||
Reference in New Issue
Block a user