public function GeolocationJavascriptTest::testGoogleMapFormatterCustomSettings in Geolocation Field 8
Same name and namespace in other branches
- 8.3 tests/src/FunctionalJavascript/GeolocationJavascriptTest.php \Drupal\Tests\geolocation\FunctionalJavascript\GeolocationJavascriptTest::testGoogleMapFormatterCustomSettings()
- 8.2 tests/src/FunctionalJavascript/GeolocationJavascriptTest.php \Drupal\Tests\geolocation\FunctionalJavascript\GeolocationJavascriptTest::testGoogleMapFormatterCustomSettings()
Tests the Google Maps formatter.
File
- tests/
src/ FunctionalJavascript/ GeolocationJavascriptTest.php, line 212
Class
- GeolocationJavascriptTest
- Tests the JavaScript functionality.
Namespace
Drupal\Tests\geolocation\FunctionalJavascriptCode
public function testGoogleMapFormatterCustomSettings() {
$this
->drupalGetFilterGoogleKey('node/4');
$this
->assertSession()
->elementExists('css', '.geolocation-google-map');
$this
->assertSession()
->elementAttributeContains('css', '.geolocation-google-map', 'style', 'height: 376px');
// If Google works, either gm-style or gm-err-container will be present.
$this
->assertSession()
->elementExists('css', '.geolocation-google-map [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
->drupalGetFilterGoogleKey('node/4/edit');
$this
->assertSession()
->fieldExists("field_geolocation[0][google_map_settings][height]");
$edit = [
'title[0][value]' => $this
->randomMachineName(),
'field_geolocation[0][google_map_settings][height]' => '273px',
];
$this
->drupalPostForm(NULL, $edit, t('Save'));
$this
->drupalGetFilterGoogleKey('node/4');
$this
->assertSession()
->elementExists('css', '.geolocation-google-map');
$this
->assertSession()
->elementAttributeContains('css', '.geolocation-google-map', 'style', 'height: 273px;');
// If Google works, either gm-style or gm-err-container will be present.
$this
->assertSession()
->elementExists('css', '.geolocation-google-map [class^="gm-"]');
}