public function GeolocationJavascriptTest::testGoogleMapFormatterCustomSettings in Geolocation Field 8.2
Same name and namespace in other branches
- 8.3 tests/src/FunctionalJavascript/GeolocationJavascriptTest.php \Drupal\Tests\geolocation\FunctionalJavascript\GeolocationJavascriptTest::testGoogleMapFormatterCustomSettings()
- 8 tests/src/FunctionalJavascript/GeolocationJavascriptTest.php \Drupal\Tests\geolocation\FunctionalJavascript\GeolocationJavascriptTest::testGoogleMapFormatterCustomSettings()
Tests the Google Maps formatter.
File
- tests/
src/ FunctionalJavascript/ GeolocationJavascriptTest.php, line 211
Class
- GeolocationJavascriptTest
- Tests the JavaScript functionality.
Namespace
Drupal\Tests\geolocation\FunctionalJavascriptCode
public function testGoogleMapFormatterCustomSettings() {
$this
->drupalGet('node/4');
$this
->assertSession()
->elementExists('css', '.geolocation-map-container');
$this
->assertSession()
->elementAttributeContains('css', '.geolocation-map-container', 'style', 'height: 376px');
// If Google works, either gm-style or gm-err-container will be present.
$this
->assertSession()
->elementExists('css', '.geolocation-map-container [class^="gm-"]');
// TODO: Create node with custom settings and test it.
$admin_user = $this
->drupalCreateUser([
'bypass node access',
'administer nodes',
]);
$this
->drupalLogin($admin_user);
// Display creation form.
$this
->drupalGet('node/4/edit');
$this
->assertSession()
->fieldExists("field_geolocation[0][google_map_settings][height]");
$this
->getSession()
->wait(6000);
$this
->assertSession()
->elementExists('css', '#edit-field-geolocation-0-google-map-settings > summary');
$this
->getSession()
->getPage()
->find('css', '#edit-field-geolocation-0-google-map-settings > summary')
->click();
$edit = [
'title[0][value]' => $this
->randomMachineName(),
'field_geolocation[0][google_map_settings][height]' => '273px',
];
$this
->drupalPostForm(NULL, $edit, t('Save'));
$this
->drupalGet('node/4');
$this
->assertSession()
->elementExists('css', '.geolocation-map-container');
$this
->assertSession()
->elementAttributeContains('css', '.geolocation-map-container', 'style', 'height: 273px;');
// If Google works, either gm-style or gm-err-container will be present.
$this
->assertSession()
->elementExists('css', '.geolocation-map-container [class^="gm-"]');
}