syntax.test.js 3.78 KB
Newer Older
1
2
3
/**
 * Copyright (c) 2015-present, Facebook, Inc.
 *
Sophie Alpert's avatar
Sophie Alpert committed
4
5
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
6
7
 */

8
import initDOM from './initDOM';
9
10
11
12

describe('Integration', () => {
  describe('Language syntax', () => {
    it('array destructuring', async () => {
13
      const doc = await initDOM('array-destructuring');
14

15
16
      expect(
        doc.getElementById('feature-array-destructuring').childElementCount
17
      ).toBe(4);
18
      doc.defaultView.close();
19
    });
20
21

    it('array spread', async () => {
22
      const doc = await initDOM('array-spread');
23

24
25
26
      expect(doc.getElementById('feature-array-spread').childElementCount).toBe(
        4
      );
27
      doc.defaultView.close();
28
    });
29
30

    it('async/await', async () => {
31
      const doc = await initDOM('async-await');
32

33
34
35
      expect(doc.getElementById('feature-async-await').childElementCount).toBe(
        4
      );
36
      doc.defaultView.close();
37
    });
38
39

    it('class properties', async () => {
40
      const doc = await initDOM('class-properties');
41

42
43
      expect(
        doc.getElementById('feature-class-properties').childElementCount
44
      ).toBe(4);
45
      doc.defaultView.close();
46
    });
47
48

    it('computed properties', async () => {
49
      const doc = await initDOM('computed-properties');
50

51
52
      expect(
        doc.getElementById('feature-computed-properties').childElementCount
53
      ).toBe(4);
54
      doc.defaultView.close();
55
    });
56
57

    it('custom interpolation', async () => {
58
      const doc = await initDOM('custom-interpolation');
59

60
61
      expect(
        doc.getElementById('feature-custom-interpolation').childElementCount
62
      ).toBe(4);
63
      doc.defaultView.close();
64
    });
65
66

    it('default parameters', async () => {
67
      const doc = await initDOM('default-parameters');
68

69
70
      expect(
        doc.getElementById('feature-default-parameters').childElementCount
71
      ).toBe(4);
72
      doc.defaultView.close();
73
    });
74
75

    it('destructuring and await', async () => {
76
      const doc = await initDOM('destructuring-and-await');
77

78
79
      expect(
        doc.getElementById('feature-destructuring-and-await').childElementCount
80
      ).toBe(4);
81
      doc.defaultView.close();
82
    });
83
84

    it('generators', async () => {
85
      const doc = await initDOM('generators');
86

87
88
89
      expect(doc.getElementById('feature-generators').childElementCount).toBe(
        4
      );
90
      doc.defaultView.close();
91
    });
92
93

    it('object destructuring', async () => {
94
      const doc = await initDOM('object-destructuring');
95

96
97
      expect(
        doc.getElementById('feature-object-destructuring').childElementCount
98
      ).toBe(4);
99
      doc.defaultView.close();
100
    });
101
102

    it('object spread', async () => {
103
      const doc = await initDOM('object-spread');
104

105
106
      expect(
        doc.getElementById('feature-object-spread').childElementCount
107
      ).toBe(4);
108
      doc.defaultView.close();
109
    });
110
111

    it('promises', async () => {
112
      const doc = await initDOM('promises');
113

114
      expect(doc.getElementById('feature-promises').childElementCount).toBe(4);
115
      doc.defaultView.close();
116
    });
117
118

    it('rest + default', async () => {
119
      const doc = await initDOM('rest-and-default');
120

121
122
      expect(
        doc.getElementById('feature-rest-and-default').childElementCount
123
      ).toBe(4);
124
      doc.defaultView.close();
125
    });
126
127

    it('rest parameters', async () => {
128
      const doc = await initDOM('rest-parameters');
129

130
131
      expect(
        doc.getElementById('feature-rest-parameters').childElementCount
132
      ).toBe(4);
133
      doc.defaultView.close();
134
    });
135
136

    it('template interpolation', async () => {
137
138
139
140
      const doc = await initDOM('template-interpolation');

      expect(
        doc.getElementById('feature-template-interpolation').childElementCount
141
      ).toBe(4);
142
      doc.defaultView.close();
143
144
145
    });
  });
});