Skip to content

Commit

Permalink
Update tests to take new default response into account
Browse files Browse the repository at this point in the history
  • Loading branch information
aarondfrancis committed Jul 19, 2021
1 parent 014f289 commit 956b7d4
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ CVS
composer.lock
.phpunit.result.cache
tests/Site/build_testing/

tests/Site/torchlight.php
5 changes: 3 additions & 2 deletions src/BlockManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,13 @@ protected function renderMarkdownCapturedBlocks()
$id = $this->getCapturedGroup('/id="(.+?)"/', $element);
$classes = $this->getCapturedGroup('/class="(.+?)"/', $element);

$id = $id ? "id='$id'" : '';
$id = $id ? " id='$id'" : '';

// User defined classes + Torchlight classes from the API.
$classes = trim("$classes $block->classes");

// Build up a new element.
$html = "<pre><code $id class='{$classes}' style='{$block->styles}'>{$block->highlighted}</code></pre>";
$html = "<pre><code{$id} class='{$classes}' style='{$block->styles}'>{$block->highlighted}</code></pre>";

// Finally swap the old element for the new, highlighted one.
$contents = str_replace($element, $html, $contents);
Expand Down
4 changes: 1 addition & 3 deletions tests/snapshots/attributes-get-carried-over.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<p>Some text before</p>

<pre><code id='id' class='language-php class' style=''>&lt;?php

echo &quot;hello world&quot;;</code></pre>
<pre><code id='id' class='language-php class torchlight' style=''><div class='line'>&lt;?php</div><div class='line'></div><div class='line'>echo &quot;hello world&quot;;</div></code></pre>

<p>Some text after</p>
5 changes: 1 addition & 4 deletions tests/snapshots/jigsaw-escapes-get-fixed.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<p>Some text before</p>

<pre><code class='language-text' style=''>&lt;?php
@
{{
{!!</code></pre>
<pre><code class='language-text torchlight' style=''><div class='line'>&lt;?php</div><div class='line'>@</div><div class='line'>{{</div><div class='line'>{!!</div></code></pre>

<p>Some text after</p>
2 changes: 1 addition & 1 deletion tests/snapshots/non-existent-id.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<pre><code class="" style="" id="hello-world-1">echo &quot;hello world 1&quot;;</code></pre>
<pre><code class="torchlight" style="" id="hello-world-1"><div class='line'>echo &quot;hello world 1&quot;;</div></code></pre>

An id with no block remains: __torchlight-block-[fake_id]__
2 changes: 1 addition & 1 deletion tests/snapshots/one-component.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<pre><code class="" style="" id="hello-world-1">echo &quot;hello world 1&quot;;</code></pre>
<pre><code class="torchlight" style="" id="hello-world-1"><div class='line'>echo &quot;hello world 1&quot;;</div></code></pre>
4 changes: 2 additions & 2 deletions tests/snapshots/two-components.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<pre><code class="" style="">echo &quot;hello world 1&quot;;</code></pre>
<pre><code class="torchlight" style=""><div class='line'>echo &quot;hello world 1&quot;;</div></code></pre>

<pre><code class="" style="">echo &quot;hello world 2&quot;;</code></pre>
<pre><code class="torchlight" style=""><div class='line'>echo &quot;hello world 2&quot;;</div></code></pre>

0 comments on commit 956b7d4

Please sign in to comment.