diff --git a/lib/checks/color/color-contrast.js b/lib/checks/color/color-contrast.js index b59a49103d..349eb8e0b1 100644 --- a/lib/checks/color/color-contrast.js +++ b/lib/checks/color/color-contrast.js @@ -41,14 +41,14 @@ var data = { this.data(data); -if (!cr.isValid || equalRatio) { - this.relatedNodes(bgNodes); -} - //We don't know, so we'll put it into Can't Tell if (fgColor === null || bgColor === null || equalRatio) { missing = null; axe.commons.color.incompleteData.clear(); + this.relatedNodes(bgNodes); return undefined; + +} else if (!cr.isValid) { + this.relatedNodes(bgNodes); } return cr.isValid; diff --git a/lib/checks/color/link-in-text-block.js b/lib/checks/color/link-in-text-block.js index f91a49c485..8bcf7eddae 100644 --- a/lib/checks/color/link-in-text-block.js +++ b/lib/checks/color/link-in-text-block.js @@ -24,6 +24,8 @@ while (parentBlock.nodeType === 1 && !isBlock(parentBlock)) { parentBlock = parentBlock.parentNode; } +this.relatedNodes([ parentBlock ]); + // TODO: Check the :visited state of the link if (color.elementIsDistinct(node, parentBlock)) { return true; diff --git a/test/checks/color/color-contrast.js b/test/checks/color/color-contrast.js index 82b9ab56e2..340dd3c2f6 100644 --- a/test/checks/color/color-contrast.js +++ b/test/checks/color/color-contrast.js @@ -212,4 +212,23 @@ describe('color-contrast', function () { assert.equal(checkContext._data.missingData, 'equalRatio'); assert.equal(checkContext._data.contrastRatio, 1); }); + + it('returns relatedNodes with undefined', function () { + var dataURI = 'data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/' + + 'XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkA' + + 'ABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKU' + + 'E1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7'; + + fixture.innerHTML = '
Text 1
' + + '