@khanacademy/wonder-blocks-grid 1.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,559 @@
1
+ // This file is auto-generated by gen-snapshot-tests.js
2
+ // Do not edit this file. To make changes to these snapshot tests:
3
+ // 1. edit the markdown documentation files in the package,
4
+ // packages/wonder-blocks-grid
5
+ // 2. Run `yarn run gen-snapshot-tests`.
6
+ import React from "react";
7
+ import renderer from "react-test-renderer";
8
+
9
+ // Mock react-dom as jest doesn't like findDOMNode.
10
+ jest.mock("react-dom");
11
+ import {Cell, Row} from "@khanacademy/wonder-blocks-grid";
12
+ import Color from "@khanacademy/wonder-blocks-color";
13
+ import {View, Text} from "@khanacademy/wonder-blocks-core";
14
+ import {LabelMedium, Body} from "@khanacademy/wonder-blocks-typography";
15
+ import {MediaLayout} from "@khanacademy/wonder-blocks-layout";
16
+ import {StyleSheet} from "aphrodite";
17
+
18
+ import Gutter from "./../components/gutter.js";
19
+
20
+ describe("wonder-blocks-grid", () => {
21
+ it("example 1", () => {
22
+ const styleSheets = {
23
+ all: StyleSheet.create({
24
+ background: {
25
+ background: Color.offBlack,
26
+ },
27
+ cell: {
28
+ height: 150,
29
+ padding: 5,
30
+ },
31
+ }),
32
+ small: StyleSheet.create({
33
+ cell: {
34
+ background: Color.blue,
35
+ },
36
+ }),
37
+ medium: StyleSheet.create({
38
+ cell: {
39
+ background: Color.green,
40
+ },
41
+ }),
42
+ large: StyleSheet.create({
43
+ cell: {
44
+ background: Color.gold,
45
+ },
46
+ }),
47
+ };
48
+ const example = (
49
+ <MediaLayout styleSheets={styleSheets}>
50
+ {({styles}) => (
51
+ <View style={styles.background}>
52
+ <Row>
53
+ <Cell
54
+ smallCols={2}
55
+ mediumCols={3}
56
+ largeCols={4}
57
+ style={styles.cell}
58
+ >
59
+ {({cols}) => {
60
+ return (
61
+ <View>
62
+ <LabelMedium>
63
+ Cell (
64
+ {cols === 1
65
+ ? "1 column"
66
+ : `${cols} columns`}{" "}
67
+ wide)
68
+ </LabelMedium>
69
+ <br />
70
+ <br />
71
+ <View
72
+ style={{
73
+ textAlign: "right",
74
+ }}
75
+ >
76
+ <LabelMedium>
77
+ Gutter ⇢
78
+ </LabelMedium>
79
+ </View>
80
+ <br />
81
+ <View
82
+ style={{
83
+ textAlign: "left",
84
+ }}
85
+ >
86
+ <LabelMedium>
87
+ Margin ⇢
88
+ </LabelMedium>
89
+ </View>
90
+ </View>
91
+ );
92
+ }}
93
+ </Cell>
94
+ <Cell
95
+ mediumCols={2}
96
+ largeCols={3}
97
+ style={styles.cell}
98
+ >
99
+ {({cols}) => {
100
+ return (
101
+ <View>
102
+ <LabelMedium>
103
+ Cell (
104
+ {cols === 1
105
+ ? "1 column"
106
+ : `${cols} columns`}{" "}
107
+ wide)
108
+ </LabelMedium>
109
+ <br />
110
+ <br />
111
+ <View
112
+ style={{
113
+ textAlign: "center",
114
+ }}
115
+ >
116
+ <LabelMedium>
117
+ ⇠ Gutters ⇢
118
+ </LabelMedium>
119
+ </View>
120
+ </View>
121
+ );
122
+ }}
123
+ </Cell>
124
+ <Cell
125
+ smallCols={2}
126
+ mediumCols={3}
127
+ largeCols={5}
128
+ style={styles.cell}
129
+ >
130
+ {({cols}) => {
131
+ return (
132
+ <View>
133
+ <LabelMedium>
134
+ Cell (
135
+ {cols === 1
136
+ ? "1 column"
137
+ : `${cols} columns`}{" "}
138
+ wide)
139
+ </LabelMedium>
140
+ <br />
141
+ <br />
142
+ <LabelMedium>⇠ Gutter</LabelMedium>
143
+ <br />
144
+ <View
145
+ style={{
146
+ textAlign: "right",
147
+ }}
148
+ >
149
+ <LabelMedium>
150
+ Margin ⇢
151
+ </LabelMedium>
152
+ </View>
153
+ </View>
154
+ );
155
+ }}
156
+ </Cell>
157
+ </Row>
158
+ </View>
159
+ )}
160
+ </MediaLayout>
161
+ );
162
+ const tree = renderer.create(example).toJSON();
163
+ expect(tree).toMatchSnapshot();
164
+ });
165
+
166
+ it("example 2", () => {
167
+ const example = (
168
+ <View
169
+ style={{
170
+ background: Color.offWhite,
171
+ }}
172
+ >
173
+ <Row
174
+ style={{
175
+ background: Color.darkBlue,
176
+ height: 64,
177
+ borderBottom: `1px solid ${Color.white64}`,
178
+ }}
179
+ >
180
+ <Cell
181
+ style={{
182
+ color: Color.white,
183
+ textAlign: "center",
184
+ }}
185
+ >
186
+ Khan Academy
187
+ </Cell>
188
+ </Row>
189
+ <Row
190
+ style={{
191
+ background: Color.darkBlue,
192
+ height: 136,
193
+ }}
194
+ >
195
+ <Cell
196
+ style={{
197
+ color: Color.white,
198
+ }}
199
+ >
200
+ Geometry foundations
201
+ </Cell>
202
+ </Row>
203
+ <Row
204
+ mediaQuery="medium"
205
+ style={{
206
+ background: Color.white,
207
+ height: 71,
208
+ borderBottom: `1px solid ${Color.offBlack8}`,
209
+ overflow: "scroll",
210
+ }}
211
+ >
212
+ <Cell
213
+ cols={2}
214
+ style={{
215
+ background: Color.offBlack8,
216
+ }}
217
+ >
218
+ Possible mastery points
219
+ </Cell>
220
+ <Cell
221
+ smallCols={4}
222
+ mediumCols={6}
223
+ largeCols={10}
224
+ style={{
225
+ background: Color.offBlack8,
226
+ }}
227
+ >
228
+ Beginner / Points to Apprentice
229
+ </Cell>
230
+ </Row>
231
+ <Row
232
+ mediaQuery="large"
233
+ style={{
234
+ background: Color.white,
235
+ height: 71,
236
+ borderBottom: `1px solid ${Color.offBlack8}`,
237
+ }}
238
+ >
239
+ <Cell cols={3}>Possible mastery points</Cell>
240
+ <View>Beginner / Points to Apprentice</View>
241
+ </Row>
242
+ <Row
243
+ mediaQuery="mdOrSmaller"
244
+ style={{
245
+ height: 50,
246
+ }}
247
+ >
248
+ <Cell smallCols={4} mediumCols={8} largeCols={12}>
249
+ Skill Summary
250
+ </Cell>
251
+ </Row>
252
+ <Row
253
+ mediaQuery="mdOrSmaller"
254
+ style={{
255
+ background: Color.white,
256
+ height: 90,
257
+ borderTop: `1px solid ${Color.offBlack8}`,
258
+ borderBottom: `1px solid ${Color.offBlack8}`,
259
+ }}
260
+ >
261
+ <Cell smallCols={4} mediumCols={8} largeCols={12}>
262
+ Intro to Geometry Angles Quiz 1: 10 questions Polygons
263
+ </Cell>
264
+ </Row>
265
+ <Row
266
+ mediaQuery="large"
267
+ style={{
268
+ padding: "17px 0",
269
+ }}
270
+ >
271
+ <Cell cols={3}>
272
+ Skill Summary
273
+ <hr />
274
+ Intro to Geometry
275
+ <hr />
276
+ Angles
277
+ <hr />
278
+ Quiz 1: 10 questions
279
+ <hr />
280
+ Polygons
281
+ </Cell>
282
+ <Cell smallCols={1} mediumCols={5} largeCols={9}>
283
+ <View
284
+ style={{
285
+ background: Color.white,
286
+ height: 360,
287
+ padding: 24,
288
+ border: `1px solid ${Color.offBlack8}`,
289
+ }}
290
+ >
291
+ Intro to geometry
292
+ </View>
293
+ <View
294
+ style={{
295
+ marginTop: 16,
296
+ background: Color.white,
297
+ height: 360,
298
+ padding: 24,
299
+ border: `1px solid ${Color.offBlack8}`,
300
+ }}
301
+ >
302
+ Angles
303
+ </View>
304
+ </Cell>
305
+ </Row>
306
+ <Row
307
+ mediaQuery="mdOrSmaller"
308
+ style={{
309
+ marginTop: 16,
310
+ background: Color.white,
311
+ height: 360,
312
+ borderTop: `1px solid ${Color.offBlack8}`,
313
+ borderBottom: `1px solid ${Color.offBlack8}`,
314
+ }}
315
+ >
316
+ Intro to geometry
317
+ </Row>
318
+ <Row
319
+ mediaQuery="mdOrSmaller"
320
+ style={{
321
+ marginTop: 16,
322
+ background: Color.white,
323
+ height: 360,
324
+ borderTop: `1px solid ${Color.offBlack8}`,
325
+ borderBottom: `1px solid ${Color.offBlack8}`,
326
+ }}
327
+ >
328
+ Angles
329
+ </Row>
330
+ </View>
331
+ );
332
+ const tree = renderer.create(example).toJSON();
333
+ expect(tree).toMatchSnapshot();
334
+ });
335
+
336
+ it("example 3", () => {
337
+ const styleSheets = {
338
+ all: StyleSheet.create({
339
+ background: {
340
+ background: Color.offBlack,
341
+ },
342
+ cell: {
343
+ height: 100,
344
+ padding: "5px 0",
345
+ },
346
+ }),
347
+ small: StyleSheet.create({
348
+ cell: {
349
+ background: Color.blue,
350
+ },
351
+ }),
352
+ medium: StyleSheet.create({
353
+ cell: {
354
+ background: Color.green,
355
+ },
356
+ }),
357
+ large: StyleSheet.create({
358
+ cell: {
359
+ background: Color.gold,
360
+ },
361
+ }),
362
+ };
363
+ const example = (
364
+ <MediaLayout styleSheets={styleSheets}>
365
+ {({styles}) => (
366
+ <View style={styles.background}>
367
+ <Row>
368
+ <Cell cols={1} style={styles.cell}>
369
+ 1
370
+ </Cell>
371
+ <Cell cols={1} style={styles.cell}>
372
+ 1
373
+ </Cell>
374
+ <Cell cols={1} style={styles.cell}>
375
+ 1
376
+ </Cell>
377
+ <Cell cols={1} style={styles.cell}>
378
+ 1
379
+ </Cell>
380
+ <Cell
381
+ mediumCols={1}
382
+ largeCols={1}
383
+ style={styles.cell}
384
+ >
385
+ 1
386
+ </Cell>
387
+ <Cell
388
+ mediumCols={1}
389
+ largeCols={1}
390
+ style={styles.cell}
391
+ >
392
+ 1
393
+ </Cell>
394
+ <Cell
395
+ mediumCols={1}
396
+ largeCols={1}
397
+ style={styles.cell}
398
+ >
399
+ 1
400
+ </Cell>
401
+ <Cell
402
+ mediumCols={1}
403
+ largeCols={1}
404
+ style={styles.cell}
405
+ >
406
+ 1
407
+ </Cell>
408
+ <Cell largeCols={1} style={styles.cell}>
409
+ 1
410
+ </Cell>
411
+ <Cell largeCols={1} style={styles.cell}>
412
+ 1
413
+ </Cell>
414
+ <Cell largeCols={1} style={styles.cell}>
415
+ 1
416
+ </Cell>
417
+ <Cell largeCols={1} style={styles.cell}>
418
+ 1
419
+ </Cell>
420
+ </Row>
421
+ </View>
422
+ )}
423
+ </MediaLayout>
424
+ );
425
+ const tree = renderer.create(example).toJSON();
426
+ expect(tree).toMatchSnapshot();
427
+ });
428
+
429
+ it("example 4", () => {
430
+ const styles = StyleSheet.create({
431
+ background: {
432
+ background: Color.offBlack,
433
+ },
434
+ row: {
435
+ padding: "16px 0",
436
+ border: `1px solid ${Color.gold}`,
437
+ background: Color.white,
438
+ },
439
+ cell: {
440
+ height: 100,
441
+ padding: 5,
442
+ background: Color.gold,
443
+ },
444
+ });
445
+ const example = (
446
+ <View style={styles.background}>
447
+ <Row style={styles.row}>
448
+ <Cell
449
+ smallCols={2}
450
+ mediumCols={4}
451
+ largeCols={6}
452
+ style={styles.cell}
453
+ >
454
+ <Text>Cell</Text>
455
+ </Cell>
456
+ <Cell
457
+ smallCols={2}
458
+ mediumCols={4}
459
+ largeCols={6}
460
+ style={styles.cell}
461
+ >
462
+ <Text>Cell</Text>
463
+ </Cell>
464
+ </Row>
465
+ </View>
466
+ );
467
+ const tree = renderer.create(example).toJSON();
468
+ expect(tree).toMatchSnapshot();
469
+ });
470
+
471
+ it("example 5", () => {
472
+ const styles = StyleSheet.create({
473
+ view: {
474
+ background: Color.offBlack,
475
+ height: "400px",
476
+ },
477
+ row: {
478
+ alignItems: "stretch",
479
+ background: Color.white,
480
+ border: `1px solid ${Color.gold}`,
481
+ display: "flex",
482
+ height: "100%",
483
+ padding: "16px 0",
484
+ },
485
+ cell: {
486
+ background: Color.gold,
487
+ overflowY: "auto",
488
+ padding: 5,
489
+ },
490
+ });
491
+ const example = (
492
+ <View style={styles.view}>
493
+ <Row style={styles.row}>
494
+ <Cell
495
+ smallCols={2}
496
+ mediumCols={4}
497
+ largeCols={4}
498
+ style={styles.cell}
499
+ >
500
+ <Text>Sidebar</Text>
501
+ <ul>
502
+ <li>Chapter 1: Loomings</li>
503
+ <li>Chapter 2: The Carpet-Bag</li>
504
+ <li>Chapter 3: The Spouter-Inn</li>
505
+ <li>Chapter 4: The Counterpane</li>
506
+ <li>Chapter 5: Breakfast</li>
507
+ <li>Chapter 6: The Street</li>
508
+ </ul>
509
+ </Cell>
510
+ <Cell
511
+ smallCols={2}
512
+ mediumCols={4}
513
+ largeCols={8}
514
+ style={styles.cell}
515
+ >
516
+ <Body tag="p">
517
+ Call me Ishmael. Some years ago- never mind how long
518
+ precisely- having little or no money in my purse,
519
+ and nothing particular to interest me on shore, I
520
+ thought I would sail about a little and see the
521
+ watery part of the world. It is a way I have of
522
+ driving off the spleen and regulating the
523
+ circulation. Whenever I find myself growing grim
524
+ about the mouth; whenever it is a damp, drizzly
525
+ November in my soul; whenever I find myself
526
+ involuntarily pausing before coffin warehouses, and
527
+ bringing up the rear of every funeral I meet; and
528
+ especially whenever my hypos get such an upper hand
529
+ of me, that it requires a strong moral principle to
530
+ prevent me from deliberately stepping into the
531
+ street, and methodically knocking people's hats off-
532
+ then, I account it high time to get to sea as soon
533
+ as I can. This is my substitute for pistol and ball.
534
+ With a philosophical flourish Cato throws himself
535
+ upon his sword; I quietly take to the ship. There is
536
+ nothing surprising in this. If they but knew it,
537
+ almost all men in their degree, some time or other,
538
+ cherish very nearly the same feelings towards the
539
+ ocean with me.
540
+ </Body>
541
+
542
+ <Body tag="p">
543
+ There now is your insular city of the Manhattoes,
544
+ belted round by wharves as Indian isles by coral
545
+ reefs- commerce surrounds it with her surf. Right
546
+ and left, the streets take you waterward. Its
547
+ extreme downtown is the battery, where that noble
548
+ mole is washed by waves, and cooled by breezes,
549
+ which a few hours previous were out of sight of
550
+ land. Look at the crowds of water-gazers there.
551
+ </Body>
552
+ </Cell>
553
+ </Row>
554
+ </View>
555
+ );
556
+ const tree = renderer.create(example).toJSON();
557
+ expect(tree).toMatchSnapshot();
558
+ });
559
+ });