Skip to content

Commit

Permalink
test: 重写测试用例
Browse files Browse the repository at this point in the history
  • Loading branch information
suiyun39 committed Mar 13, 2024
1 parent 04eff33 commit 9142c30
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 42 deletions.
4 changes: 1 addition & 3 deletions tests/fixtures/all-tags/code.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import React from 'react'

export const App: React.FC = () => {
export function App() {
return (
<article>
<audio src="./audio.mp3" />
Expand Down
5 changes: 2 additions & 3 deletions tests/fixtures/all-tags/snapshot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import _import_assets4 from "./video.mp4";
import _import_assets3 from "./help.pdf";
import _import_assets2 from "./logo.png";
import _import_assets from "./audio.mp3";
import React from "react";
export const App = () => {
export function App() {
return (
<article>
<audio src={_import_assets} />
Expand All @@ -22,4 +21,4 @@ export const App = () => {
<use href={_import_assets2} xlinkHref={_import_assets2} />
</article>
);
};
}
3 changes: 1 addition & 2 deletions tests/fixtures/attribute-expression/code.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable @stylistic/jsx-curly-brace-presence */
import React from 'react'

export const App: React.FC = () => {
export function App() {
const src = './logo.png'

return (
Expand Down
6 changes: 3 additions & 3 deletions tests/fixtures/attribute-expression/snapshot.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* eslint-disable @stylistic/jsx-curly-brace-presence */
import React from "react";
export const App = () => {

export function App() {
const src = "./logo.png";
return (
<article>
<img src={src} alt="" />
<img src={"./logo.png"} alt="" />
</article>
);
};
}
11 changes: 8 additions & 3 deletions tests/fixtures/custom-tags/code.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import React from 'react'
interface ImageProps {
src: string
}

function Image(props: ImageProps) {
return <img src={props.src} alt="" />
}

const Image: React.FC<{ src: string }> = () => null
const Bar = { Image }
const Foo = { Bar }

export const App: React.FC = () => {
export function App() {
return (
<article>
<img src="./logo.png" alt="" />
Expand Down
9 changes: 5 additions & 4 deletions tests/fixtures/custom-tags/snapshot.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import _import_assets from "./logo.png";
import React from "react";
const Image = () => null;
function Image(props) {
return <img src={props.src} alt="" />;
}
const Bar = {
Image,
};
const Foo = {
Bar,
};
export const App = () => {
export function App() {
return (
<article>
<img src="./logo.png" alt="" />
Expand All @@ -16,4 +17,4 @@ export const App = () => {
<Foo.Bar.Image src={_import_assets} />
</article>
);
};
}
4 changes: 1 addition & 3 deletions tests/fixtures/img-src/code.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import React from 'react'

export const App: React.FC = () => {
export function App() {
return (
<article>
<img src="" alt="" />
Expand Down
5 changes: 2 additions & 3 deletions tests/fixtures/img-src/snapshot.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import _import_assets from "./logo.png";
import React from "react";
export const App = () => {
export function App() {
return (
<article>
<img src="" alt="" />
Expand All @@ -11,4 +10,4 @@ export const App = () => {
<img src="data:image/png;base64,i" alt="" />
</article>
);
};
}
4 changes: 1 addition & 3 deletions tests/fixtures/import-alias/code.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import React from 'react'

export const App: React.FC = () => {
export function App() {
return (
<article>
<img src="~fixtures/logo.png" alt="" />
Expand Down
5 changes: 2 additions & 3 deletions tests/fixtures/import-alias/snapshot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import _import_assets4 from "@/fixtures/logo.png";
import _import_assets3 from "@fixtures/logo.png";
import _import_assets2 from "~/fixtures/logo.png";
import _import_assets from "~fixtures/logo.png";
import React from "react";
export const App = () => {
export function App() {
return (
<article>
<img src={_import_assets} alt="" />
Expand All @@ -12,4 +11,4 @@ export const App = () => {
<img src={_import_assets4} alt="" />
</article>
);
};
}
4 changes: 1 addition & 3 deletions tests/fixtures/include-absolute/code.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import React from 'react'

export const App: React.FC = () => {
export function App() {
return (
<article>
<img src="./logo.png" alt="" />
Expand Down
5 changes: 2 additions & 3 deletions tests/fixtures/include-absolute/snapshot.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import _import_assets2 from "/fixtures/logo.png";
import _import_assets from "./logo.png";
import React from "react";
export const App = () => {
export function App() {
return (
<article>
<img src={_import_assets} alt="" />
<img src={_import_assets2} alt="" />
<img src="//example.com/fixtures/logo.png" alt="" />
</article>
);
};
}
4 changes: 1 addition & 3 deletions tests/fixtures/src-set/code.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import React from 'react'

export const App: React.FC = () => {
export function App() {
return (
<article>
<img
Expand Down
5 changes: 2 additions & 3 deletions tests/fixtures/src-set/snapshot.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import _import_assets2 from "./logo-2x.png";
import _import_assets from "./logo.png";
import React from "react";
export const App = () => {
export function App() {
return (
<article>
<img
Expand All @@ -16,4 +15,4 @@ export const App = () => {
</picture>
</article>
);
};
}

0 comments on commit 9142c30

Please sign in to comment.