No Description

table.test.js 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /**
  2. * @jest-environment puppeteer
  3. * @flow
  4. */
  5. import { screenshot, scroll } from '../utils/puppeteer.js';
  6. const hack = async (page) => {
  7. // HACK: fixes issue with tables on GitHub Actions
  8. if (Boolean(process.env.CI)) {
  9. await page.addStyleTag({ content: 'table { margin-left: 4px; }' });
  10. }
  11. };
  12. it('should position popper on right when reference is in table', async () => {
  13. const page = await browser.newPage();
  14. await page.goto(`${TEST_URL}/table/basic.html`);
  15. await hack(page);
  16. await scroll(page, 'html', 100);
  17. expect(await screenshot(page)).toMatchImageSnapshot();
  18. });
  19. it('should position popper on right when reference and popper are in table', async () => {
  20. const page = await browser.newPage();
  21. await page.goto(`${TEST_URL}/table/same.html`);
  22. await hack(page);
  23. await scroll(page, 'html', 100);
  24. expect(await screenshot(page)).toMatchImageSnapshot();
  25. });
  26. it('should position popper on right when reference is in table inside offsetParents', async () => {
  27. const page = await browser.newPage();
  28. await page.goto(`${TEST_URL}/table/offset-parent.html`);
  29. await hack(page);
  30. await scroll(page, 'html', 100);
  31. expect(await screenshot(page)).toMatchImageSnapshot();
  32. });
  33. it('should position popper on right when reference and popper are in table inside offsetParents', async () => {
  34. const page = await browser.newPage();
  35. await page.goto(`${TEST_URL}/table/same-offset-parent.html`);
  36. await hack(page);
  37. await scroll(page, 'html', 100);
  38. expect(await screenshot(page)).toMatchImageSnapshot();
  39. });
  40. it('should position popper on right #1124', async () => {
  41. const page = await browser.newPage();
  42. await page.goto(`${TEST_URL}/table/offset-parent-2.html`);
  43. expect(await screenshot(page)).toMatchImageSnapshot();
  44. });