Skip to content
This repository has been archived by the owner on Oct 29, 2018. It is now read-only.

Commit

Permalink
Merge pull request #10 from mficzel/task/protectMetaPropertiesOnHtmlT…
Browse files Browse the repository at this point in the history
…agsFromPrefixing

BUGFIX: Protect meta-attributes of html-tags from prefixing
  • Loading branch information
mficzel authored May 5, 2017
2 parents f5c3106 + c187108 commit 9af27c5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Classes/Service/AfxService.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ protected static function astNodeToFusion($payload, $indentation = '')
if ($propName == '@key' || $propName == '@children') {
continue;
} else {
if ($attributePrefix && !in_array($propName, $attributePrefixExceptions)) {
if ($propName{0} === '@') {
$fusionName = $propName;
} elseif ($attributePrefix && !in_array($propName, $attributePrefixExceptions)) {
$fusionName = $attributePrefix . $propName;
} else {
$fusionName = $propName;
Expand Down
18 changes: 17 additions & 1 deletion Tests/Functional/AfxServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function attributesInFusionTagsAreConvertedToFusionPropertiesOrEelExpress
/**
* @test
*/
public function metaAttributesAreConvertedToFusionProperties()
public function metaAttributesOfFusionObjectTagsAreConvertedToFusionProperties()
{
$afxCode = '<Vendor.Site:Prototype @position="start" @if.hasTitle={title} />';
$expectedFusion = <<<'EOF'
Expand All @@ -129,6 +129,22 @@ public function metaAttributesAreConvertedToFusionProperties()
$this->assertEquals($expectedFusion, AfxService::convertAfxToFusion($afxCode));
}

/**
* @test
*/
public function metaAttributesOfHtmlTagsAreConvertedToFusionProperties()
{
$afxCode = '<div @position="start" @if.hasTitle={title} ></div>';
$expectedFusion = <<<'EOF'
Neos.Fusion:Tag {
tagName = 'div'
@position = 'start'
@if.hasTitle = ${title}
}
EOF;
$this->assertEquals($expectedFusion, AfxService::convertAfxToFusion($afxCode));
}

/**
* @test
*/
Expand Down

0 comments on commit 9af27c5

Please sign in to comment.