-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Organised test files & added page update draft tests
Also cleaned styling for new autosave ui parts. Closes #36.
- Loading branch information
1 parent
30214fd
commit bf7852c
Showing
8 changed files
with
69 additions
and
7 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
|
||
|
||
class PageUpdateDraftTest extends TestCase | ||
{ | ||
protected $page; | ||
protected $pageRepo; | ||
|
||
public function setUp() | ||
{ | ||
parent::setUp(); | ||
$this->page = \BookStack\Page::first(); | ||
$this->pageRepo = app('\BookStack\Repos\PageRepo'); | ||
} | ||
|
||
public function test_draft_content_shows_if_available() | ||
{ | ||
$addedContent = '<p>test message content</p>'; | ||
$this->asAdmin()->visit($this->page->getUrl() . '/edit') | ||
->dontSeeInField('html', $addedContent); | ||
|
||
$newContent = $this->page->html . $addedContent; | ||
$this->pageRepo->saveUpdateDraft($this->page, ['html' => $newContent]); | ||
$this->asAdmin()->visit($this->page->getUrl() . '/edit') | ||
->seeInField('html', $newContent); | ||
} | ||
|
||
public function test_draft_not_visible_by_others() | ||
{ | ||
$addedContent = '<p>test message content</p>'; | ||
$this->asAdmin()->visit($this->page->getUrl() . '/edit') | ||
->dontSeeInField('html', $addedContent); | ||
|
||
$newContent = $this->page->html . $addedContent; | ||
$newUser = $this->getNewUser(); | ||
$this->pageRepo->saveUpdateDraft($this->page, ['html' => $newContent]); | ||
$this->actingAs($newUser)->visit($this->page->getUrl() . '/edit') | ||
->dontSeeInField('html', $newContent); | ||
} | ||
|
||
public function test_alert_message_shows_if_editing_draft() | ||
{ | ||
$this->asAdmin(); | ||
$this->pageRepo->saveUpdateDraft($this->page, ['html' => 'test content']); | ||
$this->asAdmin()->visit($this->page->getUrl() . '/edit') | ||
->see('You are currently editing a draft'); | ||
} | ||
|
||
public function test_alert_message_shows_if_someone_else_editing() | ||
{ | ||
$addedContent = '<p>test message content</p>'; | ||
$this->asAdmin()->visit($this->page->getUrl() . '/edit') | ||
->dontSeeInField('html', $addedContent); | ||
|
||
$newContent = $this->page->html . $addedContent; | ||
$newUser = $this->getNewUser(); | ||
$this->pageRepo->saveUpdateDraft($this->page, ['html' => $newContent]); | ||
$this->actingAs($newUser)->visit($this->page->getUrl() . '/edit') | ||
->see('Admin has started editing this page'); | ||
} | ||
|
||
} |
File renamed without changes.
File renamed without changes.