Sha256: 703363fab0010e66b4bea489500546a92014ac8fa59c4abe961a9ab321171ecb

Contents?: true

Size: 954 Bytes

Versions: 86

Compression:

Stored size: 954 Bytes

Contents

module('Utils - escapeMarkup');

var Utils = require('select2/utils');

test('text passes through', function (assert) {
  var text = 'testing this';
  var escaped = Utils.escapeMarkup(text);

  assert.equal(text, escaped);
});

test('html tags are escaped', function (assert) {
  var text = '<script>alert("bad");</script>';
  var escaped = Utils.escapeMarkup(text);

  assert.notEqual(text, escaped);
  assert.equal(escaped.indexOf('<script>'), -1);
});

test('quotes are killed as well', function (assert) {
  var text = 'testin\' these "quotes"';
  var escaped = Utils.escapeMarkup(text);

  assert.notEqual(text, escaped);
  assert.equal(escaped.indexOf('\''), -1);
  assert.equal(escaped.indexOf('"'), -1);
});

test('DocumentFragment options pass through', function (assert) {
  var frag = document.createDocumentFragment();
  frag.innerHTML = '<strong>test</strong>';

  var escaped = Utils.escapeMarkup(frag);

  assert.equal(frag, escaped);
});

Version data entries

86 entries across 86 versions & 7 rubygems

Version Path
locomotivecms-3.1.0.rc3 vendor/assets/components/locomotive_sources/select2/tests/utils/escapeMarkup-tests.js
locomotivecms-3.1.0.rc2 vendor/assets/components/locomotive_sources/select2/tests/utils/escapeMarkup-tests.js
locomotivecms-3.1.0.rc1 vendor/assets/components/locomotive_sources/select2/tests/utils/escapeMarkup-tests.js
locomotivecms-3.0.1 vendor/assets/components/locomotive_sources/select2/tests/utils/escapeMarkup-tests.js
locomotivecms-3.0.0 vendor/assets/components/locomotive_sources/select2/tests/utils/escapeMarkup-tests.js
locomotivecms-3.0.0.rc7 vendor/assets/components/locomotive_sources/select2/tests/utils/escapeMarkup-tests.js