Skip to content

Commit

Permalink
[+]: add test for issue#112
Browse files Browse the repository at this point in the history
  • Loading branch information
voku committed Sep 6, 2024
1 parent 716822e commit 61beaaa
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/SimpleHtmlDomTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -608,4 +608,26 @@ public function testHasAttribute()
static::assertTrue($element->hasAttribute('class'));
static::assertTrue(isset($element->id));
}

public function testIssue112()
{
$html = '<div class="woocommerce-variation single_variation">
<div class="woocommerce-variation-description"></div>
<div class="woocommerce-variation-price"></div>
<div class="woocommerce-variation-availability"><p class="stock in-stock">30 in stock</p></div>
</div>';

$expected = '<div class="woocommerce-variation single_variation">
<div class="woocommerce-variation-description"></div>
<div class="woocommerce-variation-price"></div>
<div class="woocommerce-variation-availability"><p class="stock in-stock">30 in stock</p></div>
</div>';

$document = new HtmlDomParser($html);
$htmlNew = $document->html();
static::assertSame($expected, $htmlNew);

$availabilityHtml = $document->findOne('.woocommerce-variation-availability');
static::assertSame('<p class="stock in-stock">30 in stock</p>', $availabilityHtml->innerHtml());
}
}

0 comments on commit 61beaaa

Please sign in to comment.