import React from 'react';
import { render, cleanup } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';
import getPageData from '~tests/factories/pages/default.factory';
import Sticky from '.';

describe('summary component', () => {
  test('test content', () => {
    const { container, getByText } = render(<Sticky>Test content</Sticky>);
    expect(container).toBeTruthy();

    expect(container.querySelector('.notScrolled')).toBeTruthy();
    expect(getByText('Test content')).toBeTruthy();
    // expect(container.querySelector('.sticky')).toBeVisible();
  });

  test('test content', () => {
    const { container, getByText } = render(<Sticky showOnScroll={false}>Test content</Sticky>);

    expect(container).toBeTruthy();
    expect(container.querySelector('.notScrolled')).toBeFalsy();
    expect(getByText('Test content')).toBeTruthy();
  });

  test('test content', () => {
    const { container, getByText } = render(
      <Sticky showOnScroll={false} position="top">
        Test content
      </Sticky>
    );

    expect(container).toBeTruthy();
    expect(container.querySelector('.top')).toBeTruthy();
    expect(container.querySelector('.notScrolled')).toBeFalsy();
    expect(getByText('Test content')).toBeTruthy();
  });
});
afterEach(() => {
  cleanup();
});
