]> BookStack Code Mirror - bookstack/blobdiff - tests/Entity/EntitySearchTest.php
respective book and chapter structure added.
[bookstack] / tests / Entity / EntitySearchTest.php
index bb1021a67915620bddf9c61694c1702ac092c23d..57b7c3f6b88c1b7ca8ee4cb237395701cd7a0c92 100644 (file)
@@ -573,8 +573,16 @@ class EntitySearchTest extends TestCase
 
     public function test_searches_with_terms_without_controls_includes_them_in_extras()
     {
-        $resp = $this->asEditor()->get('/search?term=' . urlencode('test {updated_by:dan} {created_by:dan} -{viewed_by_me} -[a=b] -"dog"'));
-        $this->withHtml($resp)->assertFieldHasValue('extras', '{updated_by:dan} {created_by:dan} -"dog" -[a=b] -{viewed_by_me}');
+        $resp = $this->asEditor()->get('/search?term=' . urlencode('test {updated_by:dan} {created_by:dan} -{viewed_by_me} -[a=b] -"dog" {is_template} {sort_by:last_commented}'));
+        $this->withHtml($resp)->assertFieldHasValue('extras', '{updated_by:dan} {created_by:dan} {is_template} {sort_by:last_commented} -"dog" -[a=b] -{viewed_by_me}');
+    }
+
+    public function test_negated_searches_dont_show_in_inputs()
+    {
+        $resp = $this->asEditor()->get('/search?term=' . urlencode('-{created_by:me} -[a=b] -"dog"'));
+        $this->withHtml($resp)->assertElementNotExists('input[name="tags[]"][value="a=b"]');
+        $this->withHtml($resp)->assertElementNotExists('input[name="exact[]"][value="dog"]');
+        $this->withHtml($resp)->assertElementNotExists('input[name="filters[created_by]"][value="me"][checked="checked"]');
     }
 
     public function test_searches_with_user_filters_using_me_adds_them_into_advanced_search_form()