Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adamziel committed Dec 17, 2024
1 parent 92ced0a commit 92fda0a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 18 deletions.
19 changes: 15 additions & 4 deletions packages/playground/data-liberation/tests/WPHTMLToBlocksTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,22 @@ public function provider_test_conversion() {
<!-- wp:table --><figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th>Header 1 </th><th>Header 2 </th></tr></thead><tbody><tr><td>Cell 1 </td><td>Cell 2 </td></tr><tr><td>Cell 3 </td><td>Cell 4 </td></tr></tbody><tfoot><tr><td>Footer 1 </td><td>Footer 2 </td></tr></tfoot></table></figure><!-- /wp:table -->
HTML
],
'An excerpt from an HTML file' => [
'html' => file_get_contents( __DIR__ . '/fixtures/html-to-blocks/excerpt.input.html' ),
'expected' => file_get_contents( __DIR__ . '/fixtures/html-to-blocks/excerpt.output.html' ),
],
];
}

public function test_html_to_blocks_excerpt() {
$input = file_get_contents( __DIR__ . '/fixtures/html-to-blocks/excerpt.input.html' );
$converter = new WP_HTML_To_Blocks( $input );
$converter->convert( $input );
$blocks = $converter->get_block_markup();

$output_file = __DIR__ . '/fixtures/html-to-blocks/excerpt.output.html';
if (getenv('UPDATE_FIXTURES')) {
file_put_contents( $output_file, $blocks );
}

$this->assertEquals( file_get_contents( $output_file ), $blocks );

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,7 @@ <h2>Full table of contents</h2>
<!-- wp:list-item -->
<li>
<a href="#charset">
4.2.5.4 Specifying the document&apos;s
4.2.5.4 Specifying the document&#039;s
character encoding
</a>
</li>
Expand Down Expand Up @@ -2333,10 +2333,10 @@ <h2>Full table of contents</h2>
<!-- wp:list-item -->
<li>
<a
href="#a-purely-decorative-image-that-doesn't-add-any-information"
href="#a-purely-decorative-image-that-doesn&#039;t-add-any-information"
>
4.8.4.4.8 A purely decorative image
that doesn&apos;t add any
that doesn&#039;t add any
information
</a>
</li>
Expand Down Expand Up @@ -2896,8 +2896,8 @@ <h2>Full table of contents</h2>
<ul class="wp-block-list">
<!-- wp:list-item -->
<li>
<a href="#writing-a-form's-user-interface">
4.10.1.1 Writing a form&apos;s user
<a href="#writing-a-form&#039;s-user-interface">
4.10.1.1 Writing a form&#039;s user
interface
</a>
</li>
Expand Down Expand Up @@ -3400,8 +3400,8 @@ <h2>Full table of contents</h2>
<ul class="wp-block-list">
<!-- wp:list-item -->
<li>
<a href="#a-form-control's-value">
4.10.17.1 A form control&apos;s value
<a href="#a-form-control&#039;s-value">
4.10.17.1 A form control&#039;s value
</a>
</li>
<!-- /wp:list-item -->
Expand Down Expand Up @@ -4340,10 +4340,10 @@ <h2>Full table of contents</h2>
<!-- wp:list-item -->
<li>
<a
href="#case-sensitivity-of-the-css-'attr()'-function"
href="#case-sensitivity-of-the-css-&#039;attr()&#039;-function"
>
4.16.1 Case-sensitivity of the CSS
&apos;attr()&apos; function
&#039;attr()&#039; function
</a>
</li>
<!-- /wp:list-item -->
Expand Down Expand Up @@ -5987,7 +5987,7 @@ <h2>Full table of contents</h2>
<li>
<a href="#read-ua-inline">
7.5.7 Loading a document for inline content that
doesn&apos;t have a DOM
doesn&#039;t have a DOM
</a>
</li>
<!-- /wp:list-item -->
Expand Down Expand Up @@ -7098,8 +7098,8 @@ <h2>Full table of contents</h2>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li>
<a href="#the-worker's-lifetime">
10.2.3 The worker&apos;s lifetime
<a href="#the-worker&#039;s-lifetime">
10.2.3 The worker&#039;s lifetime
</a>
</li>
<!-- /wp:list-item -->
Expand Down Expand Up @@ -7308,7 +7308,7 @@ <h2>Full table of contents</h2>
<!-- wp:list-item -->
<li>
<a href="#worklets-lifetime">
11.3.3 The worklet&apos;s lifetime
11.3.3 The worklet&#039;s lifetime
</a>
</li>
<!-- /wp:list-item -->
Expand Down Expand Up @@ -9160,7 +9160,7 @@ <h3>1.3 Background <a href="#background"> </a></h3>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>
HTML is the World Wide Web&apos;s core markup language. Originally, HTML was
HTML is the World Wide Web&#039;s core markup language. Originally, HTML was
primarily designed as a language for semantically describing scientific
documents. Its general design, however, has enabled it to be adapted, over
the subsequent years, to describe a number of other types of documents and
Expand Down

0 comments on commit 92fda0a

Please sign in to comment.