1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00
django/js_tests/admin/URLify.test.js
Scott Cranfill 62f1655a64 Fixed #11157 -- Stopped removing stop words in admin's prepopulated_fields.
Co-Authored-By: Andy Chosak <andy@chosak.org>
2020-05-27 12:32:56 +02:00

29 lines
837 B
JavaScript

/* global QUnit, URLify */
'use strict';
QUnit.module('admin.URLify');
QUnit.test('empty string', function(assert) {
assert.strictEqual(URLify('', 8, true), '');
});
QUnit.test('preserve nonessential words', function(assert) {
assert.strictEqual(URLify('the D is silent', 15, true), 'the-d-is-silent');
});
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');
});
QUnit.test('trim trailing hyphens', function(assert) {
assert.strictEqual(URLify('D silent always', 9, true), 'd-silent');
});
QUnit.test('non-ASCII string', function(assert) {
assert.strictEqual(URLify('Kaupa-miða', 255, true), 'kaupa-miða');
});