Skip to content

Commit

Permalink
fix: test failing possibly caused by lazy loaded iframes?
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelmaddock committed May 22, 2021
1 parent bc69d7b commit 541a9a3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
14 changes: 2 additions & 12 deletions spec-main/api-web-contents-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2058,25 +2058,15 @@ describe('webContents module', () => {

describe('frame-dom-ready event', () => {
it('emits for top-level frame', async () => {
const w = new BrowserWindow({
show: false,
webPreferences: {
sandbox: true
}
});
const w = new BrowserWindow({ show: false });
const promise = emittedOnce(w.webContents, 'frame-dom-ready');
w.webContents.loadURL('about:blank');
const [, frame] = await promise;
expect(frame).to.equal(w.webContents.mainFrame);
});

it('emits for sub frame', async () => {
const w = new BrowserWindow({
show: false,
webPreferences: {
sandbox: true
}
});
const w = new BrowserWindow({ show: false });
const promise = new Promise<void>(resolve => {
w.webContents.on('frame-dom-ready', (e, frame) => {
if (frame.name === 'frameA') {
Expand Down
2 changes: 1 addition & 1 deletion spec-main/fixtures/sub-frames/frame-with-frame.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
</head>
<body>
This is a frame, is has one child
<iframe src="./frame.html" name="frameA"></iframe>
<iframe src="./frame.html" name="frameA" loading="eager"></iframe>
</body>
</html>

0 comments on commit 541a9a3

Please sign in to comment.