quailjs/quail — pull request #272 by mlewand (2014-09-16 08:47:14+00:00)
Title: KINGUseLongDateFormat only checks paragraphs

KINGUseLongDateFormat is checked only on paragraphs

# Problem

Currently test **KINGUseLongDateFormat** is performed only on ```p``` elements. There's much more elements to be checked, like ```li```, ```h1-h6```, ```figcaption``` etc.

## Sample TC

Consider following HTML to be checked by the Quail:

```

Short date 12-04-12

Short date 12-04-12

```

**Expected result:**
Quail should produce **2** fialed cases.
First for the ```h1``` element and second for the ```p``` element.

**Current result:**
Quail produces only **1** failed case.
Case is created only for ```p``` element.

## Proposed solution

Solution in pull request will add more elements to be inspected for invalid date pattern.

## Additional notes

While this issue will fix problems like mentioned in Sample TC it will cause other issue. Consider following HTML:

```

Short date 12-04-12

```

With current design it will cause 2 failed cases, instead of 1. That's because KINGUseLongDateFormat is using ```quail.getTextContents()``` on each element matched by main selector.

Since we added ```li``` to the selector, it will perform quail.getTextContents() on both ```li``` and ```p```. Both of these calls will return text containing invalid date.

In order to resolve this problem we should check only text directly in checked node. This fix we'll propose in separate Pull Request.

----

We should also think about adding ```div``` element into this list, but because of a problem mentioned above, I decided to do that later on.

## Complete test

Complete test file is placed in [https://gist.github.com/mlewand/d5674183bf62f6b1c85e gist]. Just put it into quail directory (requires builded Quail, since it uses ```dist```).

Just put it inside main Quail directory, where dist directory is located.