Skip to content

AC-956: Create unit test for Magento2\Less\ZeroUnitsSniff check #251

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Magento2/Sniffs/Less/ZeroUnitsSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* Ensure that units for 0 is not specified
* Omit leading "0"s in values, use dot instead
*
* @link https://devdocs.magento.com/guides/v2.4/coding-standards/code-standard-less.html#and-units
* @link https://devdocs.magento.com/guides/v2.4/coding-standards/code-standard-less.html#0-and-units
* @link https://devdocs.magento.com/guides/v2.4/coding-standards/code-standard-less.html#floating-values
*/
class ZeroUnitsSniff implements Sniff
Expand Down
14 changes: 14 additions & 0 deletions Magento2/Tests/Less/ZeroUnitsUnitTest.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// /**
// * Copyright © Magento, Inc. All rights reserved.
// * See COPYING.txt for license details.
// */

.my{
border-width: 0px;
margin-left: 0.5rem;
}

.foo {
border-width: 0;
margin-left: .5rem;
}
28 changes: 28 additions & 0 deletions Magento2/Tests/Less/ZeroUnitsUnitTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
/**
* Copyright © Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento2\Tests\Less;

class ZeroUnitsUnitTest extends AbstractLessSniffUnitTestCase
{
/**
* @inheritdoc
*/
public function getErrorList()
{
return [
7 => 1,
8 => 1,
];
}

/**
* @inheritdoc
*/
public function getWarningList()
{
return [];
}
}