@@ -195,8 +195,7 @@ public function testHCardChildHCard() {
195195 "properties": {
196196 "name": ["Mozilla Foundation"],
197197 "url": ["http://mozilla.org/"]
198- },
199- "value": "Mozilla Foundation"
198+ }
200199 }]
201200 }]
202201} ' ;
@@ -230,6 +229,9 @@ public function testMicroformatsNestedUnderEPropertyClassnamesRetainHtmlKey() {
230229 $ input = '<div class="h-entry"><div class="h-card e-content"><p>Hello</p></div></div> ' ;
231230 $ mf = Mf2 \parse ($ input );
232231
232+ $ this ->assertArrayHasKey ('value ' , $ mf ['items ' ][0 ]['properties ' ]['content ' ][0 ]);
233+ $ this ->assertEquals ($ mf ['items ' ][0 ]['properties ' ]['content ' ][0 ]['value ' ], 'Hello ' );
234+ $ this ->assertArrayHasKey ('html ' , $ mf ['items ' ][0 ]['properties ' ]['content ' ][0 ]);
233235 $ this ->assertEquals ($ mf ['items ' ][0 ]['properties ' ]['content ' ][0 ]['html ' ], '<p>Hello</p> ' );
234236 }
235237
@@ -299,4 +301,19 @@ public function testMicroformatsNestedUnderPPropertyClassnamesDeriveValueFromFir
299301
300302 $ this ->assertEquals ($ mf ['items ' ][0 ]['properties ' ]['author ' ][0 ]['value ' ], 'Zoe ' );
301303 }
304+
305+
306+ /**
307+ * @see https://github.com/indieweb/php-mf2/issues/98
308+ * @see https://github.com/microformats/tests/issues/58
309+ */
310+ public function testNoValueForNestedMicroformatWithoutProperty () {
311+ $ input = '<div class="h-card" ><a class="h-card" href="jane.html">Jane Doe</a><p></p></div> ' ;
312+ $ parser = new Parser ($ input );
313+ $ output = $ parser ->parse ();
314+
315+ $ this ->assertArrayHasKey ('children ' , $ output ['items ' ][0 ]);
316+ $ this ->assertArrayNotHasKey ('value ' , $ output ['items ' ][0 ]['children ' ][0 ]);
317+ }
318+
302319}
0 commit comments