11const { removeAtag} = require ( `${ SRC_PATH } /core/render/utils` ) ;
2+ const { tree} = require ( `${ SRC_PATH } /core/render/tpl` ) ;
23
34// Suite
45// -----------------------------------------------------------------------------
@@ -13,3 +14,30 @@ describe('core/render/utils', () => {
1314} ) ;
1415} ) ;
1516} ) ;
17+
18+ describe ( 'core/render/tpl' , ( ) => {
19+ test ( 'remove html tag in tree' , ( ) => {
20+ const result = tree ( [
21+ {
22+ level :2 ,
23+ slug :'#/cover?id=basic-usage' ,
24+ title :'<span style="color:red">Basic usage</span>' ,
25+ } ,
26+ {
27+ level :2 ,
28+ slug :'#/cover?id=custom-background' ,
29+ title :'Custom background' ,
30+ } ,
31+ {
32+ level :2 ,
33+ slug :'#/cover?id=test' ,
34+ title :
35+ '<img src="/docs/_media/favicon.ico" data-origin="/_media/favicon.ico" alt="ico">Test' ,
36+ } ,
37+ ] ) ;
38+
39+ expect ( result ) . toEqual (
40+ `<ul class="app-sub-sidebar"><li><a class="section-link" href="#/cover?id=basic-usage" title="Basic usage"><span style="color:red">Basic usage</span></a></li><li><a class="section-link" href="#/cover?id=custom-background" title="Custom background">Custom background</a></li><li><a class="section-link" href="#/cover?id=test" title="Test"><img src="/docs/_media/favicon.ico" data-origin="/_media/favicon.ico" alt="ico">Test</a></li></ul>`
41+ ) ;
42+ } ) ;
43+ } ) ;