mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Fix a test of UI._templateInstance()
This actually morphs the test into a different test. The old test wasn’t really valid; it checked that you could reach the rendered DOM of a helper from the templateInstance retrieved from the helper. It only worked before because templateInstance.firstNode was an empty text node marker, so when the helper returned “first”, it would in effect save a pointer to the empty text node before the position where “first” would appear.
This commit is contained in:
@@ -2078,19 +2078,16 @@ Tinytest.add(
|
||||
var instanceFromHelper;
|
||||
|
||||
tmpl.foo = function () {
|
||||
instanceFromHelper = UI._templateInstance();
|
||||
return rv.get();
|
||||
return UI._templateInstance().data;
|
||||
};
|
||||
|
||||
var div = renderToDiv(tmpl);
|
||||
var div = renderToDiv(tmpl, function () { return rv.get(); });
|
||||
rv.set("first");
|
||||
Deps.flush();
|
||||
// `nextSibling` because the first node is an empty text node.
|
||||
test.equal($(instanceFromHelper.firstNode.nextSibling).text(), "first");
|
||||
divRendersTo(test, div, "first");
|
||||
|
||||
rv.set("second");
|
||||
Deps.flush();
|
||||
test.equal($(instanceFromHelper.firstNode.nextSibling).text(), "second");
|
||||
divRendersTo(test, div, "second");
|
||||
|
||||
// UI._templateInstance() should throw when called from not within a
|
||||
// helper.
|
||||
|
||||
Reference in New Issue
Block a user