From 3ad372f36cb76c00ae2773bb161ffae0d631a158 Mon Sep 17 00:00:00 2001 From: MusiKid <12956751+MusiKid@users.noreply.github.com> Date: Mon, 15 Oct 2018 18:43:04 +0200 Subject: [PATCH] [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 --- types/mozilla-readability/index.d.ts | 11 +-------- .../mozilla-readability-tests.ts | 23 +++---------------- 2 files changed, 4 insertions(+), 30 deletions(-) diff --git a/types/mozilla-readability/index.d.ts b/types/mozilla-readability/index.d.ts index a30925fb0b..7a7c26fdb8 100644 --- a/types/mozilla-readability/index.d.ts +++ b/types/mozilla-readability/index.d.ts @@ -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; diff --git a/types/mozilla-readability/mozilla-readability-tests.ts b/types/mozilla-readability/mozilla-readability-tests.ts index e5431dd14e..0dec719559 100644 --- a/types/mozilla-readability/mozilla-readability-tests.ts +++ b/types/mozilla-readability/mozilla-readability-tests.ts @@ -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(`
Hello
Hi!`); - // 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(`
Hello
Hi!`); - // 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(`
Hello
Hi!`); - // 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(); }