You are here

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

Tests the attachLibraries() method.

See also

::create()

File

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

Class

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

Namespace

Drupal\Tests\pdb_vue\Unit\Plugin\Block

Code

public function testAttachLibraries() {
  $component = [
    'machine_name' => 'vue-example-1',
    'component' => TRUE,
    'add_js' => [
      'footer' => [
        'vue-example-1.js' => [],
      ],
    ],
  ];
  $expected = [
    'library' => [
      'pdb/vue-example-1/footer',
      'pdb_vue/vue.spa-init',
    ],
  ];
  $return = $this->plugin
    ->attachLibraries($component);
  $this
    ->assertArrayEquals($expected, $return);
}