diff --git a/packages/spark/spark_tests.js b/packages/spark/spark_tests.js index 67da717ff9..16ddddbd29 100644 --- a/packages/spark/spark_tests.js +++ b/packages/spark/spark_tests.js @@ -14,7 +14,7 @@ var legacyLabels = { if (n.nodeType === 1) { if (n.id) { - label = '#'+n.id; + label = '#' + n.id; } else if (n.getAttribute("name")) { label = n.getAttribute("name"); // Radio button special case: radio buttons @@ -27,6 +27,19 @@ var legacyLabels = { (n.type === 'radio' || n.type === 'checkbox') && n.value) label = label + ':' + n.value; + + // include parent names and IDs up to enclosing ID + // in the label + while (n.parentNode && + n.parentNode.nodeType === 1) { // ELEMENT + n = n.parentNode; + if (n.id) { + label = '#' + n.id + "/" + label; + break; + } else if (n.getAttribute('name')) { + label = n.getAttribute('name') + "/" + label; + } + } } } @@ -3437,8 +3450,6 @@ Tinytest.add("spark - bubbling render", function (test) { Meteor.flush(); }); -})(); - Tinytest.add("spark - landmark arg", function (test) { var div = OnscreenDiv(Spark.render(function () { return Spark.createLandmark({ @@ -3674,4 +3685,39 @@ Tinytest.add("spark - callback context", function (test) { test.isFalse(cxs[4]); test.isFalse(cxs[5]); -}); \ No newline at end of file +}); + +Tinytest.add("spark - legacy preserve names", function (test) { + var R = ReactiveVar("foo"); + var R2 = ReactiveVar("apple"); + + var div = OnscreenDiv(renderWithLegacyLabels(function () { + R.get(); // create dependency + return ('