mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Added JavaScript tests for contrib.admin's URLify.js.
This commit is contained in:
parent
7acbe89cc2
commit
68812ba868
21
js_tests/admin/URLify.test.js
Normal file
21
js_tests/admin/URLify.test.js
Normal 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');
|
||||||
|
});
|
@ -43,6 +43,7 @@
|
|||||||
|
|
||||||
<script src="./qunit/qunit.js"></script>
|
<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/vendor/jquery/jquery.min.js'></script>
|
||||||
<script src='../django/contrib/admin/static/admin/js/jquery.init.js'></script>
|
<script src='../django/contrib/admin/static/admin/js/jquery.init.js'></script>
|
||||||
<script src='./admin/jsi18n-mocks.test.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/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/prepopulate.js' data-cover></script>
|
||||||
<script src='../django/contrib/admin/static/admin/js/urlify.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;">
|
<div id="id_point_map" style="display:none;">
|
||||||
<textarea id="id_point" name="point" class="vSerializedField required"
|
<textarea id="id_point" name="point" class="vSerializedField required"
|
||||||
|
Loading…
Reference in New Issue
Block a user