Skip to content

Commit d4a7a45

Browse files
committed
Revert use of async/await due to lack of build/serve support.
1 parent dea9080 commit d4a7a45

2 files changed

Lines changed: 44 additions & 35 deletions

File tree

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"extends": "eslint:recommended",
33
"parserOptions": {
4-
"ecmaVersion": 2017
4+
"ecmaVersion": 6
55
},
66
"rules": {
77
"no-console": "off",

test/unit/path-effects.html

Lines changed: 43 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
document.body.removeChild(el);
5050
});
5151

52-
async function verifyObserverOutput(nestingLevel, nested) {
52+
function verifyObserverOutput(nestingLevel, nested, done) {
5353
assert.equal(el.computed, '[' + nested.obj.value + ']');
5454
assert.equal(el.nestedChanged.callCount, nestingLevel == 0 ? 1 : 0);
5555
if (nestingLevel == 0) {
@@ -105,9 +105,12 @@
105105
assert.equal(el.$.forward.objSubpathChanged.firstCall.args[0].value, nested.obj);
106106
assert.equal(el.$.forward.$.compose.objSubpathChanged.firstCall.args[0].path, 'obj');
107107
assert.equal(el.$.forward.$.compose.objSubpathChanged.firstCall.args[0].value, nested.obj);
108-
await Promise.resolve(); // x-pe uses async PropertiesChanged
109-
assert.equal(el.$.pe._propertiesChanged.callCount, 1);
110-
assert.equal(el.$.pe._propertiesChanged.firstCall.args[1].obj, nested.obj);
108+
// x-pe uses async PropertiesChanged
109+
Promise.resolve().then(() => {
110+
assert.equal(el.$.pe._propertiesChanged.callCount, 1);
111+
assert.equal(el.$.pe._propertiesChanged.firstCall.args[1].obj, nested.obj);
112+
done();
113+
});
111114
break;
112115
case 1:
113116
assert.equal(el.nestedSubpathChanged.firstCall.args[0].path, 'nested.obj');
@@ -120,9 +123,12 @@
120123
assert.equal(el.$.forward.objSubpathChanged.firstCall.args[0].value, nested.obj);
121124
assert.equal(el.$.forward.$.compose.objSubpathChanged.firstCall.args[0].path, 'obj');
122125
assert.equal(el.$.forward.$.compose.objSubpathChanged.firstCall.args[0].value, nested.obj);
123-
await Promise.resolve(); // x-pe uses async PropertiesChanged
124-
assert.equal(el.$.pe._propertiesChanged.callCount, 1);
125-
assert.equal(el.$.pe._propertiesChanged.firstCall.args[1].obj, nested.obj);
126+
// x-pe uses async PropertiesChanged
127+
Promise.resolve().then(() => {
128+
assert.equal(el.$.pe._propertiesChanged.callCount, 1);
129+
assert.equal(el.$.pe._propertiesChanged.firstCall.args[1].obj, nested.obj);
130+
done();
131+
});
126132
break;
127133
case 2:
128134
assert.equal(el.nestedSubpathChanged.firstCall.args[0].path, 'nested.obj.value');
@@ -135,27 +141,30 @@
135141
assert.equal(el.$.forward.objSubpathChanged.firstCall.args[0].value, 42);
136142
assert.equal(el.$.forward.$.compose.objSubpathChanged.firstCall.args[0].path, 'obj.value');
137143
assert.equal(el.$.forward.$.compose.objSubpathChanged.firstCall.args[0].value, 42);
138-
await Promise.resolve(); // x-pe uses async PropertiesChanged
139-
// Note the PropertiesMixin element only sees a deep set to 'nested.obj.value'
140-
// because it overrides _shouldPropertyChange to allow object re-sets through
141-
assert.equal(el.$.pe._propertiesChanged.callCount, 1);
142-
assert.equal(el.$.pe._propertiesChanged.firstCall.args[1].obj, nested.obj);
144+
// x-pe uses async PropertiesChanged
145+
Promise.resolve().then(() => {
146+
// Note the PropertiesMixin element only sees a deep set to 'nested.obj.value'
147+
// because it overrides _shouldPropertyChange to allow object re-sets through
148+
assert.equal(el.$.pe._propertiesChanged.callCount, 1);
149+
assert.equal(el.$.pe._propertiesChanged.firstCall.args[1].obj, nested.obj);
150+
done();
151+
});
143152
break;
144153
}
145154
}
146155

147-
test('downward data flow', async function() {
156+
test('downward data flow', function(done) {
148157
// Do the thing
149158
el.nested = {
150159
obj: {
151160
value: 42
152161
}
153162
};
154163
// Verify
155-
await verifyObserverOutput(0, el.nested);
164+
verifyObserverOutput(0, el.nested, done);
156165
});
157166

158-
test('notification from basic element property change', async function() {
167+
test('notification from basic element property change', function(done) {
159168
// Setup
160169
el.nested = {
161170
obj: {
@@ -166,10 +175,10 @@
166175
// Do the thing
167176
el.$.basic.notifyingValue = 42;
168177
// Verify
169-
await verifyObserverOutput(2, el.nested);
178+
verifyObserverOutput(2, el.nested, done);
170179
});
171180

172-
test('notification from composed element property change', async function() {
181+
test('notification from composed element property change', function(done) {
173182
// Setup
174183
el.nested = {
175184
obj: {
@@ -180,10 +189,10 @@
180189
// Do the thing
181190
el.$.compose.$.basic1.notifyingValue = 42;
182191
// Verify
183-
await verifyObserverOutput(2, el.nested);
192+
verifyObserverOutput(2, el.nested, done);
184193
});
185194

186-
test('notification from forward\'s composed element property change', async function() {
195+
test('notification from forward\'s composed element property change', function(done) {
187196
// Setup
188197
el.nested = {
189198
obj: {
@@ -194,10 +203,10 @@
194203
// Do the thing
195204
el.$.forward.$.compose.$.basic1.notifyingValue = 42;
196205
// Verify
197-
await verifyObserverOutput(2, el.nested);
206+
verifyObserverOutput(2, el.nested, done);
198207
});
199208

200-
test('notification from set in top element', async function() {
209+
test('notification from set in top element', function(done) {
201210
// Setup
202211
el.nested = {
203212
obj: {
@@ -208,10 +217,10 @@
208217
// Do the thing
209218
el.set('nested.obj.value', 42);
210219
// Verify
211-
await verifyObserverOutput(2, el.nested);
220+
verifyObserverOutput(2, el.nested, done);
212221
});
213222

214-
test('notification from set in composed element', async function() {
223+
test('notification from set in composed element', function(done) {
215224
// Setup
216225
el.nested = {
217226
obj: {
@@ -222,10 +231,10 @@
222231
// Do the thing
223232
el.$.compose.set('obj.value', 42);
224233
// Verify
225-
await verifyObserverOutput(2, el.nested);
234+
verifyObserverOutput(2, el.nested, done);
226235
});
227236

228-
test('notification from set in forward element', async function() {
237+
test('notification from set in forward element', function(done) {
229238
// Setup
230239
el.nested = {
231240
obj: {
@@ -236,10 +245,10 @@
236245
// Do the thing
237246
el.$.forward.set('obj.value', 42);
238247
// Verify
239-
await verifyObserverOutput(2, el.nested);
248+
verifyObserverOutput(2, el.nested, done);
240249
});
241250

242-
test('notification from set in forward\'s composed element', async function() {
251+
test('notification from set in forward\'s composed element', function(done) {
243252
// Setup
244253
el.nested = {
245254
obj: {
@@ -250,10 +259,10 @@
250259
// Do the thing
251260
el.$.forward.$.compose.set('obj.value', 42);
252261
// Verify
253-
await verifyObserverOutput(2, el.nested);
262+
verifyObserverOutput(2, el.nested, done);
254263
});
255264

256-
test('notification from object change in compose element', async function() {
265+
test('notification from object change in compose element', function(done) {
257266
// Setup
258267
el.nested = {
259268
obj: {
@@ -266,10 +275,10 @@
266275
value: 42
267276
};
268277
// Verify
269-
await verifyObserverOutput(1, el.nested);
278+
verifyObserverOutput(1, el.nested, done);
270279
});
271280

272-
test('notification from object change in forward element', async function() {
281+
test('notification from object change in forward element', function(done) {
273282
// Setup
274283
el.nested = {
275284
obj: {
@@ -282,10 +291,10 @@
282291
value: 42
283292
};
284293
// Verify
285-
await verifyObserverOutput(1, el.nested);
294+
verifyObserverOutput(1, el.nested, done);
286295
});
287296

288-
test('notification from object change in forward\'s compose element', async function() {
297+
test('notification from object change in forward\'s compose element', function(done) {
289298
// Setup
290299
el.nested = {
291300
obj: {
@@ -299,7 +308,7 @@
299308
value: 42
300309
};
301310
// Verify
302-
await verifyObserverOutput(1, el.nested);
311+
verifyObserverOutput(1, el.nested, done);
303312
});
304313

305314
test('cached paths get invalidated by object sets', function() {

0 commit comments

Comments
 (0)