File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
packages/react-devtools-shared/src/backend/StyleX Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,29 @@ describe('Stylex plugin utils', () => {
3333 } ) ;
3434 } ) ;
3535
36+ it ( 'should gracefully handle empty values' , ( ) => {
37+ expect ( getStyleXData ( null ) ) . toMatchInlineSnapshot ( `
38+ Object {
39+ "resolvedStyles": Object {},
40+ "sources": Array [],
41+ }
42+ ` ) ;
43+
44+ expect ( getStyleXData ( undefined ) ) . toMatchInlineSnapshot ( `
45+ Object {
46+ "resolvedStyles": Object {},
47+ "sources": Array [],
48+ }
49+ ` ) ;
50+
51+ expect ( getStyleXData ( '' ) ) . toMatchInlineSnapshot ( `
52+ Object {
53+ "resolvedStyles": Object {},
54+ "sources": Array [],
55+ }
56+ ` ) ;
57+ } ) ;
58+
3659 it ( 'should support simple style objects' , ( ) => {
3760 defineStyles ( `
3861 .foo {
Original file line number Diff line number Diff line change @@ -29,6 +29,10 @@ export function crawlData(
2929 sources : Set < string > ,
3030 resolvedStyles : Object ,
3131) : void {
32+ if ( data == null ) {
33+ return ;
34+ }
35+
3236 if ( isArray ( data ) ) {
3337 data . forEach ( entry => {
3438 if ( isArray ( entry ) ) {
You can’t perform that action at this time.
0 commit comments