Skip to content

Commit 1dd90d0

Browse files
committed
AC-952: Create unit test for Magento2\Less\SemicolonSpacingSniff check
- Refactor: Fix wrong index and adapt tests accordingly
1 parent 8466588 commit 1dd90d0

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

Magento2/Sniffs/Less/SemicolonSpacingSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ private function validateSemicolon(File $phpcsFile, $stackPtr, array $tokens, $s
8383
{
8484
if ((false === $semicolonPtr || $tokens[$semicolonPtr]['line'] !== $tokens[$stackPtr]['line'])
8585
&& (isset($tokens[$stackPtr - 1]) && !in_array($tokens[$stackPtr - 1]['code'], $this->styleCodesToSkip))
86-
&& (T_COLON !== $tokens[$stackPtr + 1]['code'])
86+
&& (T_COLON !== $tokens[$stackPtr]['code'])
8787
) {
8888
$error = 'Style definitions must end with a semicolon';
8989
$phpcsFile->addError($error, $stackPtr, 'NotAtEnd');

Magento2/Tests/Less/SemicolonSpacingUnitTest.less

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
// */
55

66
.nav {
7-
background-color: green
7+
background-color: green;
88
}
99

1010
.nav-list {
11-
background-color: red
12-
color: white
11+
background-color: red ;
12+
color: red
1313
}

Magento2/Tests/Less/SemicolonSpacingUnitTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ class SemicolonSpacingUnitTest extends AbstractLessSniffUnitTestCase
1313
public function getErrorList()
1414
{
1515
return [
16-
11 => 1
16+
11 => 1,
17+
12 => 1
1718
];
1819
}
1920

0 commit comments

Comments
 (0)