You are here

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

Test that Vue 3 SPA Components render.

File

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

Class

VueRenderTest
Vue Render tests.

Namespace

Drupal\Tests\pdb_vue\FunctionalJavascript

Code

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

  // Set the values the user submitted in the form.
  $config
    ->set('version', 'vue3');
  $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:vue3_spa_component', [
    'pdb_configuration' => [
      'textField' => 'component 1',
    ],
  ]);
  $this
    ->drupalPlaceBlock('vue_component:vue3_spa_component', [
    'pdb_configuration' => [
      'textField' => 'component 2',
    ],
  ]);
  $this
    ->drupalPlaceBlock('vue_component:vue3_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");
}