diff --git a/types/jsdom/index.d.ts b/types/jsdom/index.d.ts index cfb54fa25f..1aa9750fbc 100644 --- a/types/jsdom/index.d.ts +++ b/types/jsdom/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for jsdom 11.0 +// Type definitions for jsdom 11.12 // Project: https://github.com/tmpvar/jsdom#readme // Definitions by: Leonard Thieu +// Johan Palmfjord // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -101,6 +102,20 @@ export type ConstructorOptions = Options & { * Values that are not "text/html" or an XML mime type will throw. It defaults to "text/html". */ contentType?: string; + /** + * jsdom does not have the capability to render visual content, and will act like a headless browser by default. + * It provides hints to web pages through APIs such as document.hidden that their content is not visible. + * + * When the pretendToBeVisual option is set to true, jsdom will pretend that it is rendering and displaying + * content. + */ + pretendToBeVisual?: boolean + /** + * The maximum size in code units for the separate storage areas used by localStorage and sessionStorage. + * Attempts to store data larger than this limit will cause a DOMException to be thrown. By default, it is set + * to 5,000,000 code units per origin, as inspired by the HTML specification. + */ + storageQuota?: number }; export interface DOMWindow extends Window { diff --git a/types/jsdom/jsdom-tests.ts b/types/jsdom/jsdom-tests.ts index 2dbbdca601..da82b2db7c 100644 --- a/types/jsdom/jsdom-tests.ts +++ b/types/jsdom/jsdom-tests.ts @@ -68,6 +68,14 @@ function test_beforeParse() { }); } +function test_storageQuota() { + new JSDOM('', { storageQuota: 1337 }); +} + +function test_pretendToBeVisual() { + new JSDOM('', { pretendToBeVisual: true }); +} + function test_serialize() { const dom = new JSDOM(`hello`);