CSSPropertyOperations-test.js — react Source File
Architecture documentation for CSSPropertyOperations-test.js, a javascript file in the react codebase.
Entity Profile
Relationship Graph
Source Code
/**
* 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';
const React = require('react');
const ReactDOMClient = require('react-dom/client');
const ReactDOMServer = require('react-dom/server');
const act = require('internal-test-utils').act;
const assertConsoleErrorDev =
require('internal-test-utils').assertConsoleErrorDev;
describe('CSSPropertyOperations', () => {
it('should automatically append `px` to relevant styles', () => {
const styles = {
left: 0,
margin: 16,
opacity: 0.5,
padding: '4px',
};
const div = <div style={styles} />;
const html = ReactDOMServer.renderToString(div);
expect(html).toContain('"left:0;margin:16px;opacity:0.5;padding:4px"');
});
it('should trim values', () => {
const styles = {
left: '16 ',
opacity: 0.5,
right: ' 4 ',
};
const div = <div style={styles} />;
const html = ReactDOMServer.renderToString(div);
expect(html).toContain('"left:16;opacity:0.5;right:4"');
});
it('should not append `px` to styles that might need a number', () => {
const styles = {
flex: 0,
opacity: 0.5,
};
const div = <div style={styles} />;
const html = ReactDOMServer.renderToString(div);
expect(html).toContain('"flex:0;opacity:0.5"');
});
it('should create vendor-prefixed markup correctly', () => {
const styles = {
msTransition: 'none',
MozTransition: 'none',
};
const div = <div style={styles} />;
const html = ReactDOMServer.renderToString(div);
expect(html).toContain('"-ms-transition:none;-moz-transition:none"');
// ... (231 more lines)
Domain
Subdomains
Classes
Source
Frequently Asked Questions
What does CSSPropertyOperations-test.js do?
CSSPropertyOperations-test.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
Where is CSSPropertyOperations-test.js in the architecture?
CSSPropertyOperations-test.js is located at packages/react-dom/src/__tests__/CSSPropertyOperations-test.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-dom/src/__tests__).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free