You are here

public function VueBlockTest::testAttachSettings in Decoupled Blocks: Vue.js 8

Tests the attachSettings() method.

File

tests/src/Unit/Plugin/Block/VueBlockTest.php, line 136

Class

VueBlockTest
@coversDefaultClass \Drupal\pdb_vue\Plugin\Block\VueBlock @group pdb_vue

Namespace

Drupal\Tests\pdb_vue\Unit\Plugin\Block

Code

public function testAttachSettings() {
  $component = [
    'machine_name' => 'vue-example-1',
    'component' => TRUE,
    'add_js' => [
      'footer' => [
        'vue-example-1.js' => [],
      ],
    ],
  ];
  $expected = [
    'drupalSettings' => [
      'pdbVue' => [
        'developmentMode' => 1,
        'spaElement' => '#page-wrapper',
      ],
    ],
  ];
  $return = $this->plugin
    ->attachSettings($component);
  $this
    ->assertArrayEquals($expected, $return);
}