function DesignTokenConfigEntityKernelTest::testToCss
Tests CSS export.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Theme/ DesignToken/ DesignTokenConfigEntityKernelTest.php, line 147
Class
- DesignTokenConfigEntityKernelTest
- Tests values are from test module design_tokens_test.
Namespace
Drupal\KernelTests\Core\Theme\DesignTokenCode
public function testToCss() : void {
$values = [
'id' => 'my_id',
'path' => 'foo.bar.baz',
'type' => 'dimension',
'scopes' => [
':root' => [
'value' => 12,
'unit' => 'px',
],
'%card' => [
'value' => 14,
'unit' => 'rem',
],
],
];
$expected = ':root{--foo-bar-baz:12px;}.card{--foo-bar-baz:14rem;}';
/** @var \Drupal\Core\Theme\Entity\DesignTokenInterface $config */
$config = $this->entityTypeManager
->getStorage('design_token')
->create($values);
$this->assertEquals($expected, DesignToken::toCss([
$config,
]));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.