Skip to content

Commit 24ed25d

Browse files
authored
Merge pull request #11 from PackageFactory/fixGeneratedStyleGuideForArrayTypes
Fix generated style guide for array types
2 parents 3d94507 + 89a5b73 commit 24ed25d

5 files changed

Lines changed: 20 additions & 20 deletions

File tree

Classes/Domain/Component/PropType/ComponentArrayPropType.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ public function getStyleGuideValue(int $nestingLevel = 0): string
4848
$componentPropType = new ComponentPropType($this->componentName, false);
4949
$componentStyleGuideValue = $componentPropType->getStyleGuideValue($nestingLevel + 1);
5050
return '{
51-
' . self::innerLeftPad($nestingLevel) . $componentStyleGuideValue . ',
52-
' . self::innerLeftPad($nestingLevel) . $componentStyleGuideValue . '
51+
' . self::innerLeftPad($nestingLevel) . '0 ' . $componentStyleGuideValue . '
52+
' . self::innerLeftPad($nestingLevel) . '1 ' .$componentStyleGuideValue . '
5353
' . self::outerLeftPad($nestingLevel) . '}';
5454
}
5555

Tests/Unit/Domain/Component/ComponentTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,13 +338,13 @@ public function testGetFusionContent(): void
338338
}
339339
}
340340
componentArray {
341-
{
341+
0 {
342342
text = \'Text\'
343343
other {
344344
number = 4711
345345
}
346-
},
347-
{
346+
}
347+
1 {
348348
text = \'Text\'
349349
other {
350350
number = 4711

Tests/Unit/Domain/Component/PropType/ComponentArrayPropTypeTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,13 @@ public function styleGuideValueProvider(): array
136136
[
137137
new ComponentArrayPropType(new ComponentName(new PackageKey('Vendor.Site'), FusionNamespace::default(), 'MyComponent')),
138138
'{
139-
{
139+
0 {
140140
text = \'Text\'
141141
other {
142142
number = 4711
143143
}
144-
},
145-
{
144+
}
145+
1 {
146146
text = \'Text\'
147147
other {
148148
number = 4711
@@ -153,13 +153,13 @@ public function styleGuideValueProvider(): array
153153
[
154154
new ComponentArrayPropType(new ComponentName(new PackageKey('Vendor.Site'), FusionNamespace::fromString('CustomType'), 'MyComponent')),
155155
'{
156-
{
156+
0 {
157157
text = \'Text\'
158158
other {
159159
number = 4711
160160
}
161-
},
162-
{
161+
}
162+
1 {
163163
text = \'Text\'
164164
other {
165165
number = 4711
@@ -170,13 +170,13 @@ public function styleGuideValueProvider(): array
170170
[
171171
new ComponentArrayPropType(new ComponentName(new PackageKey('Vendor.Site'), FusionNamespace::fromString('Custom.Type'), 'MyComponent')),
172172
'{
173-
{
173+
0 {
174174
text = \'Text\'
175175
other {
176176
number = 4711
177177
}
178-
},
179-
{
178+
}
179+
1 {
180180
text = \'Text\'
181181
other {
182182
number = 4711

Tests/Unit/Domain/Component/__snapshots__/ComponentGeneratorTest__generatesComponents with data set cardWithSharedTexts__5.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ prototype(Vendor.Site:Component.Card) < prototype(PackageFactory.AtomicFusion.Pr
1010
width = 1080
1111
}
1212
text {
13-
{
13+
0 {
1414
text = 'Text'
15-
},
16-
{
15+
}
16+
1 {
1717
text = 'Text'
1818
}
1919
}

Tests/Unit/Domain/Component/__snapshots__/ComponentGeneratorTest__generatesComponents with data set withTextArray__5.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ prototype(Vendor.Site:Component.WithTextArray) < prototype(PackageFactory.Atomic
66

77
props {
88
texts {
9-
{
9+
0 {
1010
text = 'Text'
11-
},
12-
{
11+
}
12+
1 {
1313
text = 'Text'
1414
}
1515
}

0 commit comments

Comments
 (0)