[jquery] Add tests to cover the changed APIs.

This commit is contained in:
Leonard Thieu
2018-06-19 13:56:49 -04:00
parent 9e427aa322
commit f3b10b2269
+22 -8
View File
@@ -17,6 +17,9 @@ function JQueryStatic() {
}
});
// $ExpectType JQuery<HTMLParagraphElement>
$<HTMLParagraphElement>('<p></p>');
// $ExpectType JQuery<HTMLElement>
$('span', new HTMLElement());
@@ -29,20 +32,20 @@ function JQueryStatic() {
// $ExpectType JQuery<HTMLElement>
$('span');
// $ExpectType JQuery<HTMLElement>
$('<p></p>');
// $ExpectType JQuery<SVGLineElement>
$<SVGLineElement>('.mysvgline');
// $ExpectType JQuery<HTMLElement>
$(new HTMLElement());
// $ExpectType JQuery<HTMLParagraphElement>
$(new HTMLParagraphElement());
// $ExpectType JQuery<HTMLElement>
$([new HTMLElement()]);
// $ExpectType JQuery<HTMLParagraphElement>
$([new HTMLParagraphElement()]);
// $ExpectType JQuery<{ foo: string; hello: string; }>
$({ foo: 'bar', hello: 'world' });
// $ExpectType JQuery<HTMLElement>
$($('p'));
// $ExpectType JQuery<SVGSVGElement>
$($(document.createElementNS("http://www.w3.org/2000/svg", "svg")));
// $ExpectType JQuery<HTMLElement>
$(function($) {
@@ -52,9 +55,20 @@ function JQueryStatic() {
$;
});
// $ExpectType JQuery<Element>
$<Element>(function($) {
// $ExpectType Document
this;
// $ExpectType JQueryStatic
$;
});
// $ExpectType JQuery<HTMLElement>
$();
// $ExpectType JQuery<Element>
$<Element>();
// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/19597#issuecomment-378218432
function issue_19597_378218432() {
const myDiv = $(document.createElement('div'));