UNPKG

1.08 kBJavaScriptView Raw
1import parse from './index.js'
2
3test('#parse', () => {
4 VIEWS.forEach(view => expect(parse(view)).toMatchSnapshot())
5
6 expect(parse(WARNING)).toMatchSnapshot()
7})
8
9const VIEWS = [
10 `Main Vertical`,
11
12 `Main Vertical
13Text`,
14
15 `BlueButton Vertical
16Before Text
17Nested Vertical
18ImageInside Image
19source https://image.com/file.jpg
20VerticalInside Vertical
21
22
23After Text
24text after
25color purple
26when hover
27color red
28Last Vertical
29backgroundColor blue`,
30
31 // ensure that empty spaces at the end of the block don't block the block from
32 // being recognised as a stop point for the props of the previous block
33 `A Vertical
34A1 Text
35color red
36A2 Text
37color white`,
38
39 `Vertical
40backgroundColor props.backgroundColor
41onClick event => props.onClick(props.name, event)
42Title Text
43color props.some.thing || 'red'
44marginLeft props.marginLeft
45text props.some.prop
46CaptureText
47onFocus props.onFocus
48List
49from props.stuff
50when props.stuff.length > 0
51Stuff`,
52]
53
54const WARNING = `Warning Vertical
55EmptyWhen Vertical
56color blue
57when
58color red
59when props. stuff
60backgroundColor purple
61color green`