2017-06-13 19:34:42 +02:00
|
|
|
/* global QUnit, URLify */
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
QUnit.module('admin.URLify');
|
|
|
|
|
|
|
|
QUnit.test('empty string', function(assert) {
|
|
|
|
assert.strictEqual(URLify('', 8, true), '');
|
|
|
|
});
|
|
|
|
|
2020-05-20 19:11:30 +02:00
|
|
|
QUnit.test('preserve nonessential words', function(assert) {
|
|
|
|
assert.strictEqual(URLify('the D is silent', 15, true), 'the-d-is-silent');
|
2017-06-13 19:34:42 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
QUnit.test('strip non-URL characters', function(assert) {
|
|
|
|
assert.strictEqual(URLify('D#silent@', 7, true), 'dsilent');
|
|
|
|
});
|
|
|
|
|
|
|
|
QUnit.test('merge adjacent whitespace', function(assert) {
|
|
|
|
assert.strictEqual(URLify('D silent', 8, true), 'd-silent');
|
|
|
|
});
|
2017-06-13 20:41:21 +02:00
|
|
|
|
|
|
|
QUnit.test('trim trailing hyphens', function(assert) {
|
|
|
|
assert.strictEqual(URLify('D silent always', 9, true), 'd-silent');
|
|
|
|
});
|
2017-10-09 12:40:32 +02:00
|
|
|
|
2020-05-20 19:11:30 +02:00
|
|
|
QUnit.test('non-ASCII string', function(assert) {
|
2017-10-09 12:40:32 +02:00
|
|
|
assert.strictEqual(URLify('Kaupa-miða', 255, true), 'kaupa-miða');
|
|
|
|
});
|