diff --git a/.eslintrc.json b/.eslintrc.json index 52e1d7ce5c..de64bd22f8 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,7 +1,7 @@ { "extends": "eslint:recommended", "parserOptions": { - "ecmaVersion": 2017 + "ecmaVersion": 6 }, "rules": { "no-console": "off", diff --git a/test/unit/path-effects.html b/test/unit/path-effects.html index bb90c1db3d..156e3d4a95 100644 --- a/test/unit/path-effects.html +++ b/test/unit/path-effects.html @@ -49,7 +49,7 @@ document.body.removeChild(el); }); - async function verifyObserverOutput(nestingLevel, nested) { + function verifyObserverOutput(nestingLevel, nested, done) { assert.equal(el.computed, '[' + nested.obj.value + ']'); assert.equal(el.nestedChanged.callCount, nestingLevel == 0 ? 1 : 0); if (nestingLevel == 0) { @@ -105,9 +105,12 @@ assert.equal(el.$.forward.objSubpathChanged.firstCall.args[0].value, nested.obj); assert.equal(el.$.forward.$.compose.objSubpathChanged.firstCall.args[0].path, 'obj'); assert.equal(el.$.forward.$.compose.objSubpathChanged.firstCall.args[0].value, nested.obj); - await Promise.resolve(); // x-pe uses async PropertiesChanged - assert.equal(el.$.pe._propertiesChanged.callCount, 1); - assert.equal(el.$.pe._propertiesChanged.firstCall.args[1].obj, nested.obj); + // x-pe uses async PropertiesChanged + Promise.resolve().then(() => { + assert.equal(el.$.pe._propertiesChanged.callCount, 1); + assert.equal(el.$.pe._propertiesChanged.firstCall.args[1].obj, nested.obj); + done(); + }); break; case 1: assert.equal(el.nestedSubpathChanged.firstCall.args[0].path, 'nested.obj'); @@ -120,9 +123,12 @@ assert.equal(el.$.forward.objSubpathChanged.firstCall.args[0].value, nested.obj); assert.equal(el.$.forward.$.compose.objSubpathChanged.firstCall.args[0].path, 'obj'); assert.equal(el.$.forward.$.compose.objSubpathChanged.firstCall.args[0].value, nested.obj); - await Promise.resolve(); // x-pe uses async PropertiesChanged - assert.equal(el.$.pe._propertiesChanged.callCount, 1); - assert.equal(el.$.pe._propertiesChanged.firstCall.args[1].obj, nested.obj); + // x-pe uses async PropertiesChanged + Promise.resolve().then(() => { + assert.equal(el.$.pe._propertiesChanged.callCount, 1); + assert.equal(el.$.pe._propertiesChanged.firstCall.args[1].obj, nested.obj); + done(); + }); break; case 2: assert.equal(el.nestedSubpathChanged.firstCall.args[0].path, 'nested.obj.value'); @@ -135,16 +141,19 @@ assert.equal(el.$.forward.objSubpathChanged.firstCall.args[0].value, 42); assert.equal(el.$.forward.$.compose.objSubpathChanged.firstCall.args[0].path, 'obj.value'); assert.equal(el.$.forward.$.compose.objSubpathChanged.firstCall.args[0].value, 42); - await Promise.resolve(); // x-pe uses async PropertiesChanged - // Note the PropertiesMixin element only sees a deep set to 'nested.obj.value' - // because it overrides _shouldPropertyChange to allow object re-sets through - assert.equal(el.$.pe._propertiesChanged.callCount, 1); - assert.equal(el.$.pe._propertiesChanged.firstCall.args[1].obj, nested.obj); + // x-pe uses async PropertiesChanged + Promise.resolve().then(() => { + // Note the PropertiesMixin element only sees a deep set to 'nested.obj.value' + // because it overrides _shouldPropertyChange to allow object re-sets through + assert.equal(el.$.pe._propertiesChanged.callCount, 1); + assert.equal(el.$.pe._propertiesChanged.firstCall.args[1].obj, nested.obj); + done(); + }); break; } } - test('downward data flow', async function() { + test('downward data flow', function(done) { // Do the thing el.nested = { obj: { @@ -152,10 +161,10 @@ } }; // Verify - await verifyObserverOutput(0, el.nested); + verifyObserverOutput(0, el.nested, done); }); - test('notification from basic element property change', async function() { + test('notification from basic element property change', function(done) { // Setup el.nested = { obj: { @@ -166,10 +175,10 @@ // Do the thing el.$.basic.notifyingValue = 42; // Verify - await verifyObserverOutput(2, el.nested); + verifyObserverOutput(2, el.nested, done); }); - test('notification from composed element property change', async function() { + test('notification from composed element property change', function(done) { // Setup el.nested = { obj: { @@ -180,10 +189,10 @@ // Do the thing el.$.compose.$.basic1.notifyingValue = 42; // Verify - await verifyObserverOutput(2, el.nested); + verifyObserverOutput(2, el.nested, done); }); - test('notification from forward\'s composed element property change', async function() { + test('notification from forward\'s composed element property change', function(done) { // Setup el.nested = { obj: { @@ -194,10 +203,10 @@ // Do the thing el.$.forward.$.compose.$.basic1.notifyingValue = 42; // Verify - await verifyObserverOutput(2, el.nested); + verifyObserverOutput(2, el.nested, done); }); - test('notification from set in top element', async function() { + test('notification from set in top element', function(done) { // Setup el.nested = { obj: { @@ -208,10 +217,10 @@ // Do the thing el.set('nested.obj.value', 42); // Verify - await verifyObserverOutput(2, el.nested); + verifyObserverOutput(2, el.nested, done); }); - test('notification from set in composed element', async function() { + test('notification from set in composed element', function(done) { // Setup el.nested = { obj: { @@ -222,10 +231,10 @@ // Do the thing el.$.compose.set('obj.value', 42); // Verify - await verifyObserverOutput(2, el.nested); + verifyObserverOutput(2, el.nested, done); }); - test('notification from set in forward element', async function() { + test('notification from set in forward element', function(done) { // Setup el.nested = { obj: { @@ -236,10 +245,10 @@ // Do the thing el.$.forward.set('obj.value', 42); // Verify - await verifyObserverOutput(2, el.nested); + verifyObserverOutput(2, el.nested, done); }); - test('notification from set in forward\'s composed element', async function() { + test('notification from set in forward\'s composed element', function(done) { // Setup el.nested = { obj: { @@ -250,10 +259,10 @@ // Do the thing el.$.forward.$.compose.set('obj.value', 42); // Verify - await verifyObserverOutput(2, el.nested); + verifyObserverOutput(2, el.nested, done); }); - test('notification from object change in compose element', async function() { + test('notification from object change in compose element', function(done) { // Setup el.nested = { obj: { @@ -266,10 +275,10 @@ value: 42 }; // Verify - await verifyObserverOutput(1, el.nested); + verifyObserverOutput(1, el.nested, done); }); - test('notification from object change in forward element', async function() { + test('notification from object change in forward element', function(done) { // Setup el.nested = { obj: { @@ -282,10 +291,10 @@ value: 42 }; // Verify - await verifyObserverOutput(1, el.nested); + verifyObserverOutput(1, el.nested, done); }); - test('notification from object change in forward\'s compose element', async function() { + test('notification from object change in forward\'s compose element', function(done) { // Setup el.nested = { obj: { @@ -299,7 +308,7 @@ value: 42 }; // Verify - await verifyObserverOutput(1, el.nested); + verifyObserverOutput(1, el.nested, done); }); test('cached paths get invalidated by object sets', function() {