Skip to content

Commit 001c1a9

Browse files
committed
docs(readme): adjust doc
1 parent 832c5dc commit 001c1a9

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,36 @@ use this method during tests to pretty print `ComponentFixtures`,
2323

2424
## Examples
2525

26+
### Pass in specific DebugElement
27+
2628
In your test you can simply write the following line.
2729

28-
![logNgHTML](https://raw.githubusercontent.com/angular-extensions/pretty-html-log/master/images/console.logNgHMTL.png)
30+
```
31+
console.logNgHTML(
32+
fixture.debugElement.query(By.css('mat-tab-body'))
33+
)
34+
```
2935

3036
Which will print the following string to your console
3137

3238
![logNgHTML](https://raw.githubusercontent.com/angular-extensions/pretty-html-log/master/images/output.png)
39+
40+
### Further examples
41+
42+
Instead of passing in a DebugElement you can also pass in a fixture:
43+
44+
```
45+
console.logNgHTML(fixture);
46+
```
47+
48+
or a nativeElement
49+
50+
```
51+
console.logNgHTML(fixture.debugElement.nativeElement);
52+
```
53+
54+
or even a simple HTML string
55+
56+
```
57+
console.logNgHTML('<h1>Foo</h1>');
58+
```

images/console.logNgHMTL.png

-39.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)