|
1 | | -"use strict"; |
| 1 | +// Rstest Snapshot v1 |
| 2 | + |
| 3 | +exports[`JSX syntax should be preserved 1`] = ` |
| 4 | +""use strict"; |
2 | 5 | var __webpack_modules__ = { |
3 | 6 | "./App1": function(module) { |
4 | 7 | module.exports = require("./App1.cjs"); |
@@ -156,3 +159,175 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [ |
156 | 159 | Object.defineProperty(exports, '__esModule', { |
157 | 160 | value: true |
158 | 161 | }); |
| 162 | +" |
| 163 | +`; |
| 164 | +
|
| 165 | +exports[`JSX syntax should be preserved 2`] = ` |
| 166 | +"import { App, App1A, App1B, App1C, app1cProps } from "./App1.js"; |
| 167 | +import { App2, app2Props } from "./App2.js"; |
| 168 | +const DynamicComponent = ()=>{ |
| 169 | + const Component = Math.random() > 0.5 ? App1A : App1C; |
| 170 | + return import("./App1.js").then((mod)=>{ |
| 171 | + const Dynamic = mod[Component === App1A ? 'App1A' : 'App1C']; |
| 172 | + return <Dynamic/>; |
| 173 | + }); |
| 174 | +}; |
| 175 | +const SectionWithSpread = (props)=><section {...props}/>; |
| 176 | +const spreadChildren = [ |
| 177 | + <span key="first">First</span>, |
| 178 | + <span key="second">Second</span> |
| 179 | +]; |
| 180 | +function Root() { |
| 181 | + return <> |
| 182 | + <React.Fragment> |
| 183 | + <> |
| 184 | + <App1A/> |
| 185 | + <React.Suspense fallback={<div>Loading...</div>}> |
| 186 | + <DynamicComponent/> |
| 187 | + </React.Suspense> |
| 188 | + </> |
| 189 | + </React.Fragment> |
| 190 | + <App1C> |
| 191 | + {x ? <App1A> |
| 192 | + <App1B> |
| 193 | + <App2 props={app2Props}> |
| 194 | + <App1C props={app1cProps}/> |
| 195 | + </App2> |
| 196 | + </App1B> |
| 197 | + </App1A> : <App1B/>} |
| 198 | + </App1C> |
| 199 | + <App1C className="c"/> |
| 200 | + <App1C className="app1c"></App1C> |
| 201 | + <App1B/> |
| 202 | + <NamespaceComponents.Button label="Namespace button" {...{ |
| 203 | + title: 'extra', |
| 204 | + ['data-role']: 'primary' |
| 205 | + }} data-count={3} icon={<App1A/>} fragmentContent={<> |
| 206 | + <span>Nested</span> |
| 207 | + <span>Fragment</span> |
| 208 | + </>}/> |
| 209 | + <div className="wrapper"> |
| 210 | + {[ |
| 211 | + <section key="namespace-import" data-index="0"> |
| 212 | + <App data-dynamic="registry" data-item="one"/> |
| 213 | + <foo:bar value="namespaced"/> |
| 214 | + <svg:path d="M0,0 L10,10" xlink:href="#one"/> |
| 215 | + <span>{'item-one'.toUpperCase()}</span> |
| 216 | + {} |
| 217 | + </section>, |
| 218 | + <section key="legacy-widget" data-index="1"> |
| 219 | + <App2 data-dynamic="registry" data-item="two" {...app2Props}/> |
| 220 | + app2 |
| 221 | + <App2/> |
| 222 | + <foo:bar value="namespaced-two"/> |
| 223 | + <svg:path d="M10,10 L20,20" xlink:href="#two"/> |
| 224 | + <App1A/> |
| 225 | + {} |
| 226 | + </section>, |
| 227 | + <section key="external-app" data-index="2"> |
| 228 | + <App1A data-dynamic="registry" data-item="fallback"/> |
| 229 | + <foo:bar value="namespaced-three"/> |
| 230 | + <svg:path d="M20,20 L30,30" xlink:href="#three"/> |
| 231 | + {(()=><NamespaceComponents.Button label="Inline child"/>)()} |
| 232 | + {} |
| 233 | + </section> |
| 234 | + ]} |
| 235 | + <group-container>{...spreadChildren}</group-container> |
| 236 | + <text-block dangerouslySetInnerHTML={{ |
| 237 | + __html: '<strong>bold</strong>' |
| 238 | + }}/> |
| 239 | + <SectionWithSpread {...{ |
| 240 | + 'data-testid': 'component-with-spread', |
| 241 | + role: 'region' |
| 242 | + }}/> |
| 243 | + </div> |
| 244 | + </>; |
| 245 | +} |
| 246 | +export { Root as default }; |
| 247 | +" |
| 248 | +`; |
| 249 | +
|
| 250 | +exports[`JSX syntax should be preserved 3`] = ` |
| 251 | +"import { App, App1A, App1B, App1C, app1cProps } from "./App1.jsx"; |
| 252 | +import { App2, app2Props } from "./App2.jsx"; |
| 253 | +const DynamicComponent = ()=>{ |
| 254 | + const Component = Math.random() > 0.5 ? App1A : App1C; |
| 255 | + return import("./App1.jsx").then((mod)=>{ |
| 256 | + const Dynamic = mod[Component === App1A ? 'App1A' : 'App1C']; |
| 257 | + return <Dynamic/>; |
| 258 | + }); |
| 259 | +}; |
| 260 | +const SectionWithSpread = (props)=><section {...props}/>; |
| 261 | +const spreadChildren = [ |
| 262 | + <span key="first">First</span>, |
| 263 | + <span key="second">Second</span> |
| 264 | +]; |
| 265 | +function Root() { |
| 266 | + return <> |
| 267 | + <React.Fragment> |
| 268 | + <> |
| 269 | + <App1A/> |
| 270 | + <React.Suspense fallback={<div>Loading...</div>}> |
| 271 | + <DynamicComponent/> |
| 272 | + </React.Suspense> |
| 273 | + </> |
| 274 | + </React.Fragment> |
| 275 | + <App1C> |
| 276 | + {x ? <App1A> |
| 277 | + <App1B> |
| 278 | + <App2 props={app2Props}> |
| 279 | + <App1C props={app1cProps}/> |
| 280 | + </App2> |
| 281 | + </App1B> |
| 282 | + </App1A> : <App1B/>} |
| 283 | + </App1C> |
| 284 | + <App1C className="c"/> |
| 285 | + <App1C className="app1c"></App1C> |
| 286 | + <App1B/> |
| 287 | + <NamespaceComponents.Button label="Namespace button" {...{ |
| 288 | + title: 'extra', |
| 289 | + ['data-role']: 'primary' |
| 290 | + }} data-count={3} icon={<App1A/>} fragmentContent={<> |
| 291 | + <span>Nested</span> |
| 292 | + <span>Fragment</span> |
| 293 | + </>}/> |
| 294 | + <div className="wrapper"> |
| 295 | + {[ |
| 296 | + <section key="namespace-import" data-index="0"> |
| 297 | + <App data-dynamic="registry" data-item="one"/> |
| 298 | + <foo:bar value="namespaced"/> |
| 299 | + <svg:path d="M0,0 L10,10" xlink:href="#one"/> |
| 300 | + <span>{'item-one'.toUpperCase()}</span> |
| 301 | + {} |
| 302 | + </section>, |
| 303 | + <section key="legacy-widget" data-index="1"> |
| 304 | + <App2 data-dynamic="registry" data-item="two" {...app2Props}/> |
| 305 | + app2 |
| 306 | + <App2/> |
| 307 | + <foo:bar value="namespaced-two"/> |
| 308 | + <svg:path d="M10,10 L20,20" xlink:href="#two"/> |
| 309 | + <App1A/> |
| 310 | + {} |
| 311 | + </section>, |
| 312 | + <section key="external-app" data-index="2"> |
| 313 | + <App1A data-dynamic="registry" data-item="fallback"/> |
| 314 | + <foo:bar value="namespaced-three"/> |
| 315 | + <svg:path d="M20,20 L30,30" xlink:href="#three"/> |
| 316 | + {(()=><NamespaceComponents.Button label="Inline child"/>)()} |
| 317 | + {} |
| 318 | + </section> |
| 319 | + ]} |
| 320 | + <group-container>{...spreadChildren}</group-container> |
| 321 | + <text-block dangerouslySetInnerHTML={{ |
| 322 | + __html: '<strong>bold</strong>' |
| 323 | + }}/> |
| 324 | + <SectionWithSpread {...{ |
| 325 | + 'data-testid': 'component-with-spread', |
| 326 | + role: 'region' |
| 327 | + }}/> |
| 328 | + </div> |
| 329 | + </>; |
| 330 | +} |
| 331 | +export { Root as default }; |
| 332 | +" |
| 333 | +`; |
0 commit comments