Difference between revisions of "value-dt-test-abbr-YYYY-MM-DD-abbr-HH-MM"

From Microformats Wiki
Jump to navigation Jump to search
(→‎results: verified that X2V 0.9.3 passes this test.)
(Added test-fixture asserts)
Line 5: Line 5:
 
:<span class="author vcard"><span class="fn">[[User:Tantek|Tantek Çelik]]</span></span>
 
:<span class="author vcard"><span class="fn">[[User:Tantek|Tantek Çelik]]</span></span>
  
<div class="description">
+
 
<div class="summary">
 
 
== testing ==
 
== testing ==
 +
<span class="description">The <span class="summary">value-dt-test-abbr-YYYY-MM-DD-abbr-HH-MM</span> test demonstrate the concatenation of two abbr title attributes to create one datetime value:</span>
 +
 
[[value-class-pattern]] date and time parsing:
 
[[value-class-pattern]] date and time parsing:
 
* YYYY-MM-DD in <code>abbr</code> element <code>title</code> attribute, with locale/language-specific contents
 
* YYYY-MM-DD in <code>abbr</code> element <code>title</code> attribute, with locale/language-specific contents
Line 13: Line 14:
 
in an <span class="format">[[hCalendar]]</span> event.
 
in an <span class="format">[[hCalendar]]</span> event.
  
</div> <!-- summary -->
+
 
  
 
== markup pattern ==
 
== markup pattern ==
Line 30: Line 31:
 
</source>
 
</source>
  
</div> <!-- description -->
 
  
 
== test ==
 
== test ==
Line 77: Line 77:
 
DTSTART:20090605T200000
 
DTSTART:20090605T200000
 
</source>
 
</source>
 +
 +
== Asserts ==
 +
 +
<table cellpadding="0" cellspacing="0" summary="Testing framework assertions used to test the parsed data against the expected data.">
 +
  <caption>A set of programming tests for xUnit testing frameworks</caption> 
 +
        <tr>
 +
            <th>Test</th>
 +
            <th>Result</th>
 +
            <th>Comment</th>
 +
        </tr>
 +
        <tr class="assert">
 +
            <td class="test">vevent[0].dtstart</td>
 +
            <td class="result">IsEqualToISODate("2009-06-05T20:00")</td>
 +
            <td class="comment">With the value class pattern the results should contain a date and time</td>
 +
        </tr>       
 +
</table>
 +
  
 
== results ==
 
== results ==

Revision as of 14:46, 4 November 2009

One of several value class pattern date and time value test cases. Marked up with the Test Fixture poshformats.

author
Tantek Çelik


testing

The value-dt-test-abbr-YYYY-MM-DD-abbr-HH-MM test demonstrate the concatenation of two abbr title attributes to create one datetime value:

Value Class Pattern date and time parsing:

  • YYYY-MM-DD in abbr element title attribute, with locale/language-specific contents
  • HH:MM in abbr element title attribute, with locale/language-specific contents

in an hCalendar 1.0 event.


markup pattern

Here is the markup pattern fragment (escaped, and with abstract not real values) that is being tested:

<span class="dtstart">
  <abbr class="value" title="YYYY-MM-DD">
  day of the week, month, and day
  </abbr> 
  at 
  <abbr class="value" title="HH:MM">
  HHpm
  </abbr>
</span>


test

hCalendar 1.0 test in actual markup on the page (view or edit source to see actual hCalendar markup)

The sample event will take place on Friday, June 5th at 8pm

expected iCalendar output

Here is the expected iCalendar output, omitting optional "X-" properties, and implementation specific "PRODID" property:

BEGIN:VCALENDAR
VERSION:2.0
METHOD:PUBLISH
CALSCALE:GREGORIAN
BEGIN:VEVENT
SUMMARY;LANGUAGE=en;CHARSET=utf-8:sample event
DTSTART;VALUE=DATE-TIME:20090605T200000
END:VEVENT
END:VCALENDAR

The key line that an hCalendar to iCalendar converter must match in order to pass this test:

DTSTART;VALUE=DATE-TIME:20090605T200000

Acceptable variant:

DTSTART:20090605T200000

Asserts

A set of programming tests for xUnit testing frameworks
Test Result Comment
vevent[0].dtstart IsEqualToISODate("2009-06-05T20:00") With the value class pattern the results should contain a date and time


results

derivation

This test was derived from the first example shown after "the following are possible" in Jeremy Keith's blog post Microformation.

see also