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