Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ce0ae3c

Browse files
Merge pull request zoltantothcom#64 from zoltantothcom/dev
Update Pattern component tests to cover all lines
2 parents aeb987d + a78f96b commit ce0ae3c

File tree

2 files changed

+376
-3
lines changed

2 files changed

+376
-3
lines changed

‎__tests__/components/Pattern.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ describe('REFERENCE - Pattern component', () => {
2525
expect(tree).toMatchSnapshot();
2626
});
2727

28-
xit('renders the individual pattern (Singleton) details in LIGHT mode', () => {
28+
it('renders the individual pattern (Prototype) details in LIGHT mode', () => {
2929
const store = mockStore({
3030
mode: 'light'
3131
});
3232
const tree = renderer
3333
.create(
34-
<MemoryRouter initialEntries={['/patterns/singleton']}>
34+
<MemoryRouter initialEntries={['/patterns/prototype']}>
3535
<Provider store={store}>
36-
<Pattern match={{ params: { id: 'singleton' } }} />
36+
<Pattern match={{ params: { id: 'prototype' } }} />
3737
</Provider>
3838
</MemoryRouter>
3939
)

‎__tests__/components/__snapshots__/Pattern.test.js.snap

Lines changed: 373 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,378 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3+
exports[`REFERENCE - Pattern component renders the individual pattern (Prototype) details in LIGHT mode 1`] = `
4+
.c0 h2,
5+
.c0 h3 {
6+
margin-top: 2.5rem;
7+
}
8+
9+
.c2 {
10+
display: block;
11+
margin-bottom: 8px;
12+
padding: 4px;
13+
text-transform: uppercase;
14+
}
15+
16+
.c3 {
17+
text-transform: capitalize;
18+
}
19+
20+
.c1 {
21+
border-bottom: 1px solid;
22+
display: inline-block;
23+
margin-top: 2rem;
24+
-webkit-text-decoration: none;
25+
text-decoration: none;
26+
}
27+
28+
.c1:hover {
29+
border-bottom: 1px solid transparent;
30+
}
31+
32+
<div
33+
className="c0"
34+
>
35+
<a
36+
className="c1"
37+
href="/patterns"
38+
onClick={[Function]}
39+
>
40+
← Back to Patterns List
41+
</a>
42+
<h2>
43+
Prototype
44+
</h2>
45+
<p>
46+
<span
47+
className="c2"
48+
>
49+
Type:
50+
</span>
51+
<span
52+
className="c3"
53+
>
54+
creational
55+
pattern
56+
</span>
57+
</p>
58+
<p>
59+
<span
60+
className="c2"
61+
>
62+
Definition:
63+
</span>
64+
Specify the kind of objects to create using a prototypical instance,
65+
and create new objects by copying this prototype.
66+
</p>
67+
<p>
68+
<span
69+
className="c2"
70+
>
71+
Use when...
72+
</span>
73+
...
74+
classes to instantiate are available only in runtime
75+
.
76+
</p>
77+
<h3>
78+
ES6
79+
</h3>
80+
<pre
81+
style={
82+
Object {
83+
"background": "#fafafa",
84+
"border": "1px solid #d8d8d8",
85+
"color": "#383a42",
86+
"display": "block",
87+
"overflowX": "auto",
88+
"padding": "1em",
89+
}
90+
}
91+
>
92+
<code>
93+
<span
94+
className="hljs-class"
95+
style={Object {}}
96+
>
97+
<span
98+
style={
99+
Object {
100+
"color": "#a626a4",
101+
}
102+
}
103+
>
104+
class
105+
</span>
106+
107+
<span
108+
style={
109+
Object {
110+
"color": "#4078f2",
111+
}
112+
}
113+
>
114+
Sheep
115+
</span>
116+
117+
</span>
118+
{
119+
120+
<span
121+
style={
122+
Object {
123+
"color": "#a626a4",
124+
}
125+
}
126+
>
127+
constructor
128+
</span>
129+
(name, weight) {
130+
131+
<span
132+
style={
133+
Object {
134+
"color": "#a626a4",
135+
}
136+
}
137+
>
138+
this
139+
</span>
140+
.name = name;
141+
142+
<span
143+
style={
144+
Object {
145+
"color": "#a626a4",
146+
}
147+
}
148+
>
149+
this
150+
</span>
151+
.weight = weight;
152+
}
153+
154+
clone() {
155+
156+
<span
157+
style={
158+
Object {
159+
"color": "#a626a4",
160+
}
161+
}
162+
>
163+
return
164+
</span>
165+
166+
<span
167+
style={
168+
Object {
169+
"color": "#a626a4",
170+
}
171+
}
172+
>
173+
new
174+
</span>
175+
Sheep(
176+
<span
177+
style={
178+
Object {
179+
"color": "#a626a4",
180+
}
181+
}
182+
>
183+
this
184+
</span>
185+
.name,
186+
<span
187+
style={
188+
Object {
189+
"color": "#a626a4",
190+
}
191+
}
192+
>
193+
this
194+
</span>
195+
.weight);
196+
}
197+
}
198+
199+
200+
<span
201+
style={
202+
Object {
203+
"color": "#a626a4",
204+
}
205+
}
206+
>
207+
export
208+
</span>
209+
210+
<span
211+
style={
212+
Object {
213+
"color": "#a626a4",
214+
}
215+
}
216+
>
217+
default
218+
</span>
219+
Sheep;
220+
</code>
221+
</pre>
222+
<h3>
223+
ES5
224+
</h3>
225+
<pre
226+
style={
227+
Object {
228+
"background": "#fafafa",
229+
"border": "1px solid #d8d8d8",
230+
"color": "#383a42",
231+
"display": "block",
232+
"overflowX": "auto",
233+
"padding": "1em",
234+
}
235+
}
236+
>
237+
<code>
238+
<span
239+
className="hljs-function"
240+
style={Object {}}
241+
>
242+
<span
243+
style={
244+
Object {
245+
"color": "#a626a4",
246+
}
247+
}
248+
>
249+
function
250+
</span>
251+
252+
<span
253+
style={
254+
Object {
255+
"color": "#4078f2",
256+
}
257+
}
258+
>
259+
Sheep
260+
</span>
261+
(
262+
<span
263+
className="hljs-params"
264+
style={Object {}}
265+
>
266+
name, weight
267+
</span>
268+
)
269+
</span>
270+
{
271+
272+
<span
273+
style={
274+
Object {
275+
"color": "#a626a4",
276+
}
277+
}
278+
>
279+
this
280+
</span>
281+
.name = name;
282+
283+
<span
284+
style={
285+
Object {
286+
"color": "#a626a4",
287+
}
288+
}
289+
>
290+
this
291+
</span>
292+
.weight = weight;
293+
}
294+
295+
Sheep.prototype.clone =
296+
<span
297+
className="hljs-function"
298+
style={Object {}}
299+
>
300+
<span
301+
style={
302+
Object {
303+
"color": "#a626a4",
304+
}
305+
}
306+
>
307+
function
308+
</span>
309+
(
310+
<span
311+
className="hljs-params"
312+
style={Object {}}
313+
/>
314+
)
315+
</span>
316+
{
317+
318+
<span
319+
style={
320+
Object {
321+
"color": "#a626a4",
322+
}
323+
}
324+
>
325+
return
326+
</span>
327+
328+
<span
329+
style={
330+
Object {
331+
"color": "#a626a4",
332+
}
333+
}
334+
>
335+
new
336+
</span>
337+
Sheep(
338+
<span
339+
style={
340+
Object {
341+
"color": "#a626a4",
342+
}
343+
}
344+
>
345+
this
346+
</span>
347+
.name,
348+
<span
349+
style={
350+
Object {
351+
"color": "#a626a4",
352+
}
353+
}
354+
>
355+
this
356+
</span>
357+
.weight);
358+
};
359+
360+
361+
<span
362+
style={
363+
Object {
364+
"color": "#c18401",
365+
}
366+
}
367+
>
368+
module
369+
</span>
370+
.exports = Sheep;
371+
</code>
372+
</pre>
373+
</div>
374+
`;
375+
3376
exports[`REFERENCE - Pattern component renders the individual pattern (Singleton) details in DARK mode 1`] = `
4377
.c0 h2,
5378
.c0 h3 {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /