@@ -231,7 +231,13 @@ describe('html-to-text', function() {
231
231
232
232
it ( 'should handle an unordered list with multiple elements' , function ( ) {
233
233
var testString = '<ul><li>foo</li><li>bar</li></ul>' ;
234
- expect ( htmlToText . fromString ( testString ) ) . to . equal ( '* foo\n * bar' ) ;
234
+ expect ( htmlToText . fromString ( testString ) ) . to . equal ( ' * foo\n * bar' ) ;
235
+ } ) ;
236
+
237
+ it ( 'should handle an unordered list prefix option' , function ( ) {
238
+ var testString = '<ul><li>foo</li><li>bar</li></ul>' ;
239
+ var options = { unorderedListItemPrefix : ' test ' } ;
240
+ expect ( htmlToText . fromString ( testString , options ) ) . to . equal ( ' test foo\n test bar' ) ;
235
241
} ) ;
236
242
} ) ;
237
243
@@ -243,46 +249,46 @@ describe('html-to-text', function() {
243
249
244
250
it ( 'should handle an ordered list with multiple elements' , function ( ) {
245
251
var testString = '<ol><li>foo</li><li>bar</li></ol>' ;
246
- expect ( htmlToText . fromString ( testString ) ) . to . equal ( '1. foo\n 2. bar' ) ;
252
+ expect ( htmlToText . fromString ( testString ) ) . to . equal ( ' 1. foo\n 2. bar' ) ;
247
253
} ) ;
248
254
249
255
it ( 'should support the ordered list type="1" attribute' , function ( ) {
250
256
var testString = '<ol type="1"><li>foo</li><li>bar</li></ol>' ;
251
- expect ( htmlToText . fromString ( testString ) ) . to . equal ( '1. foo\n 2. bar' ) ;
257
+ expect ( htmlToText . fromString ( testString ) ) . to . equal ( ' 1. foo\n 2. bar' ) ;
252
258
} ) ;
253
259
254
260
it ( 'should fallback to type="!" behavior if type attribute is invalid' , function ( ) {
255
261
var testString = '<ol type="1"><li>foo</li><li>bar</li></ol>' ;
256
- expect ( htmlToText . fromString ( testString ) ) . to . equal ( '1. foo\n 2. bar' ) ;
262
+ expect ( htmlToText . fromString ( testString ) ) . to . equal ( ' 1. foo\n 2. bar' ) ;
257
263
} ) ;
258
264
259
265
it ( 'should support the ordered list type="a" attribute' , function ( ) {
260
266
var testString = '<ol type="a"><li>foo</li><li>bar</li></ol>' ;
261
- expect ( htmlToText . fromString ( testString ) ) . to . equal ( 'a. foo\n b. bar' ) ;
267
+ expect ( htmlToText . fromString ( testString ) ) . to . equal ( ' a. foo\n b. bar' ) ;
262
268
} ) ;
263
269
264
270
it ( 'should support the ordered list type="A" attribute' , function ( ) {
265
271
var testString = '<ol type="A"><li>foo</li><li>bar</li></ol>' ;
266
- expect ( htmlToText . fromString ( testString ) ) . to . equal ( 'A. foo\n B. bar' ) ;
272
+ expect ( htmlToText . fromString ( testString ) ) . to . equal ( ' A. foo\n B. bar' ) ;
267
273
} ) ;
268
274
269
275
it ( 'should support the ordered list type="i" attribute by falling back to type="1"' , function ( ) {
270
276
var testString = '<ol type="i"><li>foo</li><li>bar</li></ol>' ;
271
277
// TODO Implement lowercase roman numerals
272
278
// expect(htmlToText.fromString(testString)).to.equal('i. foo\nii. bar');
273
- expect ( htmlToText . fromString ( testString ) ) . to . equal ( '1. foo\n 2. bar' ) ;
279
+ expect ( htmlToText . fromString ( testString ) ) . to . equal ( ' 1. foo\n 2. bar' ) ;
274
280
} ) ;
275
281
276
282
it ( 'should support the ordered list type="I" attribute by falling back to type="1"' , function ( ) {
277
283
var testString = '<ol type="I"><li>foo</li><li>bar</li></ol>' ;
278
284
// TODO Implement uppercase roman numerals
279
285
// expect(htmlToText.fromString(testString)).to.equal('I. foo\nII. bar');
280
- expect ( htmlToText . fromString ( testString ) ) . to . equal ( '1. foo\n 2. bar' ) ;
286
+ expect ( htmlToText . fromString ( testString ) ) . to . equal ( ' 1. foo\n 2. bar' ) ;
281
287
} ) ;
282
288
283
289
it ( 'should support the ordered list start attribute' , function ( ) {
284
290
var testString = '<ol start="2"><li>foo</li><li>bar</li></ol>' ;
285
- expect ( htmlToText . fromString ( testString ) ) . to . equal ( '2. foo\n 3. bar' ) ;
291
+ expect ( htmlToText . fromString ( testString ) ) . to . equal ( ' 2. foo\n 3. bar' ) ;
286
292
} ) ;
287
293
288
294
/*
0 commit comments