public function GridStackManagerTest::testGridStackManagerMethods in GridStack 8
Same name and namespace in other branches
- 8.2 tests/src/Kernel/GridStackManagerTest.php \Drupal\Tests\gridstack\Kernel\GridStackManagerTest::testGridStackManagerMethods()
Tests cases for various methods.
@covers ::attach @covers ::getSkins @covers ::getSkinOptions @covers ::libraryInfoBuild
File
- tests/
src/ Kernel/ GridStackManagerTest.php, line 95
Class
- GridStackManagerTest
- Tests the GridStack manager methods.
Namespace
Drupal\Tests\gridstack\KernelCode
public function testGridStackManagerMethods() {
$manager = $this->gridstackManager;
// @todo: Use @dataProvider
$settings = [
'use_js' => TRUE,
'skin' => 'selena',
'width' => 11,
'breakpoints' => [
'lg' => [
'column' => 11,
],
],
] + $this
->getFormatterSettings();
$attachments = $manager
->attach($settings);
$this
->assertArrayHasKey('gridstack', $attachments['drupalSettings']);
// Tests for skins.
$skins = $manager
->getSkins();
$this
->assertArrayHasKey('default', $skins);
// Verify we have cached skins.
$cid = 'gridstack:skins';
$cached_skins = $manager
->getCache()
->get($cid);
$this
->assertEquals($cid, $cached_skins->cid);
$this
->assertEquals($skins, $cached_skins->data);
// Verify skins has default skin.
$defined_skins = $manager
->getSkinOptions();
$this
->assertArrayHasKey('default', $defined_skins);
// Verify libraries.
$libraries = $manager
->libraryInfoBuild();
$this
->assertArrayHasKey('gridstack.default', $libraries);
// @todo $id = 'core.entity_view_display.*.*.*.third_party.ds';
// @todo $definitions[$id] = [];
// @todo $manager::configSchemaInfoAlter($definitions);
// @todo $this->assertArrayHasKey($id, $definitions);
}