@@ -359,5 +359,43 @@ public function testNoUrlFromRelOnMf2() {
359359 $ this ->assertArrayNotHasKey ('url ' , $ output ['items ' ][0 ]['properties ' ]);
360360 }
361361
362+ /**
363+ * Simplified h-entry with `p-location h-adr` from https://aaronparecki.com/2018/03/14/3/
364+ * Whitespace cleaned up for easier test assertion
365+ * @see https://github.com/indieweb/php-mf2/issues/151
366+ */
367+ public function testNestedValuePProperty () {
368+ $ input = <<< END
369+ <div class="h-entry">
370+ <span class="p-location h-adr">
371+ <span class="p-locality">Portland</span>, <span class="p-region">Oregon</span> <span class="weather"><span>•</span><i class="wi wi-night-alt-cloudy" title="Mostly Cloudy"></i> 44°F</span>
372+ <data class="p-latitude" value="45.535623"></data>
373+ <data class="p-longitude" value="-122.621209"></data>
374+ </span>
375+ </div>
376+ END ;
377+ $ parser = new Parser ($ input );
378+ $ output = $ parser ->parse ();
379+
380+ $ this ->assertArrayHasKey ('value ' , $ output ['items ' ][0 ]['properties ' ]['location ' ][0 ]);
381+ $ this ->assertEquals ("Portland, Oregon • 44°F " , $ output ['items ' ][0 ]['properties ' ]['location ' ][0 ]['value ' ]);
382+ }
383+
384+ /**
385+ * @see https://github.com/indieweb/php-mf2/issues/151
386+ */
387+ public function testNestedValueDTProperty () {
388+ $ input = <<< END
389+ <div class="h-entry">
390+ <div class="dt-acme h-acme-object">1997-12-12</div>
391+ </div>
392+ END ;
393+ $ parser = new Parser ($ input );
394+ $ output = $ parser ->parse ();
395+
396+ $ this ->assertArrayHasKey ('value ' , $ output ['items ' ][0 ]['properties ' ]['acme ' ][0 ]);
397+ $ this ->assertEquals ('1997-12-12 ' , $ output ['items ' ][0 ]['properties ' ]['acme ' ][0 ]['value ' ]);
398+ }
399+
362400}
363401
0 commit comments