mirror of
https://github.com/hanzoai/core-js.git
synced 2026-09-24 16:58:15 +00:00
15 lines
547 B
JavaScript
15 lines
547 B
JavaScript
import anchor from 'core-js-pure/es/string/anchor';
|
|
|
|
QUnit.test('String#anchor', assert => {
|
|
assert.isFunction(anchor);
|
|
assert.same(anchor('a', 'b'), '<a name="b">a</a>', 'lower case');
|
|
assert.same(anchor('a', '"'), '<a name=""">a</a>', 'escape quotes');
|
|
|
|
/* eslint-disable es/no-symbol -- safe */
|
|
if (typeof Symbol == 'function') {
|
|
const symbol = Symbol('anchor test');
|
|
assert.throws(() => anchor(symbol, 'b'), 'throws on symbol context');
|
|
assert.throws(() => anchor('a', symbol), 'throws on symbol argument');
|
|
}
|
|
});
|