1
0
mirror of https://github.com/django/django.git synced 2024-12-22 09:05:43 +00:00

Added JavaScript tests for contrib.admin's URLify.js.

This commit is contained in:
monotonee 2017-06-13 13:34:42 -04:00 committed by Tim Graham
parent 7acbe89cc2
commit 68812ba868
2 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,21 @@
/* global QUnit, URLify */
/* eslint global-strict: 0, strict: 0 */
'use strict';
QUnit.module('admin.URLify');
QUnit.test('empty string', function(assert) {
assert.strictEqual(URLify('', 8, true), '');
});
QUnit.test('strip nonessential words', function(assert) {
assert.strictEqual(URLify('the D is silent', 8, true), 'd-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');
});

View File

@ -43,6 +43,7 @@
<script src="./qunit/qunit.js"></script>
<script src='../django/contrib/admin/static/admin/js/vendor/xregexp/xregexp.min.js'></script>
<script src='../django/contrib/admin/static/admin/js/vendor/jquery/jquery.min.js'></script>
<script src='../django/contrib/admin/static/admin/js/jquery.init.js'></script>
<script src='./admin/jsi18n-mocks.test.js'></script>
@ -76,6 +77,7 @@
<script src='../django/contrib/admin/static/admin/js/collapse.js' data-cover></script>
<script src='../django/contrib/admin/static/admin/js/prepopulate.js' data-cover></script>
<script src='../django/contrib/admin/static/admin/js/urlify.js' data-cover></script>
<script src='./admin/URLify.test.js'></script>
<div id="id_point_map" style="display:none;">
<textarea id="id_point" name="point" class="vSerializedField required"