From db46e42d06fbb99ef4e60193a8c705568c3d2491 Mon Sep 17 00:00:00 2001 From: Marc Ginesta Date: Tue, 31 Aug 2021 10:48:21 +0200 Subject: [PATCH 1/2] AC-945: Create unit test for Magento2\Less\CommentLevelsSniff check --- .../Tests/Less/CommentLevelsUnitTest.less | 48 +++++++++++++++++++ Magento2/Tests/Less/CommentLevelsUnitTest.php | 32 +++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 Magento2/Tests/Less/CommentLevelsUnitTest.less create mode 100644 Magento2/Tests/Less/CommentLevelsUnitTest.php diff --git a/Magento2/Tests/Less/CommentLevelsUnitTest.less b/Magento2/Tests/Less/CommentLevelsUnitTest.less new file mode 100644 index 00000000..8555d1a7 --- /dev/null +++ b/Magento2/Tests/Less/CommentLevelsUnitTest.less @@ -0,0 +1,48 @@ +// /** +// * Copyright © Magento, Inc. All rights reserved. +// * See COPYING.txt for license details. +// */ + +// +// First level comment +// _____________________________________________ + +.first-level { + background-color: green; +} + +// +// Incorrect First level comment +// _____________________________________________ +.incorrect-first-level { + background-color: red; +} + +// +// Second level comment +// --------------------------------------------- + +.second-level { + background-color: green; +} + +// +// Incorrect Second level comment +// --------------------------------------------- + +.incorrect-second-level { + background-color: red; +} + +// third level comment +.third-level-nav { + // New line comment, considered third level too + background-color: green; // ToDo UI: todo inline comment + color: white; // inline comment +} + +//Incorrect third level comment +.incorrect-third-level { + // Incorrect new line comment + color: red; // incorrect inline comment +} \ No newline at end of file diff --git a/Magento2/Tests/Less/CommentLevelsUnitTest.php b/Magento2/Tests/Less/CommentLevelsUnitTest.php new file mode 100644 index 00000000..9e5315d9 --- /dev/null +++ b/Magento2/Tests/Less/CommentLevelsUnitTest.php @@ -0,0 +1,32 @@ + 1, + 30 => 1, + 31 => 1, + 44 => 1, + 46 => 1, + 47 => 1 + ]; + } + + /** + * @inheritdoc + */ + public function getWarningList() + { + return []; + } +} From fbca4de2340a9fd35fb10153aef41dd0c68affb5 Mon Sep 17 00:00:00 2001 From: Marc Ginesta Date: Tue, 31 Aug 2021 10:49:48 +0200 Subject: [PATCH 2/2] AC-945: Create unit test for Magento2\Less\CommentLevelsSniff check - Add new line at the EOF --- Magento2/Tests/Less/CommentLevelsUnitTest.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Magento2/Tests/Less/CommentLevelsUnitTest.less b/Magento2/Tests/Less/CommentLevelsUnitTest.less index 8555d1a7..77d3dbd7 100644 --- a/Magento2/Tests/Less/CommentLevelsUnitTest.less +++ b/Magento2/Tests/Less/CommentLevelsUnitTest.less @@ -45,4 +45,4 @@ .incorrect-third-level { // Incorrect new line comment color: red; // incorrect inline comment -} \ No newline at end of file +}