@@ -117,7 +117,7 @@ describe('open_graph', () => {
117
117
result . should . contain ( meta ( { property : 'og:url' , content : 'https://hexo.io/bar' } ) ) ;
118
118
} ) ;
119
119
120
- it ( 'url - should not ends with index.html ' , ( ) => {
120
+ it ( 'url - pretty_urls.trailing_index ' , ( ) => {
121
121
hexo . config . pretty_urls . trailing_index = false ;
122
122
const result = openGraph . call ( {
123
123
page : { } ,
@@ -128,11 +128,47 @@ describe('open_graph', () => {
128
128
129
129
const $ = cheerio . load ( result ) ;
130
130
131
- $ ( 'meta[property="og:url"]' ) . attr ( 'content' ) . endsWith ( 'index.html' ) . should . be . false ;
131
+ $ ( 'meta[property="og:url"]' ) . attr ( 'content' ) . endsWith ( 'index.html' ) . should . eql ( false ) ;
132
132
133
133
hexo . config . pretty_urls . trailing_index = true ;
134
134
} ) ;
135
135
136
+ it ( 'url - pretty_urls.trailing_html' , ( ) => {
137
+ hexo . config . pretty_urls . trailing_html = false ;
138
+ const result = openGraph . call ( {
139
+ page : { } ,
140
+ config : hexo . config ,
141
+ is_post : isPost ,
142
+ url : 'http://yoursite.com/page/about.html'
143
+ } ) ;
144
+
145
+ const $ = cheerio . load ( result ) ;
146
+
147
+ $ ( 'meta[property="og:url"]' ) . attr ( 'content' ) . endsWith ( '.html' ) . should . eql ( false ) ;
148
+
149
+ hexo . config . pretty_urls . trailing_html = true ;
150
+ } ) ;
151
+
152
+ it ( 'url - null pretty_urls' , ( ) => {
153
+ hexo . config . pretty_urls = null ;
154
+ const url = 'http://yoursite.com/page/about.html' ;
155
+ const result = openGraph . call ( {
156
+ page : { } ,
157
+ config : hexo . config ,
158
+ is_post : isPost ,
159
+ url
160
+ } ) ;
161
+
162
+ const $ = cheerio . load ( result ) ;
163
+
164
+ $ ( 'meta[property="og:url"]' ) . attr ( 'content' ) . should . eql ( url ) ;
165
+
166
+ hexo . config . pretty_urls = {
167
+ trailing_index : true ,
168
+ trailing_html : true
169
+ } ;
170
+ } ) ;
171
+
136
172
it ( 'url - IDN' , ( ) => {
137
173
const ctx = {
138
174
page : { } ,
0 commit comments