From 68707ad76009f8f8bc12843fd89780a929659e18 Mon Sep 17 00:00:00 2001 From: Tim van der Lippe Date: Fri, 30 Oct 2015 22:53:02 +0100 Subject: [PATCH] Deduplicate setup and verifying in notify-path test suite --- test/unit/notify-path-elements.html | 2 +- test/unit/notify-path.html | 461 +++++----------------------- 2 files changed, 86 insertions(+), 377 deletions(-) diff --git a/test/unit/notify-path-elements.html b/test/unit/notify-path-elements.html index c10d2f05e5..48bf32cbfc 100644 --- a/test/unit/notify-path-elements.html +++ b/test/unit/notify-path-elements.html @@ -230,4 +230,4 @@ cChanged: function() {} }); - \ No newline at end of file + diff --git a/test/unit/notify-path.html b/test/unit/notify-path.html index 7cc82c414d..b0997f3436 100644 --- a/test/unit/notify-path.html +++ b/test/unit/notify-path.html @@ -47,51 +47,7 @@ document.body.removeChild(el); }); - test('downward data flow', function() { - // Setup - var nested = { - obj: { - value: 42 - } - }; - el.expectedNestedSubpath = 'nested'; - el.expectedNestedValue = nested; - el.expectedNestedObjSubpath = 'nested.obj'; - el.expectedNestedObjValue = nested.obj; - el.$.compose.expectedObjSubpath = 'obj'; - el.$.compose.expectedObjValue = nested.obj; - el.$.forward.expectedObjSubpath = 'obj'; - el.$.forward.expectedObjValue = nested.obj; - el.$.forward.$.compose.expectedObjSubpath = 'obj'; - el.$.forward.$.compose.expectedObjValue = nested.obj; - // Do the thing - el.nested = nested; - // Verify - assert.equal(el.observerCounts.nestedSubpathChanged, 1); - assert.equal(el.observerCounts.nestedObjChanged, 1); - assert.equal(el.observerCounts.nestedObjSubpathChanged, 1); - assert.equal(el.observerCounts.nestedObjValueChanged, 1); - assert.equal(el.$.compose.observerCounts.objSubpathChanged, 1); - assert.equal(el.$.compose.observerCounts.objValueChanged, 1); - assert.equal(el.$.forward.observerCounts.objSubpathChanged, 1); - assert.equal(el.$.forward.observerCounts.objValueChanged, 1); - assert.equal(el.$.basic.notifyingValue, 42); - assert.equal(el.$.compose.obj, nested.obj); - assert.equal(el.$.compose.$.basic1.notifyingValue, 42); - assert.equal(el.$.compose.$.basic2.notifyingValue, 42); - assert.equal(el.$.forward.obj, nested.obj); - assert.equal(el.$.forward.$.compose.obj, nested.obj); - assert.equal(el.$.forward.$.compose.$.basic1.notifyingValue, 42); - assert.equal(el.$.forward.$.compose.$.basic2.notifyingValue, 42); - assert.equal(el.$.basic.getAttribute('attrvalue'), '42'); - assert.equal(el.$.compose.$.basic1.getAttribute('attrvalue'), '42'); - assert.equal(el.$.compose.$.basic2.getAttribute('attrvalue'), '42'); - assert.equal(el.$.forward.$.compose.$.basic1.getAttribute('attrvalue'), '42'); - assert.equal(el.$.forward.$.compose.$.basic2.getAttribute('attrvalue'), '42'); - }); - - test('notification from basic element property change', function() { - // Setup + function setupNested() { var nested = { obj: { value: 41 @@ -109,53 +65,35 @@ el.$.forward.$.compose.expectedObjSubpath = 'obj.value'; el.$.forward.$.compose.expectedObjValue = 42; el.clearObserverCounts(); - // Do the thing - el.$.basic.notifyingValue = 42; - // Verify - assert.equal(el.observerCounts.nestedSubpathChanged, 1); - assert.equal(el.observerCounts.nestedObjChanged, 0); - assert.equal(el.observerCounts.nestedObjSubpathChanged, 1); - assert.equal(el.observerCounts.nestedObjValueChanged, 1); - assert.equal(el.$.compose.observerCounts.objSubpathChanged, 1); - assert.equal(el.$.compose.observerCounts.objValueChanged, 1); - assert.equal(el.$.forward.observerCounts.objSubpathChanged, 1); - assert.equal(el.$.forward.observerCounts.objValueChanged, 1); - assert.equal(el.$.basic.notifyingValue, 42); - assert.equal(el.$.compose.$.basic1.notifyingValue, 42); - assert.equal(el.$.compose.$.basic2.notifyingValue, 42); - assert.equal(el.$.forward.$.compose.$.basic1.notifyingValue, 42); - assert.equal(el.$.forward.$.compose.$.basic2.notifyingValue, 42); - assert.equal(el.$.basic.getAttribute('attrvalue'), '42'); - assert.equal(el.$.compose.$.basic1.getAttribute('attrvalue'), '42'); - assert.equal(el.$.compose.$.basic2.getAttribute('attrvalue'), '42'); - assert.equal(el.$.forward.$.compose.$.basic1.getAttribute('attrvalue'), '42'); - assert.equal(el.$.forward.$.compose.$.basic2.getAttribute('attrvalue'), '42'); - }); + } - test('notification from composed element property change', function() { - // Setup - var nested = { + function setupComposedAndGetObject() { + el.nested = { obj: { value: 41 } }; - el.nested = nested; - el.expectedNestedSubpath = 'nested.obj.value'; - el.expectedNestedValue = 42; - el.expectedNestedObjSubpath = 'nested.obj.value'; - el.expectedNestedObjValue = 42; - el.$.compose.expectedObjSubpath = 'obj.value'; - el.$.compose.expectedObjValue = 42; - el.$.forward.expectedObjSubpath = 'obj.value'; - el.$.forward.expectedObjValue = 42; - el.$.forward.$.compose.expectedObjSubpath = 'obj.value'; - el.$.forward.$.compose.expectedObjValue = 42; + var obj = { + value: 42 + }; + el.expectedNestedSubpath = 'nested.obj'; + el.expectedNestedValue = obj; + el.expectedNestedObjSubpath = 'nested.obj'; + el.expectedNestedObjValue = obj; + el.$.compose.expectedObjSubpath = 'obj'; + el.$.compose.expectedObjValue = obj; + el.$.forward.expectedObjSubpath = 'obj'; + el.$.forward.expectedObjValue = obj; + el.$.forward.$.compose.expectedObjSubpath = 'obj'; + el.$.forward.$.compose.expectedObjValue = obj; el.clearObserverCounts(); - // Do the thing - el.$.compose.$.basic1.notifyingValue = 42; - // Verify + + return obj; + } + + function verifyObserverOutput(expectedNestedObjChanged) { assert.equal(el.observerCounts.nestedSubpathChanged, 1); - assert.equal(el.observerCounts.nestedObjChanged, 0); + assert.equal(el.observerCounts.nestedObjChanged, expectedNestedObjChanged); assert.equal(el.observerCounts.nestedObjSubpathChanged, 1); assert.equal(el.observerCounts.nestedObjValueChanged, 1); assert.equal(el.$.compose.observerCounts.objSubpathChanged, 1); @@ -173,356 +111,127 @@ assert.equal(el.$.compose.$.basic2.getAttribute('attrvalue'), '42'); assert.equal(el.$.forward.$.compose.$.basic1.getAttribute('attrvalue'), '42'); assert.equal(el.$.forward.$.compose.$.basic2.getAttribute('attrvalue'), '42'); - }); + } - test('notification from forward\'s composed element property change', function() { + function verifyNestedObserversOutput() { + verifyObserverOutput(0); + } + + function verifyNonNestedObserversOutput() { + verifyObserverOutput(1); + } + + test('downward data flow', function() { // Setup var nested = { obj: { - value: 41 + value: 42 } }; + el.expectedNestedSubpath = 'nested'; + el.expectedNestedValue = nested; + el.expectedNestedObjSubpath = 'nested.obj'; + el.expectedNestedObjValue = nested.obj; + el.$.compose.expectedObjSubpath = 'obj'; + el.$.compose.expectedObjValue = nested.obj; + el.$.forward.expectedObjSubpath = 'obj'; + el.$.forward.expectedObjValue = nested.obj; + el.$.forward.$.compose.expectedObjSubpath = 'obj'; + el.$.forward.$.compose.expectedObjValue = nested.obj; + // Do the thing el.nested = nested; - el.expectedNestedSubpath = 'nested.obj.value'; - el.expectedNestedValue = 42; - el.expectedNestedObjSubpath = 'nested.obj.value'; - el.expectedNestedObjValue = 42; - el.$.compose.expectedObjSubpath = 'obj.value'; - el.$.compose.expectedObjValue = 42; - el.$.forward.expectedObjSubpath = 'obj.value'; - el.$.forward.expectedObjValue = 42; - el.$.forward.$.compose.expectedObjSubpath = 'obj.value'; - el.$.forward.$.compose.expectedObjValue = 42; - el.clearObserverCounts(); + // Verify + verifyNonNestedObserversOutput(); + }); + + test('notification from basic element property change', function() { + // Setup + setupNested(); + // Do the thing + el.$.basic.notifyingValue = 42; + // Verify + verifyNestedObserversOutput(); + }); + + test('notification from composed element property change', function() { + // Setup + setupNested(); + // Do the thing + el.$.compose.$.basic1.notifyingValue = 42; + // Verify + verifyNestedObserversOutput(); + }); + + test('notification from forward\'s composed element property change', function() { + // Setup + setupNested(); // Do the thing el.$.forward.$.compose.$.basic1.notifyingValue = 42; // Verify - assert.equal(el.observerCounts.nestedSubpathChanged, 1); - assert.equal(el.observerCounts.nestedObjChanged, 0); - assert.equal(el.observerCounts.nestedObjSubpathChanged, 1); - assert.equal(el.observerCounts.nestedObjValueChanged, 1); - assert.equal(el.$.compose.observerCounts.objSubpathChanged, 1); - assert.equal(el.$.compose.observerCounts.objValueChanged, 1); - assert.equal(el.$.forward.observerCounts.objSubpathChanged, 1); - assert.equal(el.$.forward.observerCounts.objValueChanged, 1); - assert.equal(el.$.basic.notifyingValue, 42); - assert.equal(el.$.basic.notifyingValue, 42); - assert.equal(el.$.compose.$.basic1.notifyingValue, 42); - assert.equal(el.$.compose.$.basic2.notifyingValue, 42); - assert.equal(el.$.forward.$.compose.$.basic1.notifyingValue, 42); - assert.equal(el.$.forward.$.compose.$.basic2.notifyingValue, 42); - assert.equal(el.$.basic.getAttribute('attrvalue'), '42'); - assert.equal(el.$.compose.$.basic1.getAttribute('attrvalue'), '42'); - assert.equal(el.$.compose.$.basic2.getAttribute('attrvalue'), '42'); - assert.equal(el.$.forward.$.compose.$.basic1.getAttribute('attrvalue'), '42'); - assert.equal(el.$.forward.$.compose.$.basic2.getAttribute('attrvalue'), '42'); + verifyNestedObserversOutput(); }); test('notification from set in top element', function() { // Setup - var nested = { - obj: { - value: 41 - } - }; - el.nested = nested; - el.expectedNestedSubpath = 'nested.obj.value'; - el.expectedNestedValue = 42; - el.expectedNestedObjSubpath = 'nested.obj.value'; - el.expectedNestedObjValue = 42; - el.$.compose.expectedObjSubpath = 'obj.value'; - el.$.compose.expectedObjValue = 42; - el.$.forward.expectedObjSubpath = 'obj.value'; - el.$.forward.expectedObjValue = 42; - el.$.forward.$.compose.expectedObjSubpath = 'obj.value'; - el.$.forward.$.compose.expectedObjValue = 42; - el.clearObserverCounts(); + setupNested(); // Do the thing el.set('nested.obj.value', 42); // Verify - assert.equal(el.observerCounts.nestedSubpathChanged, 1); - assert.equal(el.observerCounts.nestedObjChanged, 0); - assert.equal(el.observerCounts.nestedObjSubpathChanged, 1); - assert.equal(el.observerCounts.nestedObjValueChanged, 1); - assert.equal(el.$.compose.observerCounts.objSubpathChanged, 1); - assert.equal(el.$.compose.observerCounts.objValueChanged, 1); - assert.equal(el.$.forward.observerCounts.objSubpathChanged, 1); - assert.equal(el.$.forward.observerCounts.objValueChanged, 1); - assert.equal(el.$.basic.notifyingValue, 42); - assert.equal(el.$.basic.notifyingValue, 42); - assert.equal(el.$.compose.$.basic1.notifyingValue, 42); - assert.equal(el.$.compose.$.basic2.notifyingValue, 42); - assert.equal(el.$.forward.$.compose.$.basic1.notifyingValue, 42); - assert.equal(el.$.forward.$.compose.$.basic2.notifyingValue, 42); - assert.equal(el.$.basic.getAttribute('attrvalue'), '42'); - assert.equal(el.$.compose.$.basic1.getAttribute('attrvalue'), '42'); - assert.equal(el.$.compose.$.basic2.getAttribute('attrvalue'), '42'); - assert.equal(el.$.forward.$.compose.$.basic1.getAttribute('attrvalue'), '42'); - assert.equal(el.$.forward.$.compose.$.basic2.getAttribute('attrvalue'), '42'); + verifyNestedObserversOutput(); }); test('notification from set in composed element', function() { // Setup - var nested = { - obj: { - value: 41 - } - }; - el.nested = nested; - el.expectedNestedSubpath = 'nested.obj.value'; - el.expectedNestedValue = 42; - el.expectedNestedObjSubpath = 'nested.obj.value'; - el.expectedNestedObjValue = 42; - el.$.compose.expectedObjSubpath = 'obj.value'; - el.$.compose.expectedObjValue = 42; - el.$.forward.expectedObjSubpath = 'obj.value'; - el.$.forward.expectedObjValue = 42; - el.$.forward.$.compose.expectedObjSubpath = 'obj.value'; - el.$.forward.$.compose.expectedObjValue = 42; - el.clearObserverCounts(); + setupNested(); // Do the thing el.$.compose.set('obj.value', 42); // Verify - assert.equal(el.observerCounts.nestedSubpathChanged, 1); - assert.equal(el.observerCounts.nestedObjChanged, 0); - assert.equal(el.observerCounts.nestedObjSubpathChanged, 1); - assert.equal(el.observerCounts.nestedObjValueChanged, 1); - assert.equal(el.$.compose.observerCounts.objSubpathChanged, 1); - assert.equal(el.$.compose.observerCounts.objValueChanged, 1); - assert.equal(el.$.forward.observerCounts.objSubpathChanged, 1); - assert.equal(el.$.forward.observerCounts.objValueChanged, 1); - assert.equal(el.$.basic.notifyingValue, 42); - assert.equal(el.$.basic.notifyingValue, 42); - assert.equal(el.$.compose.$.basic1.notifyingValue, 42); - assert.equal(el.$.compose.$.basic2.notifyingValue, 42); - assert.equal(el.$.forward.$.compose.$.basic1.notifyingValue, 42); - assert.equal(el.$.forward.$.compose.$.basic2.notifyingValue, 42); - assert.equal(el.$.basic.getAttribute('attrvalue'), '42'); - assert.equal(el.$.compose.$.basic1.getAttribute('attrvalue'), '42'); - assert.equal(el.$.compose.$.basic2.getAttribute('attrvalue'), '42'); - assert.equal(el.$.forward.$.compose.$.basic1.getAttribute('attrvalue'), '42'); - assert.equal(el.$.forward.$.compose.$.basic2.getAttribute('attrvalue'), '42'); + verifyNestedObserversOutput(); }); test('notification from set in forward element', function() { // Setup - var nested = { - obj: { - value: 41 - } - }; - el.nested = nested; - el.expectedNestedSubpath = 'nested.obj.value'; - el.expectedNestedValue = 42; - el.expectedNestedObjSubpath = 'nested.obj.value'; - el.expectedNestedObjValue = 42; - el.$.compose.expectedObjSubpath = 'obj.value'; - el.$.compose.expectedObjValue = 42; - el.$.forward.expectedObjSubpath = 'obj.value'; - el.$.forward.expectedObjValue = 42; - el.$.forward.$.compose.expectedObjSubpath = 'obj.value'; - el.$.forward.$.compose.expectedObjValue = 42; - el.clearObserverCounts(); + setupNested(); // Do the thing el.$.forward.set('obj.value', 42); // Verify - assert.equal(el.observerCounts.nestedSubpathChanged, 1); - assert.equal(el.observerCounts.nestedObjChanged, 0); - assert.equal(el.observerCounts.nestedObjSubpathChanged, 1); - assert.equal(el.observerCounts.nestedObjValueChanged, 1); - assert.equal(el.$.compose.observerCounts.objSubpathChanged, 1); - assert.equal(el.$.compose.observerCounts.objValueChanged, 1); - assert.equal(el.$.forward.observerCounts.objSubpathChanged, 1); - assert.equal(el.$.forward.observerCounts.objValueChanged, 1); - assert.equal(el.$.basic.notifyingValue, 42); - assert.equal(el.$.basic.notifyingValue, 42); - assert.equal(el.$.compose.$.basic1.notifyingValue, 42); - assert.equal(el.$.compose.$.basic2.notifyingValue, 42); - assert.equal(el.$.forward.$.compose.$.basic1.notifyingValue, 42); - assert.equal(el.$.forward.$.compose.$.basic2.notifyingValue, 42); - assert.equal(el.$.basic.getAttribute('attrvalue'), '42'); - assert.equal(el.$.compose.$.basic1.getAttribute('attrvalue'), '42'); - assert.equal(el.$.compose.$.basic2.getAttribute('attrvalue'), '42'); - assert.equal(el.$.forward.$.compose.$.basic1.getAttribute('attrvalue'), '42'); - assert.equal(el.$.forward.$.compose.$.basic2.getAttribute('attrvalue'), '42'); + verifyNestedObserversOutput(); }); test('notification from set in forward\'s composed element', function() { // Setup - var nested = { - obj: { - value: 41 - } - }; - el.nested = nested; - el.expectedNestedSubpath = 'nested.obj.value'; - el.expectedNestedValue = 42; - el.expectedNestedObjSubpath = 'nested.obj.value'; - el.expectedNestedObjValue = 42; - el.$.compose.expectedObjSubpath = 'obj.value'; - el.$.compose.expectedObjValue = 42; - el.$.forward.expectedObjSubpath = 'obj.value'; - el.$.forward.expectedObjValue = 42; - el.$.forward.$.compose.expectedObjSubpath = 'obj.value'; - el.$.forward.$.compose.expectedObjValue = 42; - el.clearObserverCounts(); + setupNested(); // Do the thing el.$.forward.$.compose.set('obj.value', 42); // Verify - assert.equal(el.observerCounts.nestedSubpathChanged, 1); - assert.equal(el.observerCounts.nestedObjChanged, 0); - assert.equal(el.observerCounts.nestedObjSubpathChanged, 1); - assert.equal(el.observerCounts.nestedObjValueChanged, 1); - assert.equal(el.$.compose.observerCounts.objSubpathChanged, 1); - assert.equal(el.$.compose.observerCounts.objValueChanged, 1); - assert.equal(el.$.forward.observerCounts.objSubpathChanged, 1); - assert.equal(el.$.forward.observerCounts.objValueChanged, 1); - assert.equal(el.$.basic.notifyingValue, 42); - assert.equal(el.$.basic.notifyingValue, 42); - assert.equal(el.$.compose.$.basic1.notifyingValue, 42); - assert.equal(el.$.compose.$.basic2.notifyingValue, 42); - assert.equal(el.$.forward.$.compose.$.basic1.notifyingValue, 42); - assert.equal(el.$.forward.$.compose.$.basic2.notifyingValue, 42); - assert.equal(el.$.basic.getAttribute('attrvalue'), '42'); - assert.equal(el.$.compose.$.basic1.getAttribute('attrvalue'), '42'); - assert.equal(el.$.compose.$.basic2.getAttribute('attrvalue'), '42'); - assert.equal(el.$.forward.$.compose.$.basic1.getAttribute('attrvalue'), '42'); - assert.equal(el.$.forward.$.compose.$.basic2.getAttribute('attrvalue'), '42'); + verifyNestedObserversOutput(); }); test('notification from object change in compose element', function() { // Setup - el.nested = { - obj: { - value: 41 - } - }; - var obj = { - value: 42 - }; - el.expectedNestedSubpath = 'nested.obj'; - el.expectedNestedValue = obj; - el.expectedNestedObjSubpath = 'nested.obj'; - el.expectedNestedObjValue = obj; - el.$.compose.expectedObjSubpath = 'obj'; - el.$.compose.expectedObjValue = obj; - el.$.forward.expectedObjSubpath = 'obj'; - el.$.forward.expectedObjValue = obj; - el.$.forward.$.compose.expectedObjSubpath = 'obj'; - el.$.forward.$.compose.expectedObjValue = obj; - el.clearObserverCounts(); + var obj = setupComposedAndGetObject(); // Do the thing el.$.compose.obj = obj; // Verify - assert.equal(el.observerCounts.nestedSubpathChanged, 1); - assert.equal(el.observerCounts.nestedObjChanged, 1); - assert.equal(el.observerCounts.nestedObjSubpathChanged, 1); - assert.equal(el.observerCounts.nestedObjValueChanged, 1); - assert.equal(el.$.compose.observerCounts.objSubpathChanged, 1); - assert.equal(el.$.compose.observerCounts.objValueChanged, 1); - assert.equal(el.$.forward.observerCounts.objSubpathChanged, 1); - assert.equal(el.$.forward.observerCounts.objValueChanged, 1); - assert.equal(el.$.basic.notifyingValue, 42); - assert.equal(el.$.basic.notifyingValue, 42); - assert.equal(el.$.compose.$.basic1.notifyingValue, 42); - assert.equal(el.$.compose.$.basic2.notifyingValue, 42); - assert.equal(el.$.forward.$.compose.$.basic1.notifyingValue, 42); - assert.equal(el.$.forward.$.compose.$.basic2.notifyingValue, 42); - assert.equal(el.$.basic.getAttribute('attrvalue'), '42'); - assert.equal(el.$.compose.$.basic1.getAttribute('attrvalue'), '42'); - assert.equal(el.$.compose.$.basic2.getAttribute('attrvalue'), '42'); - assert.equal(el.$.forward.$.compose.$.basic1.getAttribute('attrvalue'), '42'); - assert.equal(el.$.forward.$.compose.$.basic2.getAttribute('attrvalue'), '42'); + verifyNonNestedObserversOutput(); }); test('notification from object change in forward element', function() { // Setup - el.nested = { - obj: { - value: 41 - } - }; - var obj = { - value: 42 - }; - el.expectedNestedSubpath = 'nested.obj'; - el.expectedNestedValue = obj; - el.expectedNestedObjSubpath = 'nested.obj'; - el.expectedNestedObjValue = obj; - el.$.compose.expectedObjSubpath = 'obj'; - el.$.compose.expectedObjValue = obj; - el.$.forward.expectedObjSubpath = 'obj'; - el.$.forward.expectedObjValue = obj; - el.$.forward.$.compose.expectedObjSubpath = 'obj'; - el.$.forward.$.compose.expectedObjValue = obj; - el.clearObserverCounts(); + var obj = setupComposedAndGetObject(); // Do the thing el.$.forward.obj = obj; // Verify - assert.equal(el.observerCounts.nestedSubpathChanged, 1); - assert.equal(el.observerCounts.nestedObjChanged, 1); - assert.equal(el.observerCounts.nestedObjSubpathChanged, 1); - assert.equal(el.observerCounts.nestedObjValueChanged, 1); - assert.equal(el.$.compose.observerCounts.objSubpathChanged, 1); - assert.equal(el.$.compose.observerCounts.objValueChanged, 1); - assert.equal(el.$.forward.observerCounts.objSubpathChanged, 1); - assert.equal(el.$.forward.observerCounts.objValueChanged, 1); - assert.equal(el.$.basic.notifyingValue, 42); - assert.equal(el.$.basic.notifyingValue, 42); - assert.equal(el.$.compose.$.basic1.notifyingValue, 42); - assert.equal(el.$.compose.$.basic2.notifyingValue, 42); - assert.equal(el.$.forward.$.compose.$.basic1.notifyingValue, 42); - assert.equal(el.$.forward.$.compose.$.basic2.notifyingValue, 42); - assert.equal(el.$.basic.getAttribute('attrvalue'), '42'); - assert.equal(el.$.compose.$.basic1.getAttribute('attrvalue'), '42'); - assert.equal(el.$.compose.$.basic2.getAttribute('attrvalue'), '42'); - assert.equal(el.$.forward.$.compose.$.basic1.getAttribute('attrvalue'), '42'); - assert.equal(el.$.forward.$.compose.$.basic2.getAttribute('attrvalue'), '42'); + verifyNonNestedObserversOutput(); }); test('notification from object change in forward\'s compose element', function() { // Setup - el.nested = { - obj: { - value: 41 - } - }; - var obj = { - value: 42 - }; - el.expectedNestedSubpath = 'nested.obj'; - el.expectedNestedValue = obj; - el.expectedNestedObjSubpath = 'nested.obj'; - el.expectedNestedObjValue = obj; - el.$.compose.expectedObjSubpath = 'obj'; - el.$.compose.expectedObjValue = obj; - el.$.forward.expectedObjSubpath = 'obj'; - el.$.forward.expectedObjValue = obj; - el.$.forward.$.compose.expectedObjSubpath = 'obj'; - el.$.forward.$.compose.expectedObjValue = obj; - el.clearObserverCounts(); + var obj = setupComposedAndGetObject(); // Do the thing el.$.forward.$.compose.obj = obj; // Verify - assert.equal(el.observerCounts.nestedSubpathChanged, 1); - assert.equal(el.observerCounts.nestedObjChanged, 1); - assert.equal(el.observerCounts.nestedObjSubpathChanged, 1); - assert.equal(el.observerCounts.nestedObjValueChanged, 1); - assert.equal(el.$.compose.observerCounts.objSubpathChanged, 1); - assert.equal(el.$.compose.observerCounts.objValueChanged, 1); - assert.equal(el.$.forward.observerCounts.objSubpathChanged, 1); - assert.equal(el.$.forward.observerCounts.objValueChanged, 1); - assert.equal(el.$.basic.notifyingValue, 42); - assert.equal(el.$.basic.notifyingValue, 42); - assert.equal(el.$.compose.$.basic1.notifyingValue, 42); - assert.equal(el.$.compose.$.basic2.notifyingValue, 42); - assert.equal(el.$.forward.$.compose.$.basic1.notifyingValue, 42); - assert.equal(el.$.forward.$.compose.$.basic2.notifyingValue, 42); - assert.equal(el.$.basic.getAttribute('attrvalue'), '42'); - assert.equal(el.$.compose.$.basic1.getAttribute('attrvalue'), '42'); - assert.equal(el.$.compose.$.basic2.getAttribute('attrvalue'), '42'); - assert.equal(el.$.forward.$.compose.$.basic1.getAttribute('attrvalue'), '42'); - assert.equal(el.$.forward.$.compose.$.basic2.getAttribute('attrvalue'), '42'); + verifyNonNestedObserversOutput(); }); test('negation', function() {