scrollState-test.js — react Source File
Architecture documentation for scrollState-test.js, a javascript file in the react codebase. 6 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 626126b2_61b3_20dc_e1ac_74cfd65b9d88["scrollState-test.js"] d0e34df5_54e0_bd63_7394_3bfe61a4c376["scrollState.js"] 626126b2_61b3_20dc_e1ac_74cfd65b9d88 --> d0e34df5_54e0_bd63_7394_3bfe61a4c376 f077803e_adfb_e522_43d4_7b720fa272fa["clampState"] 626126b2_61b3_20dc_e1ac_74cfd65b9d88 --> f077803e_adfb_e522_43d4_7b720fa272fa 73b69eb1_1def_ae18_854c_a93b29fe5e7d["moveStateToRange"] 626126b2_61b3_20dc_e1ac_74cfd65b9d88 --> 73b69eb1_1def_ae18_854c_a93b29fe5e7d 7d8994ae_c610_bfe7_54d3_0ee2e2bf3ec1["areScrollStatesEqual"] 626126b2_61b3_20dc_e1ac_74cfd65b9d88 --> 7d8994ae_c610_bfe7_54d3_0ee2e2bf3ec1 94cfe42d_2d3d_5da3_cd07_23705b8b0ec6["translateState"] 626126b2_61b3_20dc_e1ac_74cfd65b9d88 --> 94cfe42d_2d3d_5da3_cd07_23705b8b0ec6 c31f920d_f533_0f23_d62e_7fc940a06959["zoomState"] 626126b2_61b3_20dc_e1ac_74cfd65b9d88 --> c31f920d_f533_0f23_d62e_7fc940a06959 style 626126b2_61b3_20dc_e1ac_74cfd65b9d88 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import {
clampState,
moveStateToRange,
areScrollStatesEqual,
translateState,
zoomState,
} from '../scrollState';
describe('clampState', () => {
it('should passthrough offset if state fits within container', () => {
expect(
clampState({
state: {offset: 0, length: 50},
minContentLength: 0,
maxContentLength: 100,
containerLength: 50,
}).offset,
).toBeCloseTo(0, 10);
expect(
clampState({
state: {offset: -20, length: 100},
minContentLength: 0,
maxContentLength: 100,
containerLength: 50,
}).offset,
).toBeCloseTo(-20, 10);
});
it('should clamp offset if offset causes content to go out of container', () => {
expect(
clampState({
state: {offset: -1, length: 50},
minContentLength: 0,
maxContentLength: 100,
containerLength: 50,
}).offset,
).toBeCloseTo(0, 10);
expect(
clampState({
state: {offset: 1, length: 50},
minContentLength: 0,
maxContentLength: 100,
containerLength: 50,
}).offset,
).toBeCloseTo(0, 10);
expect(
clampState({
state: {offset: -51, length: 100},
minContentLength: 0,
maxContentLength: 100,
// ... (202 more lines)
Domain
Source
Frequently Asked Questions
What does scrollState-test.js do?
scrollState-test.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain.
What does scrollState-test.js depend on?
scrollState-test.js imports 6 module(s): areScrollStatesEqual, clampState, moveStateToRange, scrollState.js, translateState, zoomState.
Where is scrollState-test.js in the architecture?
scrollState-test.js is located at packages/react-devtools-timeline/src/view-base/utils/__tests__/scrollState-test.js (domain: BabelCompiler, directory: packages/react-devtools-timeline/src/view-base/utils/__tests__).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free