Base UI
NPM Installation / build (16.x, ubuntu-latest) (push) Has been cancelled
NPM Installation / build (16.x, windows-latest) (push) Has been cancelled
NPM Installation / build (17.x, ubuntu-latest) (push) Has been cancelled
NPM Installation / build (17.x, windows-latest) (push) Has been cancelled
NPM Installation / build (18.x, ubuntu-latest) (push) Has been cancelled
NPM Installation / build (18.x, windows-latest) (push) Has been cancelled

This commit is contained in:
2026-06-25 11:15:13 +07:00
parent c539fe47af
commit cc038a7372
20561 changed files with 1811255 additions and 41 deletions
+98
View File
@@ -0,0 +1,98 @@
/* global describe,it */
var getSlug = require('../lib/speakingurl');
describe('getSlug with custom replacement', function () {
'use strict';
it('should be transliterated', function (done) {
getSlug('буу', {
lang: false,
custom: {
'б': 'б',
'у': 'у'
}
})
.should.eql('буу');
getSlug('[nodejs]', {
custom: {
'[': '[',
']': ']'
}
})
.should.eql('[nodejs]');
getSlug('[Äpfel]', {
custom: {
'[': '[',
']': ']'
}
})
.should.eql('[aepfel]');
getSlug('[Äpfel]', {
lang: false,
custom: {
'[': '[',
']': ']'
}
})
.should.eql('[aepfel]');
done();
});
it('should be extended with allowed chars', function (done) {
getSlug('буу', {
custom: ['б', 'у']
})
.should.eql('буу');
getSlug('[Knöpfe]', {
custom: ['[', ']']
})
.should.eql('[knoepfe]');
getSlug('[Knöpfe & Ösen]', {
custom: ['[', ']']
})
.should.eql('[knoepfe-and-oesen]');
getSlug('[Knöpfe & Ösen]', {
custom: ['[', ']'],
lang: 'de'
})
.should.eql('[knoepfe-und-oesen]');
getSlug('[Knöpfe]', {
maintainCase: true,
custom: ['[', ']']
})
.should.eql('[Knoepfe]');
getSlug('[Knöpfe haben Löcher]', {
titleCase: true,
custom: ['[', ']']
})
.should.eql('[Knoepfe-Haben-Loecher]');
getSlug('[knöpfe haben runde löcher]', {
titleCase: ['haben', 'runde'],
custom: ['[', ']']
})
.should.eql('[Knoepfe-haben-runde-Loecher]');
getSlug('[knöpfe haben runde löcher]', {
titleCase: ['haben', 'runde'],
maintainCase: true,
custom: ['[', ']']
})
.should.eql('[Knoepfe-haben-runde-Loecher]');
done();
});
});