public function GeolocationGoogleGeocoderWidgetTest::testGeocoderWidgetEmptyValuePreserved in Geolocation Field 8
Same name and namespace in other branches
- 8.3 tests/src/FunctionalJavascript/GeolocationGoogleGeocoderWidgetTest.php \Drupal\Tests\geolocation\FunctionalJavascript\GeolocationGoogleGeocoderWidgetTest::testGeocoderWidgetEmptyValuePreserved()
- 8.2 tests/src/FunctionalJavascript/GeolocationGoogleGeocoderWidgetTest.php \Drupal\Tests\geolocation\FunctionalJavascript\GeolocationGoogleGeocoderWidgetTest::testGeocoderWidgetEmptyValuePreserved()
Tests the Google Maps widget.
File
- tests/
src/ FunctionalJavascript/ GeolocationGoogleGeocoderWidgetTest.php, line 141
Class
- GeolocationGoogleGeocoderWidgetTest
- Tests the Google Geocoder Widget functionality.
Namespace
Drupal\Tests\geolocation\FunctionalJavascriptCode
public function testGeocoderWidgetEmptyValuePreserved() {
EntityFormDisplay::load('node.article.default')
->setComponent('field_geolocation', [
'type' => 'geolocation_googlegeocoder',
'settings' => [
'default_latitude' => 12,
'default_longitude' => 24,
],
])
->save();
$this
->drupalLogin($this->adminUser);
$this
->drupalGetFilterGoogleKey('node/add/article');
$page = $this
->getSession()
->getPage();
$page
->findField('Title')
->setValue('I am new');
$page
->pressButton('Save');
/** @var \Drupal\node\NodeInterface $new_node */
$new_node = \Drupal::entityTypeManager()
->getStorage('node')
->load(5);
$this
->assertSession()
->assert($new_node
->get('field_geolocation')
->isEmpty(), "Node geolocation field empty after saving from predefined location widget");
}