@@ -116,22 +116,19 @@ describe('splitAtomicAndNested', () => {
116116} ) ;
117117
118118describe ( 'processAtomicProps' , ( ) => {
119- let atomicHashes : Set < string > ;
120- let allStyleSheets : Set < string > ;
119+ let atomicMap : Map < string , string > ;
121120
122121 beforeEach ( ( ) => {
123- atomicHashes = new Set ( ) ;
124- allStyleSheets = new Set ( ) ;
122+ atomicMap = new Map ( ) ;
125123 } ) ;
126124
127125 test ( 'processes basic atomic properties' , ( ) => {
128126 const flatProps = {
129127 color : 'red' ,
130128 } ;
131- processAtomicProps ( flatProps , atomicHashes , allStyleSheets ) ;
129+ processAtomicProps ( flatProps , atomicMap ) ;
132130
133- expect ( allStyleSheets . size ) . toBe ( 1 ) ;
134- expect ( atomicHashes . size ) . toBe ( 1 ) ;
131+ expect ( atomicMap . size ) . toBe ( 1 ) ;
135132 } ) ;
136133
137134 test ( 'processes @media queries' , ( ) => {
@@ -140,10 +137,9 @@ describe('processAtomicProps', () => {
140137 color : 'blue' ,
141138 } ,
142139 } ;
143- processAtomicProps ( flatProps , atomicHashes , allStyleSheets ) ;
140+ processAtomicProps ( flatProps , atomicMap ) ;
144141
145- expect ( allStyleSheets . size ) . toBe ( 1 ) ;
146- expect ( atomicHashes . size ) . toBe ( 1 ) ;
142+ expect ( atomicMap . size ) . toBe ( 1 ) ;
147143 } ) ;
148144
149145 test ( 'handles shorthand properties' , ( ) => {
@@ -152,44 +148,42 @@ describe('processAtomicProps', () => {
152148 margin : '10px' ,
153149 marginTop : '20px' ,
154150 } ,
155- atomicHashes ,
156- allStyleSheets
151+ atomicMap
157152 ) ;
158- expect ( atomicHashes . size ) . toBe ( 2 ) ;
159- expect ( allStyleSheets ) . not . toContain ( 'margin-top:20px' ) ;
153+ expect ( atomicMap . size ) . toBe ( 2 ) ;
154+
155+ const sheets = Array . from ( atomicMap . values ( ) ) . join ( '' ) ;
156+ expect ( sheets ) . not . toContain ( 'margin-top:20px' ) ;
160157 } ) ;
161158
162159 test ( 'ignores longhand when shorthand is present' , ( ) => {
163- processAtomicProps ( { margin : '10px' } , atomicHashes , allStyleSheets ) ;
164- processAtomicProps ( { marginTop : '5px' } , atomicHashes , allStyleSheets ) ;
160+ processAtomicProps ( { margin : '10px' } , atomicMap ) ;
161+ processAtomicProps ( { marginTop : '5px' } , atomicMap ) ;
165162
166- expect ( allStyleSheets . size ) . toBe ( 2 ) ;
167- expect ( atomicHashes . size ) . toBe ( 2 ) ;
163+ expect ( atomicMap . size ) . toBe ( 2 ) ;
168164 } ) ;
169165
170166 test ( 'processes multiple atomic properties' , ( ) => {
171167 processAtomicProps (
172168 {
173169 color : 'green' ,
174170 } ,
175- atomicHashes ,
176- allStyleSheets
171+ atomicMap
177172 ) ;
178173
179- expect ( allStyleSheets . size ) . toBe ( 1 ) ;
180- expect ( atomicHashes . size ) . toBe ( 1 ) ;
174+ expect ( atomicMap . size ) . toBe ( 1 ) ;
181175 } ) ;
182176
183177 test ( 'skips duplicate atomic hashes' , ( ) => {
184178 const flat = {
185179 color : 'red' ,
186180 } ;
187181
188- processAtomicProps ( flat , atomicHashes , allStyleSheets ) ;
189- const firstSize = allStyleSheets . size ;
182+ processAtomicProps ( flat , atomicMap ) ;
183+ const firstSize = atomicMap . size ;
190184
191- processAtomicProps ( flat , atomicHashes , allStyleSheets ) ;
192- const secondSize = allStyleSheets . size ;
185+ processAtomicProps ( flat , atomicMap ) ;
186+ const secondSize = atomicMap . size ;
193187
194188 expect ( firstSize ) . toBe ( secondSize ) ;
195189 expect ( firstSize ) . toBe ( 1 ) ;
0 commit comments