You are here

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

Tests the attachLibraries() method of "libraries" without inline scripts.

See also

::create()

File

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

Class

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

Namespace

Drupal\Tests\pdb_vue\Unit\Plugin\Block

Code

public function testAttachLibrariesNoInline() {
  $component = [
    'machine_name' => 'vue-example-1',
    'libraries' => [
      'pdb_vue/vuex',
    ],
  ];

  // The main Vue library should be attached in addition to the declared Vuex.
  $expected = [
    'library' => [
      'pdb_vue/vue',
      'pdb_vue/vuex',
    ],
  ];
  $return = $this->plugin
    ->attachLibraries($component);
  $this
    ->assertArrayEquals($expected, $return);
}