Skip to content
This repository was archived by the owner on Jun 5, 2019. It is now read-only.

Commit 309a140

Browse files
committed
✅ Adds mocks to make storyshots work
@rmevans9 for the win!
1 parent b25fc82 commit 309a140

File tree

4 files changed

+228
-0
lines changed

4 files changed

+228
-0
lines changed

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@
120120
"transform": {
121121
".(ts|tsx)": "<rootDir>/node_modules/ts-jest/preprocessor.js"
122122
},
123+
"moduleNameMapper": {
124+
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/test/mock-file.ts",
125+
"\\.(css|less)$": "<rootDir>/test/mock-style.ts"
126+
},
123127
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
124128
"moduleFileExtensions": [
125129
"ts",
Lines changed: 222 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,222 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Storyshots Fun Dog default 1`] = `
4+
<div
5+
style={
6+
Object {
7+
"paddingLeft": 20,
8+
"paddingRight": 20,
9+
}
10+
}
11+
>
12+
<div
13+
style={
14+
Object {
15+
"paddingBottom": 20,
16+
}
17+
}
18+
>
19+
<p
20+
style={
21+
Object {
22+
"borderBottom": "1px solid #eee",
23+
"color": "#3d3d3d",
24+
"fontFamily": "Helvetica Neue",
25+
"fontSize": 14,
26+
"marginBottom": 5,
27+
"marginLeft": -20,
28+
"paddingBottom": 5,
29+
}
30+
}
31+
>
32+
is a doggo
33+
</p>
34+
<div
35+
style={
36+
Object {
37+
"display": "flex",
38+
"flexDirection": "row",
39+
}
40+
}
41+
>
42+
<div
43+
onClick={[Function]}
44+
style={
45+
Object {
46+
"cursor": "pointer",
47+
"transform": "rotate(0deg)",
48+
}
49+
}
50+
>
51+
<img
52+
data-css-10m1z31=""
53+
draggable={false}
54+
src="test-file-stub"
55+
/>
56+
</div>
57+
</div>
58+
</div>
59+
</div>
60+
`;
61+
62+
exports[`Storyshots Text text styles 1`] = `
63+
<div
64+
style={
65+
Object {
66+
"paddingLeft": 20,
67+
"paddingRight": 20,
68+
}
69+
}
70+
>
71+
<div
72+
style={
73+
Object {
74+
"paddingBottom": 20,
75+
}
76+
}
77+
>
78+
<p
79+
style={
80+
Object {
81+
"borderBottom": "1px solid #eee",
82+
"color": "#3d3d3d",
83+
"fontFamily": "Helvetica Neue",
84+
"fontSize": 14,
85+
"marginBottom": 5,
86+
"marginLeft": -20,
87+
"paddingBottom": 5,
88+
}
89+
}
90+
>
91+
regular text
92+
</p>
93+
<p
94+
data-css-6bregx=""
95+
>
96+
Hello World!
97+
</p>
98+
<p
99+
data-css-6bregx=""
100+
>
101+
$123.45
102+
</p>
103+
<p
104+
data-css-6bregx=""
105+
>
106+
The quick brown fox jumped over the slow lazy dog.
107+
</p>
108+
</div>
109+
<div
110+
style={
111+
Object {
112+
"paddingBottom": 20,
113+
}
114+
}
115+
>
116+
<p
117+
style={
118+
Object {
119+
"borderBottom": "1px solid #eee",
120+
"color": "#3d3d3d",
121+
"fontFamily": "Helvetica Neue",
122+
"fontSize": 14,
123+
"marginBottom": 5,
124+
"marginLeft": -20,
125+
"paddingBottom": 5,
126+
}
127+
}
128+
>
129+
huge paragraph
130+
</p>
131+
<p
132+
data-css-6bregx=""
133+
>
134+
Wayfarers intelligentsia salvia sartorial keffiyeh locavore direct trade flexitarian vexillologist ugh single-origin coffee. Hexagon heirloom direct trade palo santo distillery, PBR&B bespoke fanny pack adaptogen affogato bitters kombucha sartorial taiyaki next level. Cliche artisan iPhone bushwick church-key. Artisan forage mustache, chartreuse vexillologist echo park cronut. 8-bit fanny pack 90's post-ironic venmo vegan. Humblebrag cliche pork belly, cronut twee wayfarers salvia meditation plaid cornhole. Tumeric literally yr XOXO, ennui single-origin coffee blog jianbing jean shorts plaid typewriter prism whatever pabst flannel. Tousled lomo next level pickled mixtape. Everyday carry ennui polaroid chartreuse, biodiesel trust fund hashtag umami cardigan hot chicken locavore gochujang quinoa coloring book williamsburg. Next level 8-bit cornhole brunch venmo. Enamel pin normcore DIY jianbing irony thundercats. Taxidermy quinoa kinfolk, hexagon godard hell of banjo forage ugh blog. Kale chips umami +1 shabby chic air plant keffiyeh authentic whatever sriracha wayfarers letterpress tofu brooklyn next level salvia. Selfies readymade vegan synth chillwave pug banjo dreamcatcher freegan. Artisan cliche subway tile mumblecore, whatever pok pok tote bag celiac hella poke tousled listicle. Deep v unicorn scenester cred direct trade kickstarter microdosing cardigan mustache ennui tumblr umami farm-to-table literally listicle. Post-ironic semiotics venmo gochujang cray green juice lo-fi cardigan tilde prism pop-up jean shorts shoreditch occupy readymade. Portland messenger bag art party, succulents cred lyft bespoke. Kinfolk plaid selfies pinterest iPhone pug narwhal, fashion axe coloring book meditation tousled. Lyft trust fund copper mug DIY la croix banh mi. Jianbing raclette man bun mustache tote bag. Vinyl taiyaki kombucha tattooed, try-hard blog freegan you probably haven't heard of them schlitz shaman listicle chambray. Swag slow-carb enamel pin affogato migas bespoke fashion axe flannel prism marfa activated charcoal pop-up shabby chic. Oh. You need a little dummy text for your mockup? How quaint. I bet you’re still using Bootstrap too…
135+
</p>
136+
</div>
137+
<div
138+
style={
139+
Object {
140+
"paddingBottom": 20,
141+
}
142+
}
143+
>
144+
<p
145+
style={
146+
Object {
147+
"borderBottom": "1px solid #eee",
148+
"color": "#3d3d3d",
149+
"fontFamily": "Helvetica Neue",
150+
"fontSize": 14,
151+
"marginBottom": 5,
152+
"marginLeft": -20,
153+
"paddingBottom": 5,
154+
}
155+
}
156+
>
157+
style={{ color: "red" }}
158+
</p>
159+
<p
160+
data-css-1xvfq6x=""
161+
>
162+
Hello World!
163+
</p>
164+
</div>
165+
</div>
166+
`;
167+
168+
exports[`Storyshots Text with nested children 1`] = `
169+
<div
170+
style={
171+
Object {
172+
"paddingLeft": 20,
173+
"paddingRight": 20,
174+
}
175+
}
176+
>
177+
<div
178+
style={
179+
Object {
180+
"paddingBottom": 20,
181+
}
182+
}
183+
>
184+
<p
185+
style={
186+
Object {
187+
"borderBottom": "1px solid #eee",
188+
"color": "#3d3d3d",
189+
"fontFamily": "Helvetica Neue",
190+
"fontSize": 14,
191+
"marginBottom": 5,
192+
"marginLeft": -20,
193+
"paddingBottom": 5,
194+
}
195+
}
196+
>
197+
with nested children
198+
</p>
199+
<p
200+
data-css-6bregx=""
201+
>
202+
<p>
203+
<strong>
204+
I am STRONG
205+
</strong>
206+
</p>
207+
<p>
208+
<i>
209+
I am ITALIC
210+
</i>
211+
</p>
212+
<p>
213+
<p
214+
data-css-6bregx=""
215+
>
216+
I am another nested Text component.
217+
</p>
218+
</p>
219+
</p>
220+
</div>
221+
</div>
222+
`;

test/mock-file.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = 'test-file-stub'

test/mock-style.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = {}

0 commit comments

Comments
 (0)