@@ -356,6 +356,42 @@ public function test_sibling_search_for_shelves()
356356 }
357357 }
358358
359+ public function test_sibling_search_for_books_provides_results_in_alphabetical_order ()
360+ {
361+ $ contextBook = $ this ->entities ->book ();
362+ $ searchBook = $ this ->entities ->book ();
363+
364+ $ searchBook ->name = 'Zebras ' ;
365+ $ searchBook ->save ();
366+
367+ $ search = $ this ->actingAs ($ this ->users ->viewer ())->get ("/search/entity/siblings?entity_id= {$ contextBook ->id }&entity_type=book " );
368+ $ this ->withHtml ($ search )->assertElementNotContains ('a:first-child ' , 'Zebras ' );
369+
370+ $ searchBook ->name = 'AAAAAAArdvarks ' ;
371+ $ searchBook ->save ();
372+
373+ $ search = $ this ->actingAs ($ this ->users ->viewer ())->get ("/search/entity/siblings?entity_id= {$ contextBook ->id }&entity_type=book " );
374+ $ this ->withHtml ($ search )->assertElementContains ('a:first-child ' , 'AAAAAAArdvarks ' );
375+ }
376+
377+ public function test_sibling_search_for_shelves_provides_results_in_alphabetical_order ()
378+ {
379+ $ contextShelf = $ this ->entities ->shelf ();
380+ $ searchShelf = $ this ->entities ->shelf ();
381+
382+ $ searchShelf ->name = 'Zebras ' ;
383+ $ searchShelf ->save ();
384+
385+ $ search = $ this ->actingAs ($ this ->users ->viewer ())->get ("/search/entity/siblings?entity_id= {$ contextShelf ->id }&entity_type=bookshelf " );
386+ $ this ->withHtml ($ search )->assertElementNotContains ('a:first-child ' , 'Zebras ' );
387+
388+ $ searchShelf ->name = 'AAAAAAArdvarks ' ;
389+ $ searchShelf ->save ();
390+
391+ $ search = $ this ->actingAs ($ this ->users ->viewer ())->get ("/search/entity/siblings?entity_id= {$ contextShelf ->id }&entity_type=bookshelf " );
392+ $ this ->withHtml ($ search )->assertElementContains ('a:first-child ' , 'AAAAAAArdvarks ' );
393+ }
394+
359395 public function test_search_works_on_updated_page_content ()
360396 {
361397 $ page = $ this ->entities ->page ();
0 commit comments