mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: update types and test (#12564)
This commit is contained in:
parent
8b2059f82a
commit
33b3cefb83
@ -9,8 +9,7 @@ import type Debug from 'debug';
|
|||||||
import {isNode} from '../environment.js';
|
import {isNode} from '../environment.js';
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
// eslint-disable-next-line no-var
|
const __PUPPETEER_DEBUG: string;
|
||||||
var __PUPPETEER_DEBUG: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -190,11 +190,9 @@ export function bubble<T extends EventType[]>(events?: T) {
|
|||||||
emitter.on('*', handler);
|
emitter.on('*', handler);
|
||||||
set.call(this, emitter);
|
set.call(this, emitter);
|
||||||
},
|
},
|
||||||
// @ts-expect-error -- TypeScript incorrectly types init to require a
|
|
||||||
// return.
|
|
||||||
init(emitter) {
|
init(emitter) {
|
||||||
if (emitter === undefined) {
|
if (emitter === undefined) {
|
||||||
return;
|
return emitter;
|
||||||
}
|
}
|
||||||
const handler = bubbleHandlers.get(this)!.get(events)!;
|
const handler = bubbleHandlers.get(this)!.get(events)!;
|
||||||
|
|
||||||
|
@ -207,14 +207,10 @@ describe('OOPIF', function () {
|
|||||||
);
|
);
|
||||||
const frame = await framePromise;
|
const frame = await framePromise;
|
||||||
await frame.evaluate(() => {
|
await frame.evaluate(() => {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
(window as any)._test = 'Test 123!';
|
||||||
// @ts-expect-error
|
|
||||||
_test = 'Test 123!';
|
|
||||||
});
|
});
|
||||||
const result = await frame.evaluate(() => {
|
const result = await frame.evaluate(() => {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
return (window as any)._test;
|
||||||
// @ts-expect-error
|
|
||||||
return window._test;
|
|
||||||
});
|
});
|
||||||
expect(result).toBe('Test 123!');
|
expect(result).toBe('Test 123!');
|
||||||
});
|
});
|
||||||
|
@ -134,8 +134,11 @@ describe('request interception', function () {
|
|||||||
await cdp.send('DOM.enable');
|
await cdp.send('DOM.enable');
|
||||||
const urls: string[] = [];
|
const urls: string[] = [];
|
||||||
page.on('request', request => {
|
page.on('request', request => {
|
||||||
|
void request.continue();
|
||||||
|
if (isFavicon(request)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
urls.push(request.url());
|
urls.push(request.url());
|
||||||
return request.continue();
|
|
||||||
});
|
});
|
||||||
// This causes network requests without networkId.
|
// This causes network requests without networkId.
|
||||||
await cdp.send('CSS.enable');
|
await cdp.send('CSS.enable');
|
||||||
|
Loading…
Reference in New Issue
Block a user