@wordpress/block-library
Version:
Block library for the WordPress editor.
24 lines (20 loc) • 705 B
JavaScript
/**
* Internal dependencies
*/
import { escape } from '../utils';
describe( 'core/code', () => {
describe( 'escape()', () => {
it( 'should escape opening square brackets', () => {
const text = escape( '[shortcode][/shortcode]' );
expect( text ).toBe( '[shortcode][/shortcode]' );
} );
it( 'should escape the protocol of an isolated url', () => {
const text = escape( 'https://example.com/test/' );
expect( text ).toBe( 'https://example.com/test/' );
} );
it( 'should not escape the protocol of a non isolated url', () => {
const text = escape( 'Text https://example.com/test/' );
expect( text ).toBe( 'Text https://example.com/test/' );
} );
} );
} );