URLify.test.js 837 B

12345678910111213141516171819202122232425262728
  1. /* global QUnit, URLify */
  2. 'use strict';
  3. QUnit.module('admin.URLify');
  4. QUnit.test('empty string', function(assert) {
  5. assert.strictEqual(URLify('', 8, true), '');
  6. });
  7. QUnit.test('preserve nonessential words', function(assert) {
  8. assert.strictEqual(URLify('the D is silent', 15, true), 'the-d-is-silent');
  9. });
  10. QUnit.test('strip non-URL characters', function(assert) {
  11. assert.strictEqual(URLify('D#silent@', 7, true), 'dsilent');
  12. });
  13. QUnit.test('merge adjacent whitespace', function(assert) {
  14. assert.strictEqual(URLify('D silent', 8, true), 'd-silent');
  15. });
  16. QUnit.test('trim trailing hyphens', function(assert) {
  17. assert.strictEqual(URLify('D silent always', 9, true), 'd-silent');
  18. });
  19. QUnit.test('non-ASCII string', function(assert) {
  20. assert.strictEqual(URLify('Kaupa-miða', 255, true), 'kaupa-miða');
  21. });