Skip to content

Commit f34e8b0

Browse files
committed
refactor(Tests): Adding a functionl test to check if the max results options is working
1 parent f46e34d commit f34e8b0

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/Autocomplete/tests/Fixtures/Form/CategoryAutocompleteType.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public function configureOptions(OptionsResolver $resolver)
4141
'attr' => [
4242
'data-controller' => 'custom-autocomplete',
4343
],
44+
'max_results' => 5,
4445
]);
4546
}
4647

src/Autocomplete/tests/Functional/FieldAutocompleterTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,16 @@ public function testItEnforcesSecurity(): void
7878
->assertJsonMatches('length(results)', 3)
7979
;
8080
}
81+
82+
public function testItCheckMaxResultsOption() : void
83+
{
84+
CategoryFactory::createMany(30, ['name' => 'foo']);
85+
86+
$this->browser()
87+
->throwExceptions()
88+
->get('/test/autocomplete/category_autocomplete_type?query=foo')
89+
->assertSuccessful()
90+
->assertJsonMatches('length(results)', 5)
91+
;
92+
}
8193
}

0 commit comments

Comments
 (0)