From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- .../test/puppeteer/test-d/ElementHandle.test-d.ts | 1024 ++++++++++++++++++++ 1 file changed, 1024 insertions(+) create mode 100644 remote/test/puppeteer/test-d/ElementHandle.test-d.ts (limited to 'remote/test/puppeteer/test-d/ElementHandle.test-d.ts') diff --git a/remote/test/puppeteer/test-d/ElementHandle.test-d.ts b/remote/test/puppeteer/test-d/ElementHandle.test-d.ts new file mode 100644 index 0000000000..e23e66678c --- /dev/null +++ b/remote/test/puppeteer/test-d/ElementHandle.test-d.ts @@ -0,0 +1,1024 @@ +import {ElementHandle} from 'puppeteer'; +import {expectNotType, expectType} from 'tsd'; + +declare const handle: ElementHandle; + +{ + { + { + expectType | null>(await handle.$('a')); + expectNotType | null>(await handle.$('a')); + } + { + expectType | null>( + await handle.$('a#id') + ); + expectNotType | null>(await handle.$('a#id')); + } + { + expectType | null>( + await handle.$('a.class') + ); + expectNotType | null>(await handle.$('a.class')); + } + { + expectType | null>( + await handle.$('a[attr=value]') + ); + expectNotType | null>( + await handle.$('a[attr=value]') + ); + } + { + expectType | null>( + await handle.$('a:psuedo-class') + ); + expectNotType | null>( + await handle.$('a:pseudo-class') + ); + } + { + expectType | null>( + await handle.$('a:func(arg)') + ); + expectNotType | null>( + await handle.$('a:func(arg)') + ); + } + } + { + { + expectType | null>(await handle.$('div')); + expectNotType | null>(await handle.$('div')); + } + { + expectType | null>( + await handle.$('div#id') + ); + expectNotType | null>(await handle.$('div#id')); + } + { + expectType | null>( + await handle.$('div.class') + ); + expectNotType | null>(await handle.$('div.class')); + } + { + expectType | null>( + await handle.$('div[attr=value]') + ); + expectNotType | null>( + await handle.$('div[attr=value]') + ); + } + { + expectType | null>( + await handle.$('div:psuedo-class') + ); + expectNotType | null>( + await handle.$('div:pseudo-class') + ); + } + { + expectType | null>( + await handle.$('div:func(arg)') + ); + expectNotType | null>( + await handle.$('div:func(arg)') + ); + } + } + { + { + expectType | null>(await handle.$('some-custom')); + } + { + expectType | null>( + await handle.$('some-custom#id') + ); + } + { + expectType | null>( + await handle.$('some-custom.class') + ); + } + { + expectType | null>( + await handle.$('some-custom[attr=value]') + ); + } + { + expectType | null>( + await handle.$('some-custom:pseudo-class') + ); + } + { + expectType | null>( + await handle.$('some-custom:func(arg)') + ); + } + } + { + { + expectType | null>(await handle.$('')); + } + { + expectType | null>(await handle.$('#id')); + } + { + expectType | null>(await handle.$('.class')); + } + { + expectType | null>(await handle.$('[attr=value]')); + } + { + expectType | null>( + await handle.$(':pseudo-class') + ); + } + { + expectType | null>(await handle.$(':func(arg)')); + } + } + { + { + expectType | null>( + await handle.$('div > a') + ); + expectNotType | null>(await handle.$('div > a')); + } + { + expectType | null>( + await handle.$('div > a#id') + ); + expectNotType | null>( + await handle.$('div > a#id') + ); + } + { + expectType | null>( + await handle.$('div > a.class') + ); + expectNotType | null>( + await handle.$('div > a.class') + ); + } + { + expectType | null>( + await handle.$('div > a[attr=value]') + ); + expectNotType | null>( + await handle.$('div > a[attr=value]') + ); + } + { + expectType | null>( + await handle.$('div > a:psuedo-class') + ); + expectNotType | null>( + await handle.$('div > a:pseudo-class') + ); + } + { + expectType | null>( + await handle.$('div > a:func(arg)') + ); + expectNotType | null>( + await handle.$('div > a:func(arg)') + ); + } + } + { + { + expectType | null>( + await handle.$('div > div') + ); + expectNotType | null>(await handle.$('div > div')); + } + { + expectType | null>( + await handle.$('div > div#id') + ); + expectNotType | null>( + await handle.$('div > div#id') + ); + } + { + expectType | null>( + await handle.$('div > div.class') + ); + expectNotType | null>( + await handle.$('div > div.class') + ); + } + { + expectType | null>( + await handle.$('div > div[attr=value]') + ); + expectNotType | null>( + await handle.$('div > div[attr=value]') + ); + } + { + expectType | null>( + await handle.$('div > div:psuedo-class') + ); + expectNotType | null>( + await handle.$('div > div:pseudo-class') + ); + } + { + expectType | null>( + await handle.$('div > div:func(arg)') + ); + expectNotType | null>( + await handle.$('div > div:func(arg)') + ); + } + } + { + { + expectType | null>( + await handle.$('div > some-custom') + ); + } + { + expectType | null>( + await handle.$('div > some-custom#id') + ); + } + { + expectType | null>( + await handle.$('div > some-custom.class') + ); + } + { + expectType | null>( + await handle.$('div > some-custom[attr=value]') + ); + } + { + expectType | null>( + await handle.$('div > some-custom:pseudo-class') + ); + } + { + expectType | null>( + await handle.$('div > some-custom:func(arg)') + ); + } + } + { + { + expectType | null>(await handle.$('div > #id')); + } + { + expectType | null>(await handle.$('div > .class')); + } + { + expectType | null>( + await handle.$('div > [attr=value]') + ); + } + { + expectType | null>( + await handle.$('div > :pseudo-class') + ); + } + { + expectType | null>( + await handle.$('div > :func(arg)') + ); + } + } + { + { + expectType | null>( + await handle.$('div > a') + ); + expectNotType | null>(await handle.$('div > a')); + } + { + expectType | null>( + await handle.$('div > a#id') + ); + expectNotType | null>( + await handle.$('div > a#id') + ); + } + { + expectType | null>( + await handle.$('div > a.class') + ); + expectNotType | null>( + await handle.$('div > a.class') + ); + } + { + expectType | null>( + await handle.$('div > a[attr=value]') + ); + expectNotType | null>( + await handle.$('div > a[attr=value]') + ); + } + { + expectType | null>( + await handle.$('div > a:psuedo-class') + ); + expectNotType | null>( + await handle.$('div > a:pseudo-class') + ); + } + { + expectType | null>( + await handle.$('div > a:func(arg)') + ); + expectNotType | null>( + await handle.$('div > a:func(arg)') + ); + } + } + { + { + expectType | null>( + await handle.$('div > div') + ); + expectNotType | null>(await handle.$('div > div')); + } + { + expectType | null>( + await handle.$('div > div#id') + ); + expectNotType | null>( + await handle.$('div > div#id') + ); + } + { + expectType | null>( + await handle.$('div > div.class') + ); + expectNotType | null>( + await handle.$('div > div.class') + ); + } + { + expectType | null>( + await handle.$('div > div[attr=value]') + ); + expectNotType | null>( + await handle.$('div > div[attr=value]') + ); + } + { + expectType | null>( + await handle.$('div > div:psuedo-class') + ); + expectNotType | null>( + await handle.$('div > div:pseudo-class') + ); + } + { + expectType | null>( + await handle.$('div > div:func(arg)') + ); + expectNotType | null>( + await handle.$('div > div:func(arg)') + ); + } + } + { + { + expectType | null>( + await handle.$('div > some-custom') + ); + } + { + expectType | null>( + await handle.$('div > some-custom#id') + ); + } + { + expectType | null>( + await handle.$('div > some-custom.class') + ); + } + { + expectType | null>( + await handle.$('div > some-custom[attr=value]') + ); + } + { + expectType | null>( + await handle.$('div > some-custom:pseudo-class') + ); + } + { + expectType | null>( + await handle.$('div > some-custom:func(arg)') + ); + } + } + { + { + expectType | null>(await handle.$('div > #id')); + } + { + expectType | null>(await handle.$('div > .class')); + } + { + expectType | null>( + await handle.$('div > [attr=value]') + ); + } + { + expectType | null>( + await handle.$('div > :pseudo-class') + ); + } + { + expectType | null>( + await handle.$('div > :func(arg)') + ); + } + } +} + +{ + { + { + expectType>>(await handle.$$('a')); + expectNotType>>(await handle.$$('a')); + } + { + expectType>>( + await handle.$$('a#id') + ); + expectNotType>>(await handle.$$('a#id')); + } + { + expectType>>( + await handle.$$('a.class') + ); + expectNotType>>(await handle.$$('a.class')); + } + { + expectType>>( + await handle.$$('a[attr=value]') + ); + expectNotType>>( + await handle.$$('a[attr=value]') + ); + } + { + expectType>>( + await handle.$$('a:psuedo-class') + ); + expectNotType>>( + await handle.$$('a:pseudo-class') + ); + } + { + expectType>>( + await handle.$$('a:func(arg)') + ); + expectNotType>>( + await handle.$$('a:func(arg)') + ); + } + } + { + { + expectType>>(await handle.$$('div')); + expectNotType>>(await handle.$$('div')); + } + { + expectType>>( + await handle.$$('div#id') + ); + expectNotType>>(await handle.$$('div#id')); + } + { + expectType>>( + await handle.$$('div.class') + ); + expectNotType>>( + await handle.$$('div.class') + ); + } + { + expectType>>( + await handle.$$('div[attr=value]') + ); + expectNotType>>( + await handle.$$('div[attr=value]') + ); + } + { + expectType>>( + await handle.$$('div:psuedo-class') + ); + expectNotType>>( + await handle.$$('div:pseudo-class') + ); + } + { + expectType>>( + await handle.$$('div:func(arg)') + ); + expectNotType>>( + await handle.$$('div:func(arg)') + ); + } + } + { + { + expectType>>(await handle.$$('some-custom')); + } + { + expectType>>( + await handle.$$('some-custom#id') + ); + } + { + expectType>>( + await handle.$$('some-custom.class') + ); + } + { + expectType>>( + await handle.$$('some-custom[attr=value]') + ); + } + { + expectType>>( + await handle.$$('some-custom:pseudo-class') + ); + } + { + expectType>>( + await handle.$$('some-custom:func(arg)') + ); + } + } + { + { + expectType>>(await handle.$$('')); + } + { + expectType>>(await handle.$$('#id')); + } + { + expectType>>(await handle.$$('.class')); + } + { + expectType>>( + await handle.$$('[attr=value]') + ); + } + { + expectType>>( + await handle.$$(':pseudo-class') + ); + } + { + expectType>>(await handle.$$(':func(arg)')); + } + } + { + { + expectType>>( + await handle.$$('div > a') + ); + expectNotType>>(await handle.$$('div > a')); + } + { + expectType>>( + await handle.$$('div > a#id') + ); + expectNotType>>( + await handle.$$('div > a#id') + ); + } + { + expectType>>( + await handle.$$('div > a.class') + ); + expectNotType>>( + await handle.$$('div > a.class') + ); + } + { + expectType>>( + await handle.$$('div > a[attr=value]') + ); + expectNotType>>( + await handle.$$('div > a[attr=value]') + ); + } + { + expectType>>( + await handle.$$('div > a:psuedo-class') + ); + expectNotType>>( + await handle.$$('div > a:pseudo-class') + ); + } + { + expectType>>( + await handle.$$('div > a:func(arg)') + ); + expectNotType>>( + await handle.$$('div > a:func(arg)') + ); + } + } + { + { + expectType>>( + await handle.$$('div > div') + ); + expectNotType>>( + await handle.$$('div > div') + ); + } + { + expectType>>( + await handle.$$('div > div#id') + ); + expectNotType>>( + await handle.$$('div > div#id') + ); + } + { + expectType>>( + await handle.$$('div > div.class') + ); + expectNotType>>( + await handle.$$('div > div.class') + ); + } + { + expectType>>( + await handle.$$('div > div[attr=value]') + ); + expectNotType>>( + await handle.$$('div > div[attr=value]') + ); + } + { + expectType>>( + await handle.$$('div > div:psuedo-class') + ); + expectNotType>>( + await handle.$$('div > div:pseudo-class') + ); + } + { + expectType>>( + await handle.$$('div > div:func(arg)') + ); + expectNotType>>( + await handle.$$('div > div:func(arg)') + ); + } + } + { + { + expectType>>( + await handle.$$('div > some-custom') + ); + } + { + expectType>>( + await handle.$$('div > some-custom#id') + ); + } + { + expectType>>( + await handle.$$('div > some-custom.class') + ); + } + { + expectType>>( + await handle.$$('div > some-custom[attr=value]') + ); + } + { + expectType>>( + await handle.$$('div > some-custom:pseudo-class') + ); + } + { + expectType>>( + await handle.$$('div > some-custom:func(arg)') + ); + } + } + { + { + expectType>>(await handle.$$('div > #id')); + } + { + expectType>>( + await handle.$$('div > .class') + ); + } + { + expectType>>( + await handle.$$('div > [attr=value]') + ); + } + { + expectType>>( + await handle.$$('div > :pseudo-class') + ); + } + { + expectType>>( + await handle.$$('div > :func(arg)') + ); + } + } + { + { + expectType>>( + await handle.$$('div > a') + ); + expectNotType>>(await handle.$$('div > a')); + } + { + expectType>>( + await handle.$$('div > a#id') + ); + expectNotType>>( + await handle.$$('div > a#id') + ); + } + { + expectType>>( + await handle.$$('div > a.class') + ); + expectNotType>>( + await handle.$$('div > a.class') + ); + } + { + expectType>>( + await handle.$$('div > a[attr=value]') + ); + expectNotType>>( + await handle.$$('div > a[attr=value]') + ); + } + { + expectType>>( + await handle.$$('div > a:psuedo-class') + ); + expectNotType>>( + await handle.$$('div > a:pseudo-class') + ); + } + { + expectType>>( + await handle.$$('div > a:func(arg)') + ); + expectNotType>>( + await handle.$$('div > a:func(arg)') + ); + } + } + { + { + expectType>>( + await handle.$$('div > div') + ); + expectNotType>>( + await handle.$$('div > div') + ); + } + { + expectType>>( + await handle.$$('div > div#id') + ); + expectNotType>>( + await handle.$$('div > div#id') + ); + } + { + expectType>>( + await handle.$$('div > div.class') + ); + expectNotType>>( + await handle.$$('div > div.class') + ); + } + { + expectType>>( + await handle.$$('div > div[attr=value]') + ); + expectNotType>>( + await handle.$$('div > div[attr=value]') + ); + } + { + expectType>>( + await handle.$$('div > div:psuedo-class') + ); + expectNotType>>( + await handle.$$('div > div:pseudo-class') + ); + } + { + expectType>>( + await handle.$$('div > div:func(arg)') + ); + expectNotType>>( + await handle.$$('div > div:func(arg)') + ); + } + } + { + { + expectType>>( + await handle.$$('div > some-custom') + ); + } + { + expectType>>( + await handle.$$('div > some-custom#id') + ); + } + { + expectType>>( + await handle.$$('div > some-custom.class') + ); + } + { + expectType>>( + await handle.$$('div > some-custom[attr=value]') + ); + } + { + expectType>>( + await handle.$$('div > some-custom:pseudo-class') + ); + } + { + expectType>>( + await handle.$$('div > some-custom:func(arg)') + ); + } + } + { + { + expectType>>(await handle.$$('div > #id')); + } + { + expectType>>( + await handle.$$('div > .class') + ); + } + { + expectType>>( + await handle.$$('div > [attr=value]') + ); + } + { + expectType>>( + await handle.$$('div > :pseudo-class') + ); + } + { + expectType>>( + await handle.$$('div > :func(arg)') + ); + } + } +} + +{ + expectType( + await handle.$eval( + 'a', + (element, int) => { + expectType(element); + expectType(int); + }, + 1 + ) + ); + expectType( + await handle.$eval( + 'div', + (element, int, str) => { + expectType(element); + expectType(int); + expectType(str); + }, + 1, + '' + ) + ); + expectType( + await handle.$eval( + 'a', + (element, value) => { + expectType(element); + return value; + }, + 1 + ) + ); + expectType( + await handle.$eval( + 'some-element', + (element, value) => { + expectType(element); + return value; + }, + 1 + ) + ); + expectType( + await handle.$eval('a', element => { + return element; + }) + ); + expectType(await handle.$eval('a', 'document')); +} + +{ + expectType( + await handle.$$eval( + 'a', + (elements, int) => { + expectType(elements); + expectType(int); + }, + 1 + ) + ); + expectType( + await handle.$$eval( + 'div', + (elements, int, str) => { + expectType(elements); + expectType(int); + expectType(str); + }, + 1, + '' + ) + ); + expectType( + await handle.$$eval( + 'a', + (elements, value) => { + expectType(elements); + return value; + }, + 1 + ) + ); + expectType( + await handle.$$eval( + 'some-element', + (elements, value) => { + expectType(elements); + return value; + }, + 1 + ) + ); + expectType( + await handle.$$eval('a', elements => { + return elements; + }) + ); + expectType(await handle.$$eval('a', 'document')); +} + +{ + { + expectType | null>( + await handle.waitForSelector('a') + ); + expectNotType | null>( + await handle.waitForSelector('a') + ); + } + { + expectType | null>( + await handle.waitForSelector('div') + ); + expectNotType | null>( + await handle.waitForSelector('div') + ); + } + { + expectType | null>( + await handle.waitForSelector('some-custom') + ); + } +} -- cgit v1.2.3