Use a hard coded classesToPreserve in tests.

This commit is contained in:
Cameron McCormack 2017-11-21 11:49:52 +08:00 committed by Gijs
parent 6729538c77
commit d88c9afc63

View File

@ -58,7 +58,9 @@ function runTestsWithItems(label, domGenerationFn, uri, source, expectedContent,
before(function() { before(function() {
try { try {
var doc = domGenerationFn(source); var doc = domGenerationFn(source);
var myReader = new Readability(uri, doc); // Provide one class name to preserve, which we know appears in a few
// of the test documents.
var myReader = new Readability(uri, doc, { classesToPreserve: ["caption"] });
// Needs querySelectorAll function to test isProbablyReaderable method. // Needs querySelectorAll function to test isProbablyReaderable method.
// jsdom implements querySelector but JSDOMParser doesn't. // jsdom implements querySelector but JSDOMParser doesn't.
var readerable = label === "jsdom" ? myReader.isProbablyReaderable() : null; var readerable = label === "jsdom" ? myReader.isProbablyReaderable() : null;