value-class-pattern-tests: Difference between revisions
(→Two: add close p tag) |
GRegorLove (talk | contribs) m (s/<source>/<syntaxhighlight>/) |
||
(One intermediate revision by one other user not shown) | |||
Line 40: | Line 40: | ||
====One==== | ====One==== | ||
< | <syntaxhighlight lang="html"> | ||
<p class='tel'>My | <p class='tel'>My | ||
<span class='type'> | <span class='type'> | ||
Line 46: | Line 46: | ||
</span> phone number is <span class='value'>+44 1245 333 333</span> | </span> phone number is <span class='value'>+44 1245 333 333</span> | ||
</p> | </p> | ||
</ | </syntaxhighlight> | ||
Result | Result | ||
< | <pre> | ||
TEL | TEL | ||
TYPE = cell | TYPE = cell | ||
VALUE = +44 1245 333 333 | VALUE = +44 1245 333 333 | ||
</ | </pre> | ||
====Two==== | ====Two==== | ||
< | <syntaxhighlight lang="html"> | ||
<p class='vevent'> | <p class='vevent'> | ||
My <span class='summary'>Birthday Party</span> will be held | My <span class='summary'>Birthday Party</span> will be held | ||
Line 70: | Line 70: | ||
</span>. | </span>. | ||
</p> | </p> | ||
</ | </syntaxhighlight> | ||
Result | Result | ||
< | <pre> | ||
VEVENT | VEVENT | ||
SUMMARY = Birthday Party | SUMMARY = Birthday Party | ||
DTSTART = 2009-04-01 | DTSTART = 2009-04-01 | ||
DTEND = 2009-04-05 | DTEND = 2009-04-05 | ||
</ | </pre> | ||
===Tests of Non-Conforming <code>value-title</code> Code=== | ===Tests of Non-Conforming <code>value-title</code> Code=== | ||
Line 87: | Line 87: | ||
In this case, the human text appears before the <code>value-title</code> 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. | In this case, the human text appears before the <code>value-title</code> 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. | ||
< | <syntaxhighlight lang="html"> | ||
<p class='tel'>My | <p class='tel'>My | ||
<span class='type'> | <span class='type'> | ||
Line 94: | Line 94: | ||
</span> phone number is <span class='value'>+44 1245 333 333</span> | </span> phone number is <span class='value'>+44 1245 333 333</span> | ||
</p> | </p> | ||
</ | </syntaxhighlight> | ||
Result | Result | ||
< | <pre> | ||
TEL | TEL | ||
TYPE = none/default/unknown ('mobile' is unknown in hCard) | TYPE = none/default/unknown ('mobile' is unknown in hCard) | ||
VALUE = +44 1245 333 333 | VALUE = +44 1245 333 333 | ||
</ | </pre> | ||
====Two==== | ====Two==== | ||
Line 108: | Line 108: | ||
In this case, the <code>value-title</code> element is used for a property that is not valid for use with this pattern. | In this case, the <code>value-title</code> element is used for a property that is not valid for use with this pattern. | ||
< | <syntaxhighlight lang="html"> | ||
<p class='vevent'>You are invited to | <p class='vevent'>You are invited to | ||
<span class='summary'> | <span class='summary'> | ||
Line 115: | Line 115: | ||
</span> | </span> | ||
</p> | </p> | ||
</ | </syntaxhighlight> | ||
Result | Result | ||
< | <pre> | ||
VEVENT | VEVENT | ||
SUMMARY = BarCamp | SUMMARY = BarCamp | ||
</ | </pre> | ||
== inline examples from Microformation == | == inline examples from Microformation == | ||
Here are inline examples published by Jeremy Keith in his blog post [http://adactio.com/journal/1579/ Microformation]. Each of | Here are inline examples published by Jeremy Keith in his blog post [http://adactio.com/journal/1579/ Microformation]. | ||
=== to do value-title test pages === | |||
'''Each of the examples below needs to be updated as follows:''' | |||
# move to a separate page (one test per page), similar to the format used by [[value-dt-test-YYYY-MM-DD--HH-MM]]. | # move to a separate page (one test per page), similar to the format used by [[value-dt-test-YYYY-MM-DD--HH-MM]]. | ||
Line 133: | Line 136: | ||
# linked to from the appropriate section at the top of this page. | # 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 test | 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 === | === value title with contents === | ||
< | <syntaxhighlight lang="html"> | ||
<span class="dtstart"> | <span class="dtstart"> | ||
<span class="value-title" title="2009-06-05T20:00:00"> | <span class="value-title" title="2009-06-05T20:00:00"> | ||
Line 142: | Line 145: | ||
</span> | </span> | ||
</span> | </span> | ||
</ | </syntaxhighlight> | ||
=== separate value title date and time === | === 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. [[User:Tantek|Tantek]] | 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. [[User:Tantek|Tantek]] | ||
< | <syntaxhighlight lang="html"> | ||
<span class="dtstart"> | <span class="dtstart"> | ||
<span class="value-title" title="2009-06-05"> | <span class="value-title" title="2009-06-05"> | ||
Line 157: | Line 160: | ||
</span> | </span> | ||
</span> | </span> | ||
</ | </syntaxhighlight> | ||
=== value title span with empty content === | === value title span with empty content === | ||
< | <syntaxhighlight lang="html"> | ||
<span class="dtstart"> | <span class="dtstart"> | ||
<span class="value-title" title="2009-06-05T20:00:00"> </span> | <span class="value-title" title="2009-06-05T20:00:00"> </span> | ||
Friday, June 5th at 8pm | Friday, June 5th at 8pm | ||
</span> | </span> | ||
</ | </syntaxhighlight> | ||
== see also == | == see also == |
Latest revision as of 21:40, 26 July 2023
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
- value-dt-test-YYYY-MM-DD--HH-MM
- value-dt-test-abbr-YYYY-MM-DD--HH-MM
- value-dt-test-abbr-YYYY-MM-DD-abbr-HH-MM
- value-dt-test-YYYY-MM-DD--HHpm
- value-dt-test-YYYY-MM-DD--Hpm-EEpm
- value-dt-test-YYYY-MM-DD--abbr-HH-MMpm
- value-dt-test-YYYY-MM-DD--12am-12pm
- value-dt-test-YYYY-MM-DD--H-MMam-Epm
- value-dt-test-YYYY-MM-DD--0Ham-EEam
- value-dt-test-YYYY-MM-DD--H-MM-SSpm-EE-NN-UUpm
- value-dt-test-YYYY-DDD--HH-MM-SS
- value-dt-test-YYYY-MM-DD--HH-MMZ-EE-NN-UUZ
- value-dt-test-YYYY-MM-DD--HH-MM-XX-YY--EE-NN-UU--XXYY
- value-dt-test-YYYY-MM-DD--HH-MM-XX--EE-NN-UU--Y
- value-dt-test-YYYY-MM-DD--HH-MM-SS-XXYY--EE-NN--Z
- value-dt-test-e-title-YYYY-MM-DD--HH-MM
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:
- move to a separate page (one test per page), similar to the format used by value-dt-test-YYYY-MM-DD--HH-MM.
- mark up using the test-fixture poshformat.
- "Result" at a minimum converted from abstract hierarchical text properties/values to an vCard and/or iCalendar expected result block.
- 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:
- move to a separate page (one test per page), similar to the format used by value-dt-test-YYYY-MM-DD--HH-MM.
- construct a complete hCalendar event that uses inline
dtstart
example - mark up using the test-fixture poshformat.
- document "Result" at a minimum as an iCalendar expected result block.
- 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>