test: add tests for keepOutputType option

This commit is contained in:
Alex de Wergifosse
2020-12-16 10:20:10 +08:00
committed by Jun Yang
parent cd92e77726
commit b8e4b3337b
3 changed files with 97 additions and 1 deletions
+5 -1
View File
@@ -9,7 +9,11 @@ export class Emitter {
}
public write (html: any) {
if (this.keepOutputType && typeof html !== 'string') {
// This will only preserve the type if the value is isolated.
// I.E:
// {{ my-port }} -> 42
// {{ my-host }}:{{ my-port }} -> 'host:42'
if (this.keepOutputType === true && typeof html !== 'string' && this.html === '') {
this.html = html
} else {
this.html += html as string