- $entityChain = $this->createEntityChainBelongingToUser($this->getEditor());
- $this->asAdmin()->visit('/')
- ->seeInElement('#recently-created-pages', $entityChain['page']->name);
+ $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_shelf_cancel_creation_returns_to_correct_place()
+ {
+ $shelf = Bookshelf::first();
+
+ // Cancel button from shelf goes back to shelf
+ $this->asEditor()->visit($shelf->getUrl('/create-book'))
+ ->see('Cancel')
+ ->click('Cancel')
+ ->seePageIs($shelf->getUrl());
+
+ // Cancel button from books goes back to books
+ $this->asEditor()->visit('/create-book')
+ ->see('Cancel')
+ ->click('Cancel')
+ ->seePageIs('/books');
+
+ // Cancel button from book edit goes back to book
+ $book = Book::first();
+
+ $this->asEditor()->visit($book->getUrl('/edit'))
+ ->see('Cancel')
+ ->click('Cancel')
+ ->seePageIs($book->getUrl());
+ }
+
+ 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());