[mozilla-readability] remove deprecated code (Node global in tests and uri parameter) (#29701)

* [@types/mozilla-readability] Remove uri because it's not used anymore

* [@types/mozilla-readability] remove deprecated Node global in tests
This commit is contained in:
MusiKid
2018-10-15 09:43:04 -07:00
committed by Sheetal Nandi
parent f962dce1d2
commit 3ad372f36c
2 changed files with 4 additions and 30 deletions
+1 -10
View File
@@ -7,21 +7,13 @@
export = Readability;
declare class Readability {
constructor(uri: Readability.Uri, doc: Document, options?: Readability.Options);
constructor(doc: Document, options?: Readability.Options);
parse(): Readability.ParseResult;
isProbablyReaderable(helperIsVisible?: (node: any) => boolean): boolean;
}
declare namespace Readability {
interface Uri {
spec: string;
host: string;
prePath: string;
scheme: string;
pathBase: string;
}
interface Options {
debug?: boolean;
maxElemsToParse?: number;
@@ -31,7 +23,6 @@ declare namespace Readability {
}
interface ParseResult {
uri: Uri;
title: string;
byline: string;
dir: string;
@@ -5,42 +5,25 @@ import { JSDOM } from 'jsdom';
// because issue https://github.com/mozilla/readability/issues/346
// requires global variable `Node` when using nodejs.
const fakeUri: Readability.Uri = {
spec: "http://fakehost/test/page.html",
host: "fakehost",
prePath: "http://fakehost",
scheme: "http",
pathBase: "http://fakehost/test/"
};
function test_basic_usage() {
const dom = new JSDOM(`<p>Hello</p><p><strong>Hi!</strong>`);
// Required until https://github.com/mozilla/readability/issues/346
// is fixed.
Node = dom.window.Node;
const reader = new Readability(fakeUri, dom.window.document);
const reader = new Readability(dom.window.document);
const article = reader.parse();
}
function test_readability_with_options() {
const dom = new JSDOM(`<p>Hello</p><p><strong>Hi!</strong>`);
// Required until https://github.com/mozilla/readability/issues/346
// is fixed.
Node = dom.window.Node;
const options: Readability.Options = {
debug: true,
maxElemsToParse: 100,
};
const article = new Readability(fakeUri, dom.window.document, options).parse();
const article = new Readability(dom.window.document, options).parse();
}
function test_is_probably_readerable() {
const dom = new JSDOM(`<p>Hello</p><p><strong>Hi!</strong>`);
// Required until https://github.com/mozilla/readability/issues/346
// is fixed.
Node = dom.window.Node;
const isReadable = new Readability(fakeUri, dom.window.document).isProbablyReaderable();
const isReadable = new Readability(dom.window.document).isProbablyReaderable();
}