value-class-pattern-tests

From Microformats Wiki
Revision as of 05:44, 17 April 2009 by BenWard (talk | contribs) (Break test cases out into separate page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

We require a thorough test-suite for the value-class-pattern, but in the interim, here is an incomplete test suite:

Conforming value-title Tests

One

<p class='tel'>My 
    <span class='type'>
        <span class='value-title' title='cell'> </span>mobile
    </span> phone number is <span class='value'>+44 1245 333 333</span>
</p>

Result

TEL
    TYPE = cell
    VALUE = +44 1245 333 333

Two

<p class='vevent'>
    My <span class='summary'>Birthday Party</span> will be held
    <span class='dtstart'>
        <span class='value-title' title='2009-04-01'>tomorrow</span>
    </span>
    and last until 
    <span class='dtend'>
        <span class='value-title' title='2009-04-05'> </span>
        the following Tuesday (April 5th)
    </span>.
</p>

Result

VEVENT
    SUMMARY = Birthday Party
    DTSTART = 2009-04-01
    DTEND = 2009-04-05

Tests of Non-Conforming value-title Code

One

In this case, the human text appears before the value-title element, so the machine-data value has a weaker association with the property declaration. The likelihood of the data not being maintained correctly — the data value being ignored by an editor — is increased.

<p class='tel'>My 
    <span class='type'>
        mobile
        <span class='value-title' title='cell'> </span>
    </span> phone number is <span class='value'>+44 1245 333 333</span>
</p>

Result

TEL
    TYPE = none/default/unknown ('mobile' is unknown in hCard)
    VALUE = +44 1245 333 333

Two

In this case, the value-title element is used for a property that is not valid for use with this pattern.

<p class='vevent'>You are invited to
    <span class='summary'>
        <span class='value-title' title='FooCamp'> </span>
        BarCamp
    </span>

Result

VEVENT
    SUMMARY = BarCamp