- public function test_recently_updated_pages_view()
- {
- $user = $this->getEditor();
- $content = $this->createEntityChainBelongingToUser($user);
-
- $this->asAdmin()->visit('/pages/recently-updated')
- ->seeInNthElement('.entity-list .page', 0, $content['page']->name);
- }
-
- public function test_old_page_slugs_redirect_to_new_pages()
- {
- $page = Page::first();
- $pageUrl = $page->getUrl();
- $newPageUrl = '/books/' . $page->book->slug . '/page/super-test-page';
- // Need to save twice since revisions are not generated in seeder.
- $this->asAdmin()->visit($pageUrl)
- ->clickInElement('#content', 'Edit')
- ->type('super test', '#name')
- ->press('Save Page');
-
- $page = Page::first();
- $pageUrl = $page->getUrl();
-
- // Second Save
- $this->visit($pageUrl)
- ->clickInElement('#content', 'Edit')
- ->type('super test page', '#name')
- ->press('Save Page')
- // Check redirect
- ->seePageIs($newPageUrl);
-
- $this->visit($pageUrl)
- ->seePageIs($newPageUrl);
- }
-
- public function test_recently_updated_pages_on_home()
- {
- $page = Page::orderBy('updated_at', 'asc')->first();
- Page::where('id', '!=', $page->id)->update([
- 'updated_at' => Carbon::now()->subSecond(1),
- ]);
- $this->asAdmin()->visit('/')
- ->dontSeeInElement('#recently-updated-pages', $page->name);
- $this->visit($page->getUrl() . '/edit')
- ->press('Save Page')
- ->visit('/')
- ->seeInElement('#recently-updated-pages', $page->name);
- }
-
- public function test_slug_multi_byte_url_safe()
- {
- $book = $this->newBook([
- 'name' => 'информация',
- ]);
-
- $this->assertEquals('informatsiya', $book->slug);
-
- $book = $this->newBook([
- 'name' => '¿Qué?',
- ]);
-
- $this->assertEquals('que', $book->slug);
- }
-
- public function test_slug_format()
- {
- $book = $this->newBook([
- 'name' => 'PartA / PartB / PartC',
- ]);
-
- $this->assertEquals('parta-partb-partc', $book->slug);
- }
-
- public function test_page_within_chapter_deletion_returns_to_chapter()
- {
- $chapter = Chapter::query()->first();
- $page = $chapter->pages()->first();
-
- $this->asEditor()->visit($page->getUrl('/delete'))
- ->submitForm('Confirm')
- ->seePageIs($chapter->getUrl());
- }