<commit_before>import { expect } from 'chai';

import disableScroll, {
  getScrollParent,
  getScrollAncestorsOverflowY,
} from '../../src/utils/disableScroll';

const describeIfWindow = typeof document === 'undefined' ? describe.skip : describe;

const createScrollContainer = (level = 1) => {
  const el = document.createElement('div');
  el.style.width = '300px';
  el.style.height = `${level * 100}px`;
  el.style.overflow = 'auto';
  return el;
};

const createScrollContent = () => {
  const el = document.createElement('div');
  el.style.width = '100%';
  el.style.height = '99999px';
  return el;
};

const createTargetElement = () => {
  const el = document.createElement('div');
  return el;
};

describeIfWindow('#disableScroll', () => {
  const grandParentScrollContainer = createScrollContainer(1);
  const parentScrollContainer = createScrollContainer(2);
  const scrollContent = createScrollContent();
  const targetElement = createTargetElement();
  scrollContent.appendChild(targetElement);

  describe('#getScrollParent', () => {<commit_msg>Fix mocha specs.<commit_after>import { expect } from 'chai';

import disableScroll, {
  getScrollParent,
  getScrollAncestorsOverflowY,
} from '../../src/utils/disableScroll';

const describeIfWindow = typeof document === 'undefined' ? describe.skip : describe;

const createScrollContainer = (level = 1) => {
  const el = document.createElement('div');
  el.style.width = '300px';
  el.style.height = `${level * 100}px`;
  el.style.overflow = 'auto';
  return el;
};

const createScrollContent = () => {
  const el = document.createElement('div');
  el.style.width = '100%';
  el.style.height = '99999px';
  return el;
};

const createTargetElement = () => {
  const el = document.createElement('div');
  return el;
};

describeIfWindow('#disableScroll', () => {
  let grandParentScrollContainer;
  let parentScrollContainer;
  let scrollContent;
  let targetElement;

  before(() => {
    grandParentScrollContainer = createScrollContainer(1);
    parentScrollContainer = createScrollContainer(2);
    scrollContent = createScrollContent();
    targetElement = createTargetElement();
    scrollContent.appendChild(targetElement);
  });

  describe('#getScrollParent', () => {
{'fraction_non_alphanumeric': 0.1475849731663685, 'fraction_numerical': 0.01520572450805009, 'mean_word_length': 4.810389610389611, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4717713', 'n_tokens_mistral': 672, 'n_tokens_neox': 647, 'n_words': 139}