You are here

public function VueRenderTest::testSpaComponentsRenders in Decoupled Blocks: Vue.js 8

Test that Vue SPA Components render.

File

tests/src/FunctionalJavascript/VueRenderTest.php, line 73

Class

VueRenderTest
Vue Render tests.

Namespace

Drupal\Tests\pdb_vue\FunctionalJavascript

Code

public function testSpaComponentsRenders() {
  $assert = $this
    ->assertSession();
  $config = $this
    ->config('pdb_vue.settings');

  // Set the values the user submitted in the form.
  $config
    ->set('version', 'vue2');
  $config
    ->set('development_mode', TRUE);
  $config
    ->set('use_spa', TRUE);
  $config
    ->set('spa_element', 'main');
  $config
    ->save();

  // Place 3 "SPA Component" blocks.
  $this
    ->drupalPlaceBlock('vue_component:vue_spa_component', [
    'pdb_configuration' => [
      'textField' => 'component 1',
    ],
  ]);
  $this
    ->drupalPlaceBlock('vue_component:vue_spa_component', [
    'pdb_configuration' => [
      'textField' => 'component 2',
    ],
  ]);
  $this
    ->drupalPlaceBlock('vue_component:vue_spa_component', [
    'pdb_configuration' => [
      'textField' => 'component 3',
    ],
  ]);
  $this
    ->drupalGet('<front>');
  $assert
    ->waitForElement('css', '.test');
  $assert
    ->pageTextContains("component 1");
  $assert
    ->pageTextContains("component 2");
  $assert
    ->pageTextContains("component 3");
}