File: es.string.link.js

package info (click to toggle)
node-core-js 3.33.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 18,828 kB
  • sloc: javascript: 87,204; makefile: 13
file content (16 lines) | stat: -rw-r--r-- 629 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
QUnit.test('String#link', assert => {
  const { link } = String.prototype;
  assert.isFunction(link);
  assert.arity(link, 1);
  assert.name(link, 'link');
  assert.looksNative(link);
  assert.nonEnumerable(String.prototype, 'link');
  assert.same('a'.link('b'), '<a href="b">a</a>', 'lower case');
  assert.same('a'.link('"'), '<a href="&quot;">a</a>', 'escape quotes');

  if (typeof Symbol == 'function' && !Symbol.sham) {
    const symbol = Symbol('link test');
    assert.throws(() => link.call(symbol, 'b'), 'throws on symbol context');
    assert.throws(() => link.call('a', symbol), 'throws on symbol argument');
  }
});