@react-stately/virtualizer 3.6.7 → 3.6.8-nightly.4464

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -656,7 +656,18 @@ export class Virtualizer<T extends object, V, W> {
656
656
  }
657
657
 
658
658
  getVisibleLayoutInfos() {
659
- let rect = this.shouldOverscan ? this._overscanManager.getOverscannedRect() : this.getVisibleRect();
659
+ let isTestEnv = process.env.NODE_ENV === 'test' && !process.env.VIRT_ON;
660
+
661
+ let isClientWidthMocked = Object.getOwnPropertyNames(window.HTMLElement.prototype).includes('clientWidth');
662
+ let isClientHeightMocked = Object.getOwnPropertyNames(window.HTMLElement.prototype).includes('clientHeight');
663
+
664
+ let rect;
665
+ if (isTestEnv && !(isClientWidthMocked && isClientHeightMocked)) {
666
+ rect = this._getContentRect();
667
+ } else {
668
+ rect = this.shouldOverscan ? this._overscanManager.getOverscannedRect() : this.getVisibleRect();
669
+ }
670
+
660
671
  this._visibleLayoutInfos = this._getLayoutInfoMap(rect);
661
672
  return this._visibleLayoutInfos;
662
673
  }
@@ -822,8 +833,8 @@ export class Virtualizer<T extends object, V, W> {
822
833
  }
823
834
 
824
835
  private _flushVisibleViews() {
825
- // CollectionVirtualizer deals with a flattened set of LayoutInfos, but they can represent heirarchy
826
- // by referencing a parentKey. Just before rendering the visible views, we rebuild this heirarchy
836
+ // CollectionVirtualizer deals with a flattened set of LayoutInfos, but they can represent hierarchy
837
+ // by referencing a parentKey. Just before rendering the visible views, we rebuild this hierarchy
827
838
  // by creating a mapping of views by parent key and recursively calling the delegate's renderWrapper
828
839
  // method to build the final tree.
829
840
  let viewsByParentKey = new Map([[null, []]]);