storeOwners-test.js — react Source File
Architecture documentation for storeOwners-test.js, a javascript file in the react codebase.
Entity Profile
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.
*
* @flow
*/
const {printOwnersList} = require('../devtools/utils');
const {getVersionedRenderImplementation} = require('./utils');
describe('Store owners list', () => {
let React;
let act;
let store;
beforeEach(() => {
store = global.store;
store.collapseNodesByDefault = false;
React = require('react');
const utils = require('./utils');
act = utils.act;
});
const {render} = getVersionedRenderImplementation();
function getFormattedOwnersList(elementID) {
const ownersList = store.getOwnersListForElement(elementID);
return printOwnersList(ownersList);
}
it('should drill through intermediate components', () => {
const Root = () => (
<Intermediate>
<div>
<Leaf />
</div>
</Intermediate>
);
const Wrapper = ({children}) => children;
const Leaf = () => <div>Leaf</div>;
const Intermediate = ({children}) => <Wrapper>{children}</Wrapper>;
act(() => render(<Root />));
expect(store).toMatchInlineSnapshot(`
[root]
▾ <Root>
▾ <Intermediate>
▾ <Wrapper>
<Leaf>
`);
const rootID = store.getElementIDAtIndex(0);
expect(getFormattedOwnersList(rootID)).toMatchInlineSnapshot(`
" ▾ <Root>
▾ <Intermediate>
<Leaf>"
// ... (159 more lines)
Source
Frequently Asked Questions
What does storeOwners-test.js do?
storeOwners-test.js is a source file in the react codebase, written in javascript.
Where is storeOwners-test.js in the architecture?
storeOwners-test.js is located at packages/react-devtools-shared/src/__tests__/storeOwners-test.js (directory: packages/react-devtools-shared/src/__tests__).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free