12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- namespace Drupal\FunctionalJavascriptTests;
- class JavascriptGetDrupalSettingsTest extends WebDriverTestBase {
-
- protected static $modules = ['test_page_test'];
-
- protected $defaultTheme = 'stark';
-
- public function testGetDrupalSettings() {
- $this->drupalLogin($this->drupalCreateUser());
- $this->drupalGet('test-page');
-
- $js_settings = $this->getDrupalSettings();
- $this->assertSame('azAZ09();.,\\\/-_{}', $js_settings['test-setting']);
-
- $script = <<<EndOfScript
- (function () {
- drupalSettings['test-setting'] = 'foo';
- })();
- EndOfScript;
- $this->getSession()->evaluateScript($script);
-
- $js_settings = $this->getDrupalSettings();
- $this->assertSame('foo', $js_settings['test-setting']);
- }
- }
|