Skip to content

Commit efd35a9

Browse files
committed
Merge remote-tracking branch 'adobe-commerce-tier-4/ACP2E-3350' into Tier4-Kings-PR-10-28-2024
2 parents 108de23 + 57f0c03 commit efd35a9

File tree

3 files changed

+72
-7
lines changed
  • app
    • code/Magento/Catalog/Block/Adminhtml/Category
    • design/adminhtml/Magento/backend/Magento_Catalog/web/css/source
  • dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Category

3 files changed

+72
-7
lines changed

app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2024 Adobe
4+
* All Rights Reserved.
55
*/
66

77
/**
@@ -392,8 +392,7 @@ protected function _getNodeJson($node, $level = 0)
392392
$item['id'] = $node->getId();
393393
$item['store'] = (int)$this->getStore()->getId();
394394
$item['path'] = $node->getData('path');
395-
396-
$item['cls'] = 'folder ' . ($node->getIsActive() ? 'active-category' : 'no-active-category');
395+
$item['a_attr'] = ['class' => $node->getIsActive() ? 'active-category' : 'not-active-category'];
397396
//$item['allowDrop'] = ($level<3) ? true : false;
398397
$allowMove = $this->_isCategoryMoveable($node);
399398
$item['allowDrop'] = $allowMove;

app/design/adminhtml/Magento/backend/Magento_Catalog/web/css/source/_module.less

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
// /**
2-
// * Copyright © Magento, Inc. All rights reserved.
3-
// * See COPYING.txt for license details.
2+
// * Copyright 2024 Adobe
3+
// * All Rights Reserved.
44
// */
55

6+
@color-grey: #aaa;
7+
68
//
79
// Catalog product grid
810
// ---------------------------------------------
@@ -71,7 +73,7 @@
7173

7274
.catalog-category-edit,
7375
.catalog-category-add {
74-
// TODO: refactor trees
76+
// TODO refactor trees
7577
.x-tree.tree-wrapper {
7678
overflow-x: auto;
7779
}
@@ -121,3 +123,13 @@
121123
}
122124
}
123125
}
126+
127+
//
128+
// Catalog Category Tree
129+
// ---------------------------------------------
130+
131+
.jstree-children {
132+
.not-active-category {
133+
color: @color-grey;
134+
}
135+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
/**
3+
* Copyright 2024 Adobe
4+
* All Rights Reserved.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Catalog\Block\Adminhtml\Category;
9+
10+
use Magento\Catalog\Test\Fixture\Category as CategoryFixture;
11+
use Magento\Framework\View\LayoutInterface;
12+
use Magento\TestFramework\Fixture\AppArea;
13+
use Magento\TestFramework\Fixture\DataFixture;
14+
use Magento\TestFramework\Fixture\DataFixtureStorage;
15+
use Magento\TestFramework\Fixture\DataFixtureStorageManager;
16+
use Magento\TestFramework\TestCase\AbstractBackendController;
17+
18+
/**
19+
* Test for categories in the tree block.
20+
*/
21+
class TreeBlockTest extends AbstractBackendController
22+
{
23+
24+
/**
25+
* @var DataFixtureStorage
26+
*/
27+
private $fixtures;
28+
29+
protected function setUp(): void
30+
{
31+
parent::setUp();
32+
$this->fixtures = $this->_objectManager->get(DataFixtureStorageManager::class)->getStorage();
33+
}
34+
35+
/**
36+
* Test disabled categories in the tree block.
37+
*/
38+
#[
39+
AppArea('adminhtml'),
40+
DataFixture(CategoryFixture::class, as: 'c10'),
41+
DataFixture(CategoryFixture::class, ['parent_id' => '$c10.id$', 'is_active' => false], 'c11'),
42+
]
43+
public function testDisabledCategoriesHtml()
44+
{
45+
$category = $this->fixtures->get('c10');
46+
$layout = $this->_objectManager->get(LayoutInterface::class);
47+
$categoryTreeBlock = $layout->createBlock(Tree::class);
48+
$categoryTreeArray = $categoryTreeBlock->getTree($category);
49+
$this->assertCount(1, $categoryTreeArray);
50+
$this->assertArrayHasKey('a_attr', $categoryTreeArray[0]);
51+
$this->assertArrayHasKey('class', $categoryTreeArray[0]['a_attr']);
52+
$this->assertStringContainsString('not-active-category', $categoryTreeArray[0]['a_attr']['class']);
53+
}
54+
}

0 commit comments

Comments
 (0)