-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: snapshot testing (1/*) * chore: better snapshots * remove random generation of strings * remove weird chars from snapshot name * rebase * remove other weird chars
- Loading branch information
Showing
299 changed files
with
13,665 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Files with the language manually specified, sorted alphabetically. | ||
/internal/**/*.snap linguist-language=Markdown |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
|
||
[TestPrinter/All_components - 1] | ||
## Input | ||
|
||
``` | ||
/-/-/-/ | ||
import { Container, Col, Row } from 'react-bootstrap'; | ||
/-/-/-/ | ||
<Container> | ||
<Row> | ||
<Col> | ||
<h1>Hi!</h1> | ||
</Col> | ||
</Row> | ||
</Container> | ||
``` | ||
|
||
## Output | ||
|
||
```js | ||
import { | ||
Fragment, | ||
render as $$render, | ||
createAstro as $$createAstro, | ||
createComponent as $$createComponent, | ||
renderComponent as $$renderComponent, | ||
renderHead as $$renderHead, | ||
maybeRenderHead as $$maybeRenderHead, | ||
unescapeHTML as $$unescapeHTML, | ||
renderSlot as $$renderSlot, | ||
mergeSlots as $$mergeSlots, | ||
addAttribute as $$addAttribute, | ||
spreadAttributes as $$spreadAttributes, | ||
defineStyleVars as $$defineStyleVars, | ||
defineScriptVars as $$defineScriptVars, | ||
renderTransition as $$renderTransition, | ||
createTransitionScope as $$createTransitionScope, | ||
renderScript as $$renderScript, | ||
createMetadata as $$createMetadata | ||
} from "http://localhost:3000/"; | ||
import { Container, Col, Row } from 'react-bootstrap'; | ||
|
||
import * as $$module1 from 'react-bootstrap'; | ||
|
||
export const $$metadata = $$createMetadata(import.meta.url, { modules: [{ module: $$module1, specifier: 'react-bootstrap', assert: {} }], hydratedComponents: [], clientOnlyComponents: [], hydrationDirectives: new Set([]), hoisted: [] }); | ||
|
||
const $$Component = $$createComponent(($$result, $$props, $$slots) => { | ||
|
||
return $$render`${$$renderComponent($$result,'Container',Container,{},{"default": () => $$render` | ||
${$$renderComponent($$result,'Row',Row,{},{"default": () => $$render` | ||
${$$renderComponent($$result,'Col',Col,{},{"default": () => $$render` | ||
${$$maybeRenderHead($$result)}<h1>Hi!</h1> | ||
`,})} | ||
`,})} | ||
`,})}`; | ||
}, undefined, undefined); | ||
export default $$Component; | ||
``` | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
[TestPrinter/Component_is:raw - 1] | ||
## Input | ||
|
||
``` | ||
<Component is:raw>{<% awesome %>}</Component> | ||
``` | ||
|
||
## Output | ||
|
||
```js | ||
import { | ||
Fragment, | ||
render as $$render, | ||
createAstro as $$createAstro, | ||
createComponent as $$createComponent, | ||
renderComponent as $$renderComponent, | ||
renderHead as $$renderHead, | ||
maybeRenderHead as $$maybeRenderHead, | ||
unescapeHTML as $$unescapeHTML, | ||
renderSlot as $$renderSlot, | ||
mergeSlots as $$mergeSlots, | ||
addAttribute as $$addAttribute, | ||
spreadAttributes as $$spreadAttributes, | ||
defineStyleVars as $$defineStyleVars, | ||
defineScriptVars as $$defineScriptVars, | ||
renderTransition as $$renderTransition, | ||
createTransitionScope as $$createTransitionScope, | ||
renderScript as $$renderScript, | ||
createMetadata as $$createMetadata | ||
} from "http://localhost:3000/"; | ||
|
||
export const $$metadata = $$createMetadata(import.meta.url, { modules: [], hydratedComponents: [], clientOnlyComponents: [], hydrationDirectives: new Set([]), hoisted: [] }); | ||
|
||
const $$Component = $$createComponent(($$result, $$props, $$slots) => { | ||
|
||
return $$render`${$$renderComponent($$result,'Component',Component,{},{"default": () => $$render`{<% awesome %>}`,})}`; | ||
}, undefined, undefined); | ||
export default $$Component; | ||
``` | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
|
||
[TestPrinter/Component_names_A-Z - 1] | ||
## Input | ||
|
||
``` | ||
/-/-/-/ | ||
import AComponent from '../components/AComponent.jsx'; | ||
import ZComponent from '../components/ZComponent.jsx'; | ||
/-/-/-/ | ||
<body> | ||
<AComponent /> | ||
<ZComponent /> | ||
</body> | ||
``` | ||
|
||
## Output | ||
|
||
```js | ||
import { | ||
Fragment, | ||
render as $$render, | ||
createAstro as $$createAstro, | ||
createComponent as $$createComponent, | ||
renderComponent as $$renderComponent, | ||
renderHead as $$renderHead, | ||
maybeRenderHead as $$maybeRenderHead, | ||
unescapeHTML as $$unescapeHTML, | ||
renderSlot as $$renderSlot, | ||
mergeSlots as $$mergeSlots, | ||
addAttribute as $$addAttribute, | ||
spreadAttributes as $$spreadAttributes, | ||
defineStyleVars as $$defineStyleVars, | ||
defineScriptVars as $$defineScriptVars, | ||
renderTransition as $$renderTransition, | ||
createTransitionScope as $$createTransitionScope, | ||
renderScript as $$renderScript, | ||
createMetadata as $$createMetadata | ||
} from "http://localhost:3000/"; | ||
import AComponent from '../components/AComponent.jsx'; | ||
import ZComponent from '../components/ZComponent.jsx'; | ||
|
||
import * as $$module1 from '../components/AComponent.jsx'; | ||
import * as $$module2 from '../components/ZComponent.jsx'; | ||
|
||
export const $$metadata = $$createMetadata(import.meta.url, { modules: [{ module: $$module1, specifier: '../components/AComponent.jsx', assert: {} }, { module: $$module2, specifier: '../components/ZComponent.jsx', assert: {} }], hydratedComponents: [], clientOnlyComponents: [], hydrationDirectives: new Set([]), hoisted: [] }); | ||
|
||
const $$Component = $$createComponent(($$result, $$props, $$slots) => { | ||
|
||
return $$render`${$$maybeRenderHead($$result)}<body> | ||
${$$renderComponent($$result,'AComponent',AComponent,{})} | ||
${$$renderComponent($$result,'ZComponent',ZComponent,{})} | ||
</body>`; | ||
}, undefined, undefined); | ||
export default $$Component; | ||
``` | ||
--- |
41 changes: 41 additions & 0 deletions
41
internal/printer/__snapshots__/Component_siblings_are_siblings.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
[TestPrinter/Component_siblings_are_siblings - 1] | ||
## Input | ||
|
||
``` | ||
<BaseHead></BaseHead><link href="test"> | ||
``` | ||
|
||
## Output | ||
|
||
```js | ||
import { | ||
Fragment, | ||
render as $$render, | ||
createAstro as $$createAstro, | ||
createComponent as $$createComponent, | ||
renderComponent as $$renderComponent, | ||
renderHead as $$renderHead, | ||
maybeRenderHead as $$maybeRenderHead, | ||
unescapeHTML as $$unescapeHTML, | ||
renderSlot as $$renderSlot, | ||
mergeSlots as $$mergeSlots, | ||
addAttribute as $$addAttribute, | ||
spreadAttributes as $$spreadAttributes, | ||
defineStyleVars as $$defineStyleVars, | ||
defineScriptVars as $$defineScriptVars, | ||
renderTransition as $$renderTransition, | ||
createTransitionScope as $$createTransitionScope, | ||
renderScript as $$renderScript, | ||
createMetadata as $$createMetadata | ||
} from "http://localhost:3000/"; | ||
|
||
export const $$metadata = $$createMetadata(import.meta.url, { modules: [], hydratedComponents: [], clientOnlyComponents: [], hydrationDirectives: new Set([]), hoisted: [] }); | ||
|
||
const $$Component = $$createComponent(($$result, $$props, $$slots) => { | ||
|
||
return $$render`${$$renderComponent($$result,'BaseHead',BaseHead,{})}<link href="test">`; | ||
}, undefined, undefined); | ||
export default $$Component; | ||
``` | ||
--- |
41 changes: 41 additions & 0 deletions
41
internal/printer/__snapshots__/Empty_attribute_expression.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
[TestPrinter/Empty_attribute_expression - 1] | ||
## Input | ||
|
||
``` | ||
<body attr={}></body> | ||
``` | ||
|
||
## Output | ||
|
||
```js | ||
import { | ||
Fragment, | ||
render as $$render, | ||
createAstro as $$createAstro, | ||
createComponent as $$createComponent, | ||
renderComponent as $$renderComponent, | ||
renderHead as $$renderHead, | ||
maybeRenderHead as $$maybeRenderHead, | ||
unescapeHTML as $$unescapeHTML, | ||
renderSlot as $$renderSlot, | ||
mergeSlots as $$mergeSlots, | ||
addAttribute as $$addAttribute, | ||
spreadAttributes as $$spreadAttributes, | ||
defineStyleVars as $$defineStyleVars, | ||
defineScriptVars as $$defineScriptVars, | ||
renderTransition as $$renderTransition, | ||
createTransitionScope as $$createTransitionScope, | ||
renderScript as $$renderScript, | ||
createMetadata as $$createMetadata | ||
} from "http://localhost:3000/"; | ||
|
||
export const $$metadata = $$createMetadata(import.meta.url, { modules: [], hydratedComponents: [], clientOnlyComponents: [], hydrationDirectives: new Set([]), hoisted: [] }); | ||
|
||
const $$Component = $$createComponent(($$result, $$props, $$slots) => { | ||
|
||
return $$render`${$$maybeRenderHead($$result)}<body${$$addAttribute((void 0), "attr")}></body>`; | ||
}, undefined, undefined); | ||
export default $$Component; | ||
``` | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
[TestPrinter/Empty_expression - 1] | ||
## Input | ||
|
||
``` | ||
<body>({})</body> | ||
``` | ||
|
||
## Output | ||
|
||
```js | ||
import { | ||
Fragment, | ||
render as $$render, | ||
createAstro as $$createAstro, | ||
createComponent as $$createComponent, | ||
renderComponent as $$renderComponent, | ||
renderHead as $$renderHead, | ||
maybeRenderHead as $$maybeRenderHead, | ||
unescapeHTML as $$unescapeHTML, | ||
renderSlot as $$renderSlot, | ||
mergeSlots as $$mergeSlots, | ||
addAttribute as $$addAttribute, | ||
spreadAttributes as $$spreadAttributes, | ||
defineStyleVars as $$defineStyleVars, | ||
defineScriptVars as $$defineScriptVars, | ||
renderTransition as $$renderTransition, | ||
createTransitionScope as $$createTransitionScope, | ||
renderScript as $$renderScript, | ||
createMetadata as $$createMetadata | ||
} from "http://localhost:3000/"; | ||
|
||
export const $$metadata = $$createMetadata(import.meta.url, { modules: [], hydratedComponents: [], clientOnlyComponents: [], hydrationDirectives: new Set([]), hoisted: [] }); | ||
|
||
const $$Component = $$createComponent(($$result, $$props, $$slots) => { | ||
|
||
return $$render`${$$maybeRenderHead($$result)}<body>(${(void 0)})</body>`; | ||
}, undefined, undefined); | ||
export default $$Component; | ||
``` | ||
--- |
Oops, something went wrong.