/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @emails react-core */ 'use strict'; let React; let ReactDOMServer; describe('quoteAttributeValueForBrowser', () => { beforeEach(() => { jest.resetModules(); React = require('react'); ReactDOMServer = require('react-dom/server'); }); it('ampersand is escaped inside attributes', () => { const response = ReactDOMServer.renderToString(); expect(response).toMatch(''); }); it('double quote is escaped inside attributes', () => { const response = ReactDOMServer.renderToString(); expect(response).toMatch(''); }); it('single quote is escaped inside attributes', () => { const response = ReactDOMServer.renderToString(); expect(response).toMatch(''); }); it('greater than entity is escaped inside attributes', () => { const response = ReactDOMServer.renderToString(); expect(response).toMatch(''); }); it('lower than entity is escaped inside attributes', () => { const response = ReactDOMServer.renderToString(); expect(response).toMatch(''); }); it('number is escaped to string inside attributes', () => { const response = ReactDOMServer.renderToString(); expect(response).toMatch(''); }); it('object is passed to a string inside attributes', () => { const sampleObject = { toString: function () { return 'ponys'; }, }; const response = ReactDOMServer.renderToString( , ); expect(response).toMatch(''); }); it('script tag is escaped inside attributes', () => { const response = ReactDOMServer.renderToString( '} />, ); expect(response).toMatch( '', ); }); });