value-class-pattern-tests

From Microformats Wiki
Revision as of 19:21, 16 November 2012 by Tantek (talk | contribs) (→‎inline examples from Microformation: to do value-title test pages)
Jump to navigation Jump to search

With the goal of developing a thorough test-suite for the value-class-pattern, here are some test cases:

test cases

The following value-class-pattern test cases have been developed (all of which use the test-fixture poshformat for easier extraction).

Date and time values

Main article: value-class-date-time-tests

Parsing value from a title attribute

  • ...

inline development tests

Here are inline tests developed during the development and design of the value-class-pattern. Each of those tests needs to be updated as follows:

  1. move to a separate page (one test per page), similar to the format used by value-dt-test-YYYY-MM-DD--HH-MM.
  2. mark up using the test-fixture poshformat.
  3. "Result" at a minimum converted from abstract hierarchical text properties/values to an vCard and/or iCalendar expected result block.
  4. linked to from the previous section.

Please help the value class pattern testing, development, and implementation effort by updating the following tests accordingly:

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>
</p>

Result

VEVENT
    SUMMARY = BarCamp

inline examples from Microformation

Here are inline examples published by Jeremy Keith in his blog post Microformation.

to do value-title test pages

Each of the examples below needs to be updated as follows:

  1. move to a separate page (one test per page), similar to the format used by value-dt-test-YYYY-MM-DD--HH-MM.
  2. construct a complete hCalendar event that uses inline dtstart example
  3. mark up using the test-fixture poshformat.
  4. document "Result" at a minimum as an iCalendar expected result block.
  5. linked to from the appropriate section at the top of this page.

Please help the value class pattern testing, development, and implementation effort by creating separate test case pages for each of the following examples.

value title with contents

<span class="dtstart">
 <span class="value-title" title="2009-06-05T20:00:00">
  Friday, June 5th at 8pm
 </span>
</span>

separate value title date and time

Not sure if this is actually allowed by the value-class-pattern, but we should write up a test case regardless, to see what implementations do. Tantek

<span class="dtstart">
 <span class="value-title" title="2009-06-05">
  Friday, June 5th
 </span>
 at
 <span class="value-title" title="20:00">
  8pm
 </span>
</span>

value title span with empty content

<span class="dtstart">
 <span class="value-title" title="2009-06-05T20:00:00"> </span>
 Friday, June 5th at 8pm
</span>

see also