Skip to content

Commit 404e67a

Browse files
committed
Page Revisions: Added testing coverage to basic diffing
1 parent 6d64262 commit 404e67a

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

tests/Entity/PageRevisionTest.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,15 +229,28 @@ public function test_revision_changes_link_not_shown_for_oldest_revision()
229229
$html->assertElementContains('.item-list > .item-list-row:nth-child(2)', 'Changes');
230230
}
231231

232-
public function test_page_changes_view_filters_html_content()
232+
public function test_revision_changes_view_shows_diff()
233+
{
234+
$this->asEditor();
235+
$page = $this->entities->page();
236+
$this->createRevisions($page, 1, ['name' => 'updated page', 'html' => '<p id="bkmrk-hello">Hello there dog</p>']);
237+
$this->createRevisions($page, 1, ['name' => 'updated page', 'html' => '<p id="bkmrk-hello">Hello there cat</p>']);
238+
239+
$pageRevision = $page->revisions()->orderBy('id', 'desc')->first();
240+
$revisionView = $this->get("{$page->getUrl()}/revisions/{$pageRevision->id}/changes");
241+
$revisionView->assertStatus(200);
242+
$revisionView->assertSee('<p id="bkmrk-hello">Hello there <del class="diffmod">dog</del><ins class="diffmod">cat</ins></p>', false);
243+
}
244+
245+
public function test_revision_changes_view_filters_html_content()
233246
{
234247
$this->asEditor();
235248
$page = $this->entities->page();
236249
$html = '<script>dontwantthishere</script><style>dontwantthishere</style><p>expectthisthough</p>';
237250
$this->createRevisions($page, 1, ['name' => 'updated page', 'html' => $html]);
238251
$this->createRevisions($page, 1, ['name' => 'updated page', 'html' => $html]);
239252

240-
$pageRevision = $page->revisions->last();
253+
$pageRevision = $page->revisions()->orderBy('id', 'desc')->first();
241254
$revisionView = $this->get("{$page->getUrl()}/revisions/{$pageRevision->id}/changes");
242255
$revisionView->assertStatus(200);
243256
$revisionView->assertSee('expectthisthough');

0 commit comments

Comments
 (0)