Skip to content

Commit 7cd0629

Browse files
committed
Input WYSIWYG: Updated exports to handle HTML descriptions
1 parent fb3cfaf commit 7cd0629

File tree

4 files changed

+22
-12
lines changed

4 files changed

+22
-12
lines changed

resources/views/exports/book.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
@section('content')
66

77
<h1 style="font-size: 4.8em">{{$book->name}}</h1>
8-
<p>{{ $book->description }}</p>
8+
<div>{!! $book->descriptionHtml() !!}</div>
99

1010
@include('exports.parts.book-contents-menu', ['children' => $bookChildren])
1111

resources/views/exports/chapter.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
@section('content')
66

77
<h1 style="font-size: 4.8em">{{$chapter->name}}</h1>
8-
<p>{{ $chapter->description }}</p>
8+
<div>{!! $chapter->descriptionHtml() !!}</div>
99

1010
@include('exports.parts.chapter-contents-menu', ['pages' => $pages])
1111

resources/views/exports/parts/chapter-item.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="page-break"></div>
22
<h1 id="chapter-{{$chapter->id}}">{{ $chapter->name }}</h1>
33

4-
<p>{{ $chapter->description }}</p>
4+
<div>{!! $chapter->descriptionHtml() !!}</div>
55

66
@if(count($chapter->visible_pages) > 0)
77
@foreach($chapter->visible_pages as $page)

tests/Entity/ExportTest.php

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,18 @@ public function test_book_html_export()
107107
$resp->assertHeader('Content-Disposition', 'attachment; filename="' . $book->slug . '.html"');
108108
}
109109

110-
public function test_book_html_export_shows_chapter_descriptions()
110+
public function test_book_html_export_shows_html_descriptions()
111111
{
112-
$chapterDesc = 'My custom test chapter description ' . Str::random(12);
113-
$chapter = $this->entities->chapter();
114-
$chapter->description = $chapterDesc;
112+
$book = $this->entities->bookHasChaptersAndPages();
113+
$chapter = $book->chapters()->first();
114+
$book->description_html = '<p>A description with <strong>HTML</strong> within!</p>';
115+
$chapter->description_html = '<p>A chapter description with <strong>HTML</strong> within!</p>';
116+
$book->save();
115117
$chapter->save();
116118

117-
$book = $chapter->book;
118-
$this->asEditor();
119-
120-
$resp = $this->get($book->getUrl('/export/html'));
121-
$resp->assertSee($chapterDesc);
119+
$resp = $this->asEditor()->get($book->getUrl('/export/html'));
120+
$resp->assertSee($book->description_html, false);
121+
$resp->assertSee($chapter->description_html, false);
122122
}
123123

124124
public function test_chapter_text_export()
@@ -174,6 +174,16 @@ public function test_chapter_html_export()
174174
$resp->assertHeader('Content-Disposition', 'attachment; filename="' . $chapter->slug . '.html"');
175175
}
176176

177+
public function test_chapter_html_export_shows_html_descriptions()
178+
{
179+
$chapter = $this->entities->chapter();
180+
$chapter->description_html = '<p>A description with <strong>HTML</strong> within!</p>';
181+
$chapter->save();
182+
183+
$resp = $this->asEditor()->get($chapter->getUrl('/export/html'));
184+
$resp->assertSee($chapter->description_html, false);
185+
}
186+
177187
public function test_page_html_export_contains_custom_head_if_set()
178188
{
179189
$page = $this->entities->page();

0 commit comments

Comments
 (0)