diff --git a/src/js/custom/aImgAltNotRepetitive.js b/src/js/custom/aImgAltNotRepetitive.js index 10a6a65b9..ac1561087 100644 --- a/src/js/custom/aImgAltNotRepetitive.js +++ b/src/js/custom/aImgAltNotRepetitive.js @@ -4,7 +4,10 @@ quail.aImgAltNotRepetitive = function(quail, test, Case) { element: this })); var expected = $(this).closest('.quail-test').data('expected'); - if (quail.cleanString($(this).attr('alt')) === quail.cleanString($(this).parent('a').text())) { + var alt = quail.cleanString($(this).attr('alt')); + var linkText = quail.cleanString($(this).closest('a').text()); + + if (alt.length > 0 && linkText.indexOf(alt) !== -1) { _case.set({ 'expected': expected, 'status': 'failed' diff --git a/src/js/custom/pNotUsedAsHeader.js b/src/js/custom/pNotUsedAsHeader.js index 83b6b71be..a7f3447d3 100644 --- a/src/js/custom/pNotUsedAsHeader.js +++ b/src/js/custom/pNotUsedAsHeader.js @@ -11,7 +11,8 @@ quail.pNotUsedAsHeader = function(quail, test, Case) { }); } var failed = false; - if ($(this).text().search('.') < 1) { + // Look for any indication that the paragraph contains at least a full sentence + if ($(this).text().search(/[.!:;]/) < 1) { var $paragraph = $(this), priorParagraph = $paragraph.prev('p'); // Checking if any of suspectPHeaderTags has exact the same text as a paragraph. @@ -40,7 +41,9 @@ quail.pNotUsedAsHeader = function(quail, test, Case) { } }); } - if ($paragraph.css('font-weight') === 'bold') { + + var fontWeight = $paragraph.css('font-weight'); + if (fontWeight === 'bold' || +fontWeight >= 700) { // bold _case.set({ 'status': 'failed' }); diff --git a/test/accessibility-tests/aImgAltNotRepetitive.html b/test/accessibility-tests/aImgAltNotRepetitive.html index 0184edaaf..f3deb65b8 100644 --- a/test/accessibility-tests/aImgAltNotRepetitive.html +++ b/test/accessibility-tests/aImgAltNotRepetitive.html @@ -12,5 +12,18 @@ page1page1 +
+ page1page1 +
+ +
+ page1Go to page1 +
+ +
+ + page1page1 +
+ diff --git a/test/accessibility-tests/pNotUsedAsHeader.html b/test/accessibility-tests/pNotUsedAsHeader.html index c2ebef4e5..4e50bf121 100644 --- a/test/accessibility-tests/pNotUsedAsHeader.html +++ b/test/accessibility-tests/pNotUsedAsHeader.html @@ -58,6 +58,15 @@

+
+

I am a single sentence paragraph!

+
+ +
+ +

This is a regular paragraph

+
+

This is a regular paragraph