From 246440b139650f9f027d49eb64568335d9023356 Mon Sep 17 00:00:00 2001 From: Tim Hart Date: Thu, 23 Jul 2015 22:22:38 -0700 Subject: [PATCH] Fixed issue with space separated rel attributes --- lib/checks/check-pagination.js | 6 +++--- lib/checks/check-preload.js | 8 ++++---- static/pagination-5.html | 13 +++++++++++++ test/pagination_test.js | 5 ++++- 4 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 static/pagination-5.html diff --git a/lib/checks/check-pagination.js b/lib/checks/check-pagination.js index 3a0bd7f..07acc47 100644 --- a/lib/checks/check-pagination.js +++ b/lib/checks/check-pagination.js @@ -22,8 +22,8 @@ var check = function (website) { var deferred = new Deferred(); process.nextTick(function(){ - var next = website.$('link[rel="next"]'), - prev = website.$('link[rel="prev"]'), + var next = website.$('link[rel~="next"]'), + prev = website.$('link[rel~="prev"]'), test = { testName:"pagination", passed:false, @@ -40,4 +40,4 @@ var check = function (website) { return deferred.promise; }; -module.exports.check = check; \ No newline at end of file +module.exports.check = check; diff --git a/lib/checks/check-preload.js b/lib/checks/check-preload.js index b0bf316..a68ca74 100644 --- a/lib/checks/check-preload.js +++ b/lib/checks/check-preload.js @@ -22,9 +22,9 @@ var Deferred = require('promised-io').Deferred; var check = function (website) { var deferred = new Deferred(); process.nextTick(function () { - var prefetch = website.$('link[rel="prefetch"]'), - dnsPrerender = website.$('link[rel="dns-prefetch"]'), - prerender = website.$('link[rel="prerender"]'), + var prefetch = website.$('link[rel~="prefetch"]'), + dnsPrerender = website.$('link[rel~="dns-prefetch"]'), + prerender = website.$('link[rel~="prerender"]'), test = { testName: "prefetch", passed: false, @@ -56,4 +56,4 @@ var check = function (website) { return deferred.promise; }; -module.exports.check = check; \ No newline at end of file +module.exports.check = check; diff --git a/static/pagination-5.html b/static/pagination-5.html new file mode 100644 index 0000000..8a5fa26 --- /dev/null +++ b/static/pagination-5.html @@ -0,0 +1,13 @@ + + + + + Pagination + + + + +

Pagination next with prefetch

+

Expected result: passes

+ + diff --git a/test/pagination_test.js b/test/pagination_test.js index 1475759..9d1d058 100644 --- a/test/pagination_test.js +++ b/test/pagination_test.js @@ -69,5 +69,8 @@ module.exports['Pagination'] = { }), 'Pagination - Prev/Next': checkPage('4.html', { passed: true + }), + 'Pagination - Next with prefetch': checkPage('5.html', { + passed: true }) -}; \ No newline at end of file +};