Skip to content

Commit

Permalink
🔃 [EngCom] Public Pull Requests - 2.2-develop
Browse files Browse the repository at this point in the history
Accepted Public Pull Requests:
 - magento#21804: [Backport] Issue magento#10645 - Allow BEM class via attribute tag. Public (by @amol2jcommerce)


Fixed GitHub Issues:
 - magento#10645: Adding BEM class in XML via attribute tag causes class to be rewritten (reported by @Zaylril) has been fixed in magento#21804 by @amol2jcommerce in 2.2-develop branch
   Related commits:
     1. ab7aee9
     2. 743c034
  • Loading branch information
magento-engcom-team authored Mar 20, 2019
2 parents 8c3d3b2 + 2964861 commit de307c7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/internal/Magento/Framework/View/Page/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ public function addRss($title, $href)
*/
public function addBodyClass($className)
{
$className = preg_replace('#[^a-z0-9]+#', '-', strtolower($className));
$className = preg_replace('#[^a-z0-9-_]+#', '-', strtolower($className));
$bodyClasses = $this->getElementAttribute(self::ELEMENT_TYPE_BODY, self::BODY_ATTRIBUTE_CLASS);
$bodyClasses = $bodyClasses ? explode(' ', $bodyClasses) : [];
$bodyClasses[] = $className;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ public function testProcess()
->method('getPageConfigStructure')
->willReturn($structureMock);

$bodyClasses = ['class_1', 'class_2'];
$bodyClasses = ['class_1', 'class--2'];
$structureMock->expects($this->once())
->method('getBodyClasses')
->will($this->returnValue($bodyClasses));
$this->pageConfigMock->expects($this->exactly(2))
->method('addBodyClass')
->withConsecutive(['class_1'], ['class_2']);
->withConsecutive(['class_1'], ['class--2']);

$this->assertEquals(
$this->bodyGenerator,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function testSetElementAttribute()
public function testSetBodyClass()
{
$class1 = 'class_1';
$class2 = 'class_2';
$class2 = 'class--2';
$expected = [$class1, $class2];
$this->structure->setBodyClass($class1);
$this->structure->setBodyClass($class2);
Expand Down

0 comments on commit de307c7

Please sign in to comment.