mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
[jsdom]: Add missing constructor options (#28786)
Please fill in this template. - [x] Use a meaningful title for the pull request. Include the name of the package modified. - [x] Test the change in your own code. (Compile and run.) - [x] Add or edit tests to reflect the change. (Run with `npm test`.) - [x] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#make-a-pull-request). - [x] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#common-mistakes). - [x] Run `npm run lint package-name` (or `tsc` if no `tslint.json` is present). If changing an existing definition: - [x] Provide a URL to documentation or source code which provides context for the suggested changes: https://github.com/jsdom/jsdom/blob/master/lib/api.js#L286-L292 - [ ] ~~Increase the version number in the header if appropriate.~~ - [ ] ~~If you are making substantial changes, consider adding a `tslint.json` containing `{ "extends": "dtslint/dt.json" }`.~~
This commit is contained in:
committed by
Ryan Cavanaugh
parent
a25d5975ef
commit
972309a84a
Vendored
+16
-1
@@ -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 <https://github.com/leonard-thieu>
|
||||
// Johan Palmfjord <https://github.com/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 {
|
||||
|
||||
@@ -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(`<!DOCTYPE html>hello`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user