Deduplicate setup and verifying in notify-path test suite

This commit is contained in:
Tim van der Lippe 2015-10-30 22:53:02 +01:00
parent 8ef7bac6dc
commit 68707ad760
2 changed files with 96 additions and 387 deletions

View File

@ -230,4 +230,4 @@
cChanged: function() {}
});
</script>
</dom-module>
</dom-module>

View File

@ -47,6 +47,80 @@ suite('basic path bindings', function() {
document.body.removeChild(el);
});
function setupNested() {
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();
}
function setupComposedAndGetObject() {
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();
return obj;
}
function verifyObserverOutput(expectedNestedObjChanged) {
assert.equal(el.observerCounts.nestedSubpathChanged, 1);
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);
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');
}
function verifyNestedObserversOutput() {
verifyObserverOutput(0);
}
function verifyNonNestedObserversOutput() {
verifyObserverOutput(1);
}
test('downward data flow', function() {
// Setup
var nested = {
@ -67,462 +141,97 @@ suite('basic path bindings', function() {
// 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');
verifyNonNestedObserversOutput();
});
test('notification from basic element property change', 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.$.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');
verifyNestedObserversOutput();
});
test('notification from composed element property change', 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.$.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 forward\'s composed element property change', 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.$.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() {