public function VueBlockTest::testAttachLibrariesInline in Decoupled Blocks: Vue.js 8
Tests the attachLibraries() method of "libraries" with inline scripts.
See also
::create()
File
- tests/
src/ Unit/ Plugin/ Block/ VueBlockTest.php, line 192
Class
- VueBlockTest
- @coversDefaultClass \Drupal\pdb_vue\Plugin\Block\VueBlock @group pdb_vue
Namespace
Drupal\Tests\pdb_vue\Unit\Plugin\BlockCode
public function testAttachLibrariesInline() {
$component = [
'machine_name' => 'vue-example-1',
'component' => TRUE,
'add_js' => [
'footer' => [
'vue-example-1.js' => [],
],
],
'libraries' => [
'pdb_vue/vuex',
],
];
// Add the Vuex library between inline and spa-init.
$expected = [
'library' => [
'pdb/vue-example-1/footer',
'pdb_vue/vuex',
'pdb_vue/vue.spa-init',
],
];
$return = $this->plugin
->attachLibraries($component);
$this
->assertArrayEquals($expected, $return);
}