finish moving liveui tests to spark

This commit is contained in:
Geoff Schmidt
2012-08-03 12:28:59 -07:00
parent 2dcbe587c5
commit fb7410c8ec
6 changed files with 5 additions and 105 deletions

View File

@@ -1,78 +0,0 @@
Tinytest.add("livedocument - assembly", function(test) {
var doTest = function(calc) {
var onlives = [];
var ondeads = [];
var frag = Meteor.ui._doc.materialize(
calc(function(str, expected) {
return Meteor.ui._doc.annotate(str, {onlive: function() {
onlives.push(this.id);
}, ondead: function() {
ondeads.push(this.id);
}});
}));
var groups = [];
var html = calc(function(str, expected, noRange) {
if (arguments.length > 1)
str = expected;
if (! noRange)
groups.push(str);
return str;
});
var f = WrappedFrag(frag);
test.equal(f.html(), html);
var actualGroups = [];
var tempRange = new LiveRange(Meteor.ui._TAG, frag);
tempRange.visit(function(isStart, rng) {
if (! isStart)
actualGroups.push(rangeToHtml(rng));
});
test.equal(actualGroups.join(','), groups.join(','));
f.hold();
Meteor.flush();
test.equal(onlives.length, groups.length);
var uniqueOnlives = _.uniq(onlives);
test.equal(uniqueOnlives.length, onlives.length);
test.equal(ondeads.length, 0);
//f.release(); XXXX
Meteor.ui._doc.cleanNodes(f.node());
var numRanges = onlives.length;
onlives.length = 0;
Meteor.flush();
test.equal(onlives.length, 0);
test.equal(ondeads.length, numRanges);
};
doTest(function(A) { return "<p>Hello</p>"; });
doTest(function(A) { return "<td>Hello</td><td>World</td>"; });
doTest(function(A) { return "<td>"+A("Hello")+"</td>"; });
doTest(function(A) { return A("<td>"+A("Hello")+"</td>"); });
doTest(function(A) { return A(A(A(A(A(A("foo")))))); });
doTest(
function(A) { return "<div>Yo"+A("<p>Hello "+A(A("World")),"<p>Hello World</p>")+
"</div>"; });
doTest(function(A) {
return A("<ul>"+A("<li>one","<li>one</li>")+
A("<li>two","<li>two</li>")+
A("<li>three","<li>three</li>"),
"<ul><li>one</li><li>two</li><li>three</li></ul>"); });
doTest(function(A) {
return A("<table>"+A("<tr>"+A("<td>"+A("Hi")+"</td>")+"</tr>")+"</table>",
"<table><tbody><tr><td>Hi</td></tr></tbody></table>");
});
test.throws(function() {
doTest(function(A) {
var z = A("Hello");
return z+z;
});
});
doTest(function(A) {
return '<div foo="'+A('bar', 'bar', true)+'">Hello</div>';
});
});

View File

@@ -1,13 +0,0 @@
<template name="test_renderList_each">
Before{{render_count}}
{{#each data}}
{{name}}{{weather "here"}}
{{/each}}
Middle
{{#each data2}}
{{name}}
{{else}}
Else
{{/each}}
After
</template>

View File

@@ -18,15 +18,3 @@ Package.on_use(function (api) {
api.add_files(['liveui.js', 'patcher.js'],
'client');
});
Package.on_test(function (api) {
api.use(['tinytest', 'templating', 'htmljs']);
api.use(['liveui', 'test-helpers'], 'client');
api.add_files('form_responder.js', 'server');
api.add_files([
'livedocument_tests.js',
'liveui_tests.html'
], 'client');
});

View File

@@ -27,6 +27,8 @@ Package.on_test(function (api) {
api.use('tinytest');
api.use(['spark', 'test-helpers'], 'client');
api.add_files('test_form_responder.js', 'server');
api.add_files([
'spark_tests.js',
'patcher_tests.js'

View File

@@ -2358,7 +2358,7 @@ testAsyncMulti(
hitlist.push(thing);
};
var LIVEUI_TEST_RESPONDER = "/liveui_test_responder";
var LIVEUI_TEST_RESPONDER = "/spark_test_responder";
var IFRAME_URL_1 = LIVEUI_TEST_RESPONDER + "/";
var IFRAME_URL_2 = "about:blank"; // most cross-browser-compatible
if (window.opera) // opera doesn't like 'about:blank' form target
@@ -2820,6 +2820,7 @@ Tinytest.add("spark - oldschool branch keys", function(test) {
// duplicate branch keys; different order
});
// XXX these are old notes copied from liveui_tests.js:
// TO TEST:
// - chunk matching

View File

@@ -1,6 +1,6 @@
(function () {
var TEST_RESPONDER_ROUTE = "/liveui_test_responder";
var TEST_RESPONDER_ROUTE = "/spark_test_responder";
var respond = function(req, res) {