]> BookStack Code Mirror - bookstack/blobdiff - tests/UserProfileTest.php
Resolves book heading issues in grid view.
[bookstack] / tests / UserProfileTest.php
index 9543adc1d3bc3f6752bffa1eadd27eb26387f064..09870e13850437c03087e0bce65de56bca366d51 100644 (file)
@@ -1,6 +1,6 @@
-<?php
+<?php namespace Tests;
 
-class UserProfileTest extends TestCase
+class UserProfileTest extends BrowserKitTest
 {
     protected $user;
 
@@ -55,8 +55,8 @@ class UserProfileTest extends TestCase
         $newUser = $this->getEditor();
         $this->actingAs($newUser);
         $entities = $this->createEntityChainBelongingToUser($newUser, $newUser);
-        Activity::add($entities['book'], 'book_update', $entities['book']->id);
-        Activity::add($entities['page'], 'page_create', $entities['book']->id);
+        \Activity::add($entities['book'], 'book_update', $entities['book']->id);
+        \Activity::add($entities['page'], 'page_create', $entities['book']->id);
 
         $this->asAdmin()->visit('/user/' . $newUser->id)
             ->seeInElement('#recent-activity', 'updated book')
@@ -69,8 +69,8 @@ class UserProfileTest extends TestCase
         $newUser = $this->getEditor();
         $this->actingAs($newUser);
         $entities = $this->createEntityChainBelongingToUser($newUser, $newUser);
-        Activity::add($entities['book'], 'book_update', $entities['book']->id);
-        Activity::add($entities['page'], 'page_create', $entities['book']->id);
+        \Activity::add($entities['book'], 'book_update', $entities['book']->id);
+        \Activity::add($entities['page'], 'page_create', $entities['book']->id);
 
         $this->asAdmin()->visit('/')->clickInElement('#recent-activity', $newUser->name)
             ->seePageIs('/user/' . $newUser->id)
@@ -94,5 +94,24 @@ class UserProfileTest extends TestCase
             ->seePageIs('/settings/users/' . $guestUser->id)
             ->see('cannot delete the guest user');
     }
-    
+
+    public function test_books_display_is_list()
+    {
+        $this->asAdmin()
+            ->visit('/settings/users/' . $this->user->id)
+            ->select('grid', '#books_display')
+            ->press('Save')
+            ->visit('/books')
+            ->pageHasElement('.entity-list-item');
+    }
+
+    public function test_books_display_is_grid()
+    {
+        $this->asAdmin()
+            ->visit('/settings/users/' . $this->user->id)
+            ->select('list', '#books_display')
+            ->press('Save')
+            ->visit('/books')
+            ->pageHasElement('.gallery-item');
+    }
 }