Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
waitOnAutocomplete example
$form_display
->
save
(
)
;
$this
->
assertIsInt
(
$form_display
->
getComponent
(
$field_name
)
[
'settings'
]
[
'size'
]
)
;
// Visit the node add page.
$this
->
drupalGet
(
'node/add/page'
)
;
$page
=
$this
->
getSession
(
)
->
getPage
(
)
;
$assert_session
=
$this
->
assertSession
(
)
;
$autocomplete_field
=
$assert_session
->
waitForElement
(
'css', '[name="' .
$field_name
. '[0][target_id]"].ui-autocomplete-input'
)
;
$autocomplete_field
->
setValue
(
'Test'
)
;
$this
->
getSession
(
)
->
getDriver
(
)
->
keyDown
(
$autocomplete_field
->
getXpath
(
)
, ' '
)
;
$assert_session
->
waitOnAutocomplete
(
)
;
$results
=
$page
->
findAll
(
'css', '.ui-autocomplete li'
)
;
$this
->
assertCount
(
2,
$results
)
;
$assert_session
->
pageTextContains
(
'Test page'
)
;
$assert_session
->
pageTextContains
(
'Page test'
)
;
// Now switch the autocomplete widget to the 'STARTS_WITH' match operator.
$display_repository
->
getFormDisplay
(
'node', 'page'
)
->
setComponent
(
$field_name
,
[
'type' => 'entity_reference_autocomplete',