mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
Gracefully handle empty "xstyle" prop values (#23190)
This commit is contained in:
@@ -33,6 +33,29 @@ describe('Stylex plugin utils', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should gracefully handle empty values', () => {
|
||||
expect(getStyleXData(null)).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"resolvedStyles": Object {},
|
||||
"sources": Array [],
|
||||
}
|
||||
`);
|
||||
|
||||
expect(getStyleXData(undefined)).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"resolvedStyles": Object {},
|
||||
"sources": Array [],
|
||||
}
|
||||
`);
|
||||
|
||||
expect(getStyleXData('')).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"resolvedStyles": Object {},
|
||||
"sources": Array [],
|
||||
}
|
||||
`);
|
||||
});
|
||||
|
||||
it('should support simple style objects', () => {
|
||||
defineStyles(`
|
||||
.foo {
|
||||
|
||||
@@ -29,6 +29,10 @@ export function crawlData(
|
||||
sources: Set<string>,
|
||||
resolvedStyles: Object,
|
||||
): void {
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isArray(data)) {
|
||||
data.forEach(entry => {
|
||||
if (isArray(entry)) {
|
||||
|
||||
Reference in New Issue
Block a user