var assert = jsio.__env.require('assert')

jsio('import browser.templateFactory as templateFactory');

exports.testValueReplacement = function() {
	var template = '<div>{{ name }}</div><div>{{ email }}</div>';
	var replaced = templateFactory._replaceValuesWithViews(template);
	var shouldBe = '<div>(( _itemValueView name ))</div><div>(( _itemValueView email ))</div>';
	assert.equal(replaced, shouldBe, replaced + '\n!=\n' + shouldBe);
}

exports.testReferenceReplacement = function() {
	var template = '<div>{{ owner : user }}</div><div>{{milestone:milestone}}</div>';
	var replaced = templateFactory._replaceReferencesWithViews(template);
	var shouldBe = '<div>(( _itemReferenceView \'user\' owner ))</div>' +
		'<div>(( _itemReferenceView \'milestone\' milestone ))</div>';
	assert.equal(replaced, shouldBe, '\n' + replaced + '\n!=\n' + shouldBe);
}

exports.testListReplacement = function() {
	var template = '<div>[[ users ]]</div><div>[[buttons]]</div>';
	var replaced = templateFactory._replaceListsWithViews(template);
	var shouldBe = '<div>(( _itemListView users ))</div>' +
		'<div>(( _itemListView buttons ))</div>';
	assert.equal(replaced, shouldBe, '\n' + replaced + '\n!=\n' + shouldBe);
}
@@ -34,16 +34,52 @@
 assert')
+%0Avar sys = jsio.__env.require('sys')
 %0A%0Ajsio('
@@ -719,16 +719,12 @@
 iew 
-%5C'
 user
-%5C'
  own
@@ -768,18 +768,16 @@
 nceView 
-%5C'
 mileston
@@ -781,10 +781,8 @@
 tone
-%5C'
  mil

Update test case