Skip to content

Commit a7c710e

Browse files
author
Christoph Singer
committed
Added testcase for customized indent_characters
1 parent 5b77a3b commit a7c710e

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

Tests/PrettyMinTest.php

+43
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,49 @@ function () {
132132
</body>
133133
</html>
134134
135+
HTML;
136+
137+
$this->assertEquals($expected, $pm->saveHtml());
138+
}
139+
140+
public function testIndentWithSpaces()
141+
{
142+
$pm = new PrettyMin(['indent_characters' => ' ']);
143+
$pm->load($this->getHtmlDocument());
144+
$pm->indent();
145+
$expected = <<<HTML
146+
<!DOCTYPE html>
147+
<html>
148+
<head>
149+
<title>Test</title>
150+
<script type="text/javascript"></script>
151+
<script>
152+
$(document).ready(
153+
function () {
154+
if (this && that && a > b) {
155+
doSomething();
156+
}
157+
}
158+
);
159+
</script>
160+
<style>
161+
body > div {
162+
border-top: 1px solid green;
163+
}
164+
</style>
165+
</head>
166+
<body>
167+
<h1>Test</h1>
168+
<div class="keep">
169+
<div class style>
170+
<p>This is <b>bold</b> Text. And some more text, still in the same paragraph. <strong>Inline tag </strong>whith whitespace at the end but not after.</p>
171+
<p>This is another paragraph with a <a href>link</a>.</p>
172+
</div>
173+
</div>
174+
<form><input type="text" name="a"><input type="text" name="b"></form>
175+
</body>
176+
</html>
177+
135178
HTML;
136179

137180
$this->assertEquals($expected, $pm->saveHtml());

0 commit comments

Comments
 (0)