Skip to content

Commit e88ceb0

Browse files
committed
Fix expansion operator
1 parent 868694e commit e88ceb0

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/Phug/Compiler/ElementCompiler.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ public function compileNode(NodeInterface $node, ElementInterface $parent = null
4242

4343
$this->compileNodeChildren($node, $markup);
4444

45+
$outer = $node->getOuterNode();
46+
if ($outer) {
47+
$outerMarkup = $compiler->compileNode($outer);
48+
$outerMarkup->appendChild($markup);
49+
50+
return $outerMarkup;
51+
}
52+
4553
return $markup;
4654
}
4755
}

tests/Phug/Compiler/ElementCompilerTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ public function testCompile()
2222
$this->assertCompile('<section />', 'section/');
2323
}
2424

25+
/**
26+
* @covers ::<public>
27+
*/
28+
public function testExpansionCompile()
29+
{
30+
$this->assertCompile(
31+
'<ul><li class="list-item"><div class="foo"><div id="bar">baz</div></div></li></ul>',
32+
"ul\n li.list-item: .foo: #bar baz"
33+
);
34+
}
35+
2536
/**
2637
* @covers ::<public>
2738
* @expectedException \Phug\CompilerException

0 commit comments

Comments
 (0)