mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Rename _FooTest symbols to FooTest. They are already test-only.
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
//
|
||||
var interceptedEmails = {}; // (email address) -> (array of contents)
|
||||
|
||||
_EmailTest.hookSend(function (options) {
|
||||
EmailTest.hookSend(function (options) {
|
||||
var to = options.to;
|
||||
if (to.indexOf('intercept') === -1) {
|
||||
return true; // go ahead and send
|
||||
|
||||
@@ -122,6 +122,6 @@ base64Decode = function (str) {
|
||||
return arr;
|
||||
};
|
||||
|
||||
_EJSONTest.base64Encode = base64Encode;
|
||||
EJSONTest.base64Encode = base64Encode;
|
||||
|
||||
_EJSONTest.base64Decode = base64Decode;
|
||||
EJSONTest.base64Decode = base64Decode;
|
||||
|
||||
@@ -24,8 +24,8 @@ Tinytest.add("base64 - testing the test", function (test) {
|
||||
});
|
||||
|
||||
Tinytest.add("base64 - empty", function (test) {
|
||||
test.equal(_EJSONTest.base64Encode(EJSON.newBinary(0)), "");
|
||||
test.equal(_EJSONTest.base64Decode(""), EJSON.newBinary(0));
|
||||
test.equal(EJSONTest.base64Encode(EJSON.newBinary(0)), "");
|
||||
test.equal(EJSONTest.base64Decode(""), EJSON.newBinary(0));
|
||||
});
|
||||
|
||||
|
||||
@@ -38,8 +38,8 @@ Tinytest.add("base64 - wikipedia examples", function (test) {
|
||||
{txt: "sure.", res: "c3VyZS4="}
|
||||
];
|
||||
_.each(tests, function(t) {
|
||||
test.equal(_EJSONTest.base64Encode(asciiToArray(t.txt)), t.res);
|
||||
test.equal(arrayToAscii(_EJSONTest.base64Decode(t.res)), t.txt);
|
||||
test.equal(EJSONTest.base64Encode(asciiToArray(t.txt)), t.res);
|
||||
test.equal(arrayToAscii(EJSONTest.base64Decode(t.res)), t.txt);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -49,11 +49,11 @@ Tinytest.add("base64 - non-text examples", function (test) {
|
||||
{array: [0, 0, 1], b64: "AAAB"}
|
||||
];
|
||||
_.each(tests, function(t) {
|
||||
test.equal(_EJSONTest.base64Encode(t.array), t.b64);
|
||||
test.equal(EJSONTest.base64Encode(t.array), t.b64);
|
||||
var expectedAsBinary = EJSON.newBinary(t.array.length);
|
||||
_.each(t.array, function (val, i) {
|
||||
expectedAsBinary[i] = val;
|
||||
});
|
||||
test.equal(_EJSONTest.base64Decode(t.b64), expectedAsBinary);
|
||||
test.equal(EJSONTest.base64Decode(t.b64), expectedAsBinary);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
EJSON = {};
|
||||
_EJSONTest = {};
|
||||
EJSONTest = {};
|
||||
|
||||
var customTypes = {};
|
||||
// Add a custom type, using a method of your choice to get to and
|
||||
|
||||
@@ -6,7 +6,7 @@ Package.describe({
|
||||
Package.on_use(function (api) {
|
||||
api.use(['json', 'underscore']);
|
||||
api.exportSymbol('EJSON');
|
||||
api.exportSymbol('_EJSONTest', {testOnly: true});
|
||||
api.exportSymbol('EJSONTest', {testOnly: true});
|
||||
api.add_files('ejson.js', ['client', 'server']);
|
||||
api.add_files('base64.js', ['client', 'server']);
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@ var urlModule = Npm.require('url');
|
||||
var MailComposer = Npm.require('mailcomposer').MailComposer;
|
||||
|
||||
Email = {};
|
||||
_EmailTest = {};
|
||||
EmailTest = {};
|
||||
|
||||
var makePool = function (mailUrlString) {
|
||||
var mailUrl = urlModule.parse(mailUrlString);
|
||||
@@ -49,12 +49,12 @@ var next_devmode_mail_id = 0;
|
||||
var output_stream = process.stdout;
|
||||
|
||||
// Testing hooks
|
||||
_EmailTest.overrideOutputStream = function (stream) {
|
||||
EmailTest.overrideOutputStream = function (stream) {
|
||||
next_devmode_mail_id = 0;
|
||||
output_stream = stream;
|
||||
};
|
||||
|
||||
_EmailTest.restoreOutputStream = function () {
|
||||
EmailTest.restoreOutputStream = function () {
|
||||
output_stream = process.stdout;
|
||||
};
|
||||
|
||||
@@ -90,7 +90,7 @@ var smtpSend = function (mc) {
|
||||
* false to skip sending.
|
||||
*/
|
||||
var sendHooks = [];
|
||||
_EmailTest.hookSend = function (f) {
|
||||
EmailTest.hookSend = function (f) {
|
||||
sendHooks.push(f);
|
||||
};
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ Tinytest.add("email - dev mode smoke test", function (test) {
|
||||
|
||||
try {
|
||||
var stream = new streamBuffers.WritableStreamBuffer;
|
||||
_EmailTest.overrideOutputStream(stream);
|
||||
EmailTest.overrideOutputStream(stream);
|
||||
Email.send({
|
||||
from: "foo@example.com",
|
||||
to: "bar@example.com",
|
||||
@@ -34,6 +34,6 @@ Tinytest.add("email - dev mode smoke test", function (test) {
|
||||
"From us.\r\n" +
|
||||
"====== END MAIL #0 ======\n");
|
||||
} finally {
|
||||
_EmailTest.restoreOutputStream();
|
||||
EmailTest.restoreOutputStream();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -9,7 +9,7 @@ Npm.depends({mailcomposer: "0.1.15", simplesmtp: "0.1.25", "stream-buffers": "0.
|
||||
Package.on_use(function (api) {
|
||||
api.use('underscore', 'server');
|
||||
api.exportSymbol('Email', 'server');
|
||||
api.exportSymbol('_EmailTest', 'server', {testOnly: true});
|
||||
api.exportSymbol('EmailTest', 'server', {testOnly: true});
|
||||
api.add_files('email.js', 'server');
|
||||
});
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ DDP = {};
|
||||
|
||||
SUPPORTED_DDP_VERSIONS = [ 'pre1' ];
|
||||
|
||||
_LivedataTest.SUPPORTED_DDP_VERSIONS = SUPPORTED_DDP_VERSIONS;
|
||||
LivedataTest.SUPPORTED_DDP_VERSIONS = SUPPORTED_DDP_VERSIONS;
|
||||
|
||||
MethodInvocation = function (options) {
|
||||
var self = this;
|
||||
|
||||
@@ -1383,7 +1383,7 @@ _.extend(Connection.prototype, {
|
||||
}
|
||||
});
|
||||
|
||||
_LivedataTest.Connection = Connection;
|
||||
LivedataTest.Connection = Connection;
|
||||
|
||||
// @param url {String} URL to Meteor app,
|
||||
// e.g.:
|
||||
|
||||
@@ -2,14 +2,14 @@ var newConnection = function (stream) {
|
||||
// Some of these tests leave outstanding methods with no result yet
|
||||
// returned. This should not block us from re-running tests when sources
|
||||
// change.
|
||||
return new _LivedataTest.Connection(stream, {reloadWithOutstanding: true});
|
||||
return new LivedataTest.Connection(stream, {reloadWithOutstanding: true});
|
||||
};
|
||||
|
||||
var makeConnectMessage = function (session) {
|
||||
var msg = {
|
||||
msg: 'connect',
|
||||
version: _LivedataTest.SUPPORTED_DDP_VERSIONS[0],
|
||||
support: _LivedataTest.SUPPORTED_DDP_VERSIONS
|
||||
version: LivedataTest.SUPPORTED_DDP_VERSIONS[0],
|
||||
support: LivedataTest.SUPPORTED_DDP_VERSIONS
|
||||
};
|
||||
|
||||
if (session)
|
||||
@@ -1345,12 +1345,12 @@ testAsyncMulti("livedata connection - reconnect to a different server", [
|
||||
|
||||
Tinytest.addAsync("livedata connection - version negotiation requires renegotiating",
|
||||
function (test, onComplete) {
|
||||
var connection = new _LivedataTest.Connection(getSelfConnectionUrl(), {
|
||||
var connection = new LivedataTest.Connection(getSelfConnectionUrl(), {
|
||||
reloadWithOutstanding: true,
|
||||
supportedDDPVersions: ["garbled", _LivedataTest.SUPPORTED_DDP_VERSIONS[0]],
|
||||
supportedDDPVersions: ["garbled", LivedataTest.SUPPORTED_DDP_VERSIONS[0]],
|
||||
onConnectionFailure: function () { test.fail(); onComplete(); },
|
||||
onConnected: function () {
|
||||
test.equal(connection._version, _LivedataTest.SUPPORTED_DDP_VERSIONS[0]);
|
||||
test.equal(connection._version, LivedataTest.SUPPORTED_DDP_VERSIONS[0]);
|
||||
connection._stream.disconnect({_permanent: true});
|
||||
onComplete();
|
||||
}
|
||||
@@ -1359,7 +1359,7 @@ Tinytest.addAsync("livedata connection - version negotiation requires renegotiat
|
||||
|
||||
Tinytest.addAsync("livedata connection - version negotiation error",
|
||||
function (test, onComplete) {
|
||||
var connection = new _LivedataTest.Connection(getSelfConnectionUrl(), {
|
||||
var connection = new LivedataTest.Connection(getSelfConnectionUrl(), {
|
||||
reloadWithOutstanding: true,
|
||||
supportedDDPVersions: ["garbled", "more garbled"],
|
||||
onConnectionFailure: function () {
|
||||
|
||||
@@ -104,7 +104,7 @@ var SessionCollectionView = function (collectionName, sessionCallbacks) {
|
||||
self.callbacks = sessionCallbacks;
|
||||
};
|
||||
|
||||
_LivedataTest.SessionCollectionView = SessionCollectionView;
|
||||
LivedataTest.SessionCollectionView = SessionCollectionView;
|
||||
|
||||
|
||||
_.extend(SessionCollectionView.prototype, {
|
||||
@@ -1318,7 +1318,7 @@ var calculateVersion = function (clientSupportedVersions,
|
||||
return correctVersion;
|
||||
};
|
||||
|
||||
_LivedataTest.calculateVersion = calculateVersion;
|
||||
LivedataTest.calculateVersion = calculateVersion;
|
||||
|
||||
|
||||
// "blind" exceptions other than those that were deliberately thrown to signal
|
||||
|
||||
@@ -32,7 +32,7 @@ if (Meteor.isServer) {
|
||||
Tinytest.add("livedata - version negotiation", function (test) {
|
||||
var versionCheck = function (clientVersions, serverVersions, expected) {
|
||||
test.equal(
|
||||
_LivedataTest.calculateVersion(clientVersions, serverVersions),
|
||||
LivedataTest.calculateVersion(clientVersions, serverVersions),
|
||||
expected);
|
||||
};
|
||||
|
||||
@@ -504,7 +504,7 @@ if (Meteor.isClient) {
|
||||
testAsyncMulti("livedata - publisher errors", (function () {
|
||||
// Use a separate connection so that we can safely check to see if
|
||||
// conn._subscriptions is empty.
|
||||
var conn = new _LivedataTest.Connection('/',
|
||||
var conn = new LivedataTest.Connection('/',
|
||||
{reloadWithOutstanding: true});
|
||||
var collName = Random.id();
|
||||
var coll = new Meteor.Collection(collName, {connection: conn});
|
||||
|
||||
@@ -26,7 +26,7 @@ Package.on_use(function (api) {
|
||||
api.exportSymbol('DDP');
|
||||
api.exportSymbol('DDPServer', 'server');
|
||||
|
||||
api.exportSymbol('_LivedataTest', {testOnly: true});
|
||||
api.exportSymbol('LivedataTest', {testOnly: true});
|
||||
|
||||
// Transport
|
||||
api.use('reload', 'client');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
var newView = function(test) {
|
||||
var results = [];
|
||||
var view = new _LivedataTest.SessionCollectionView('test', {
|
||||
var view = new LivedataTest.SessionCollectionView('test', {
|
||||
added: function (collection, id, fields) {
|
||||
results.push({fun: 'added', id: id, fields: fields});
|
||||
},
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
_LivedataTest = {};
|
||||
LivedataTest = {};
|
||||
|
||||
// XXX from Underscore.String (http://epeli.github.com/underscore.string/)
|
||||
var startsWith = function(str, starts) {
|
||||
@@ -70,7 +70,7 @@ toWebsocketUrl = function (url) {
|
||||
return ret;
|
||||
};
|
||||
|
||||
_LivedataTest.toSockjsUrl = toSockjsUrl;
|
||||
LivedataTest.toSockjsUrl = toSockjsUrl;
|
||||
|
||||
|
||||
_.extend(ClientStream.prototype, {
|
||||
|
||||
@@ -89,7 +89,7 @@ testAsyncMulti("stream - disconnect remains offline", [
|
||||
|
||||
Tinytest.add("stream - sockjs urls are computed correctly", function(test) {
|
||||
var testHasSockjsUrl = function(raw, expectedSockjsUrl) {
|
||||
var actual = _LivedataTest.toSockjsUrl(raw);
|
||||
var actual = LivedataTest.toSockjsUrl(raw);
|
||||
if (expectedSockjsUrl instanceof RegExp)
|
||||
test.isTrue(actual.match(expectedSockjsUrl), actual);
|
||||
else
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* these outside of a fiber they will explode!
|
||||
*/
|
||||
|
||||
_MongoLivedataTest = {};
|
||||
MongoLivedataTest = {};
|
||||
|
||||
var path = Npm.require('path');
|
||||
var MongoDB = Npm.require('mongodb');
|
||||
@@ -993,7 +993,7 @@ _.extend(LiveResultsSet.prototype, {
|
||||
// - If you disconnect and reconnect from Mongo, it will essentially restart
|
||||
// the query, which will lead to duplicate results. This is pretty bad,
|
||||
// but if you include a field called 'ts' which is inserted as
|
||||
// new _MongoLivedataTest.MongoTimestamp(0, 0) (which is initialized to the
|
||||
// new MongoLivedataTest.MongoTimestamp(0, 0) (which is initialized to the
|
||||
// current Mongo-style timestamp), we'll be able to find the place to
|
||||
// restart properly. (This field is specifically understood by Mongo with an
|
||||
// optimization which allows it to find the right place to start without
|
||||
@@ -1083,4 +1083,4 @@ MongoConnection.prototype._observeChangesTailable = function (
|
||||
// XXX We probably need to find a better way to expose this. Right now
|
||||
// it's only used by tests, but in fact you need it in normal
|
||||
// operation to interact with capped collections.
|
||||
_MongoLivedataTest.MongoTimestamp = MongoDB.Timestamp;
|
||||
MongoLivedataTest.MongoTimestamp = MongoDB.Timestamp;
|
||||
|
||||
@@ -745,7 +745,7 @@ testAsyncMulti('mongo-livedata - document goes through a transform, ' + idGenera
|
||||
testAsyncMulti('mongo-livedata - document with binary data, ' + idGeneration, [
|
||||
function (test, expect) {
|
||||
// XXX probably shouldn't use EJSON's private test symbols
|
||||
var bin = _EJSONTest.base64Decode(
|
||||
var bin = EJSONTest.base64Decode(
|
||||
"TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyBy" +
|
||||
"ZWFzb24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJv" +
|
||||
"bSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhl" +
|
||||
|
||||
@@ -206,7 +206,7 @@ if (Meteor.isServer) {
|
||||
self.xs = [];
|
||||
self.expects = [];
|
||||
self.insert = function (fields) {
|
||||
coll.insert(_.extend({ts: new _MongoLivedataTest.MongoTimestamp(0, 0)},
|
||||
coll.insert(_.extend({ts: new MongoLivedataTest.MongoTimestamp(0, 0)},
|
||||
fields));
|
||||
};
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ Package.on_use(function (api) {
|
||||
// Allow us to detect 'autopublish', and publish collections if it's loaded.
|
||||
api.use('autopublish', 'server', {weak: true});
|
||||
|
||||
api.exportSymbol('_MongoLivedataTest', 'server', {testOnly: true});
|
||||
api.exportSymbol('MongoLivedataTest', 'server', {testOnly: true});
|
||||
|
||||
api.add_files('mongo_driver.js', 'server');
|
||||
api.add_files('local_collection_driver.js', ['client', 'server']);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
var Fiber = Npm.require('fibers');
|
||||
|
||||
Oauth = {};
|
||||
_OauthTest = {};
|
||||
OauthTest = {};
|
||||
|
||||
RoutePolicy.declare('/_oauth/', 'network');
|
||||
|
||||
@@ -43,7 +43,7 @@ Oauth.registerService = function (name, version, urls, handleOauthRequest) {
|
||||
};
|
||||
|
||||
// For test cleanup.
|
||||
_OauthTest.unregisterService = function (name) {
|
||||
OauthTest.unregisterService = function (name) {
|
||||
delete registeredServices[name];
|
||||
};
|
||||
|
||||
@@ -129,7 +129,7 @@ middleware = function (req, res, next) {
|
||||
}
|
||||
};
|
||||
|
||||
_OauthTest.middleware = middleware;
|
||||
OauthTest.middleware = middleware;
|
||||
|
||||
// Handle /_oauth/* paths and extract the service name
|
||||
//
|
||||
|
||||
@@ -9,7 +9,7 @@ Package.on_use(function (api) {
|
||||
api.use(['underscore', 'service-configuration'], 'server');
|
||||
|
||||
api.exportSymbol('Oauth');
|
||||
api.exportSymbol('_OauthTest', 'server', {testOnly: true});
|
||||
api.exportSymbol('OauthTest', 'server', {testOnly: true});
|
||||
|
||||
api.add_files('oauth_client.js', 'client');
|
||||
api.add_files('oauth_server.js', 'server');
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// A place to store request tokens pending verification
|
||||
var requestTokens = {};
|
||||
|
||||
_OAuth1Test = {requestTokens: requestTokens};
|
||||
OAuth1Test = {requestTokens: requestTokens};
|
||||
|
||||
// connect middleware
|
||||
Oauth._requestHandlers['1'] = function (service, query, res) {
|
||||
|
||||
@@ -40,7 +40,7 @@ Tinytest.add("oauth1 - loginResultForCredentialToken is stored", function (test)
|
||||
});
|
||||
|
||||
// simulate logging in using twitterfoo
|
||||
_OAuth1Test.requestTokens[credentialToken] = twitterfooAccessToken;
|
||||
OAuth1Test.requestTokens[credentialToken] = twitterfooAccessToken;
|
||||
|
||||
var req = {
|
||||
method: "POST",
|
||||
@@ -50,7 +50,7 @@ Tinytest.add("oauth1 - loginResultForCredentialToken is stored", function (test)
|
||||
oauth_token: twitterfooAccessToken
|
||||
}
|
||||
};
|
||||
_OauthTest.middleware(req, new http.ServerResponse(req));
|
||||
OauthTest.middleware(req, new http.ServerResponse(req));
|
||||
|
||||
// Test that right data is placed on the loginResult map
|
||||
test.equal(
|
||||
@@ -67,7 +67,7 @@ Tinytest.add("oauth1 - loginResultForCredentialToken is stored", function (test)
|
||||
Oauth._loginResultForCredentialToken[credentialToken].options.option1, twitterOption1);
|
||||
|
||||
} finally {
|
||||
_OauthTest.unregisterService(serviceName);
|
||||
OauthTest.unregisterService(serviceName);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ Package.on_use(function (api) {
|
||||
api.use('http', 'server');
|
||||
|
||||
api.exportSymbol('OAuth1Binding', 'server');
|
||||
api.exportSymbol('_OAuth1Test', 'server', {testOnly: true});
|
||||
api.exportSymbol('OAuth1Test', 'server', {testOnly: true});
|
||||
|
||||
api.add_files('oauth1_binding.js', 'server');
|
||||
api.add_files('oauth1_server.js', 'server');
|
||||
|
||||
@@ -20,7 +20,7 @@ Tinytest.add("oauth2 - loginResultForCredentialToken is stored", function (test)
|
||||
var req = {method: "POST",
|
||||
url: "/_oauth/" + serviceName + "?close",
|
||||
query: {state: credentialToken}};
|
||||
_OauthTest.middleware(req, new http.ServerResponse(req));
|
||||
OauthTest.middleware(req, new http.ServerResponse(req));
|
||||
|
||||
// Test that the login result for that user is prepared
|
||||
test.equal(
|
||||
@@ -31,6 +31,6 @@ Tinytest.add("oauth2 - loginResultForCredentialToken is stored", function (test)
|
||||
Oauth._loginResultForCredentialToken[credentialToken].options.option1, foobookOption1);
|
||||
|
||||
} finally {
|
||||
_OauthTest.unregisterService(serviceName);
|
||||
OauthTest.unregisterService(serviceName);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -9,7 +9,7 @@ Package.on_use(function (api) {
|
||||
// Package.webapp and only after initial load.
|
||||
api.use('webapp', 'server', {unordered: true});
|
||||
api.exportSymbol('RoutePolicy', 'server');
|
||||
api.exportSymbol('_RoutePolicyTest', 'server', {testOnly: true});
|
||||
api.exportSymbol('RoutePolicyTest', 'server', {testOnly: true});
|
||||
api.add_files('routepolicy.js', 'server');
|
||||
});
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
// routes would break tinytest... so allow policy instances to be
|
||||
// constructed for testing.
|
||||
|
||||
_RoutePolicyTest = {};
|
||||
RoutePolicyTest = {};
|
||||
|
||||
var RoutePolicyConstructor = _RoutePolicyTest.Constructor = function () {
|
||||
var RoutePolicyConstructor = RoutePolicyTest.Constructor = function () {
|
||||
var self = this;
|
||||
self.urlPrefixTypes = {};
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Tinytest.add("routepolicy - declare", function (test) {
|
||||
var policy = new _RoutePolicyTest.Constructor();
|
||||
var policy = new RoutePolicyTest.Constructor();
|
||||
|
||||
policy.declare('/sockjs/', 'network');
|
||||
policy.declare('/bigphoto.jpg', 'static-online');
|
||||
@@ -37,7 +37,7 @@ Tinytest.add("routepolicy - static conflicts", function (test) {
|
||||
"url": "/bigphoto.jpg"
|
||||
}
|
||||
];
|
||||
var policy = new _RoutePolicyTest.Constructor();
|
||||
var policy = new RoutePolicyTest.Constructor();
|
||||
|
||||
test.equal(
|
||||
policy.checkForConflictWithStatic('/sockjs/', 'network', manifest),
|
||||
@@ -51,7 +51,7 @@ Tinytest.add("routepolicy - static conflicts", function (test) {
|
||||
});
|
||||
|
||||
Tinytest.add("routepolicy - checkUrlPrefix", function (test) {
|
||||
var policy = new _RoutePolicyTest.Constructor();
|
||||
var policy = new RoutePolicyTest.Constructor();
|
||||
policy.declare('/sockjs/', 'network');
|
||||
|
||||
test.equal(
|
||||
|
||||
@@ -9,7 +9,7 @@ Package.on_use(function (api) {
|
||||
'client');
|
||||
|
||||
api.exportSymbol('Spark', 'client');
|
||||
api.exportSymbol('_SparkTest', 'client', {testOnly: true});
|
||||
api.exportSymbol('SparkTest', 'client', {testOnly: true});
|
||||
|
||||
api.add_files(['spark.js', 'patch.js', 'convenience.js',
|
||||
'utils.js'], 'client');
|
||||
|
||||
@@ -571,4 +571,4 @@ Patcher._copyAttributes = function(tgt, src) {
|
||||
}
|
||||
};
|
||||
|
||||
_SparkTest.Patcher = Patcher;
|
||||
SparkTest.Patcher = Patcher;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Tinytest.add("spark - patch - basic", function(test) {
|
||||
|
||||
var Patcher = _SparkTest.Patcher;
|
||||
var Patcher = SparkTest.Patcher;
|
||||
|
||||
var div = function(html) {
|
||||
var n = document.createElement("DIV");
|
||||
@@ -144,7 +144,7 @@ Tinytest.add("spark - patch - copyAttributes", function(test) {
|
||||
if (! node) {
|
||||
node = n;
|
||||
} else {
|
||||
_SparkTest.Patcher._copyAttributes(node, n);
|
||||
SparkTest.Patcher._copyAttributes(node, n);
|
||||
}
|
||||
lastAttrs = {};
|
||||
_.each(allAttrNames, function(v,k) {
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
// (not hard to see what it is.)
|
||||
|
||||
Spark = {};
|
||||
_SparkTest = {};
|
||||
SparkTest = {};
|
||||
|
||||
var currentRenderer = (function () {
|
||||
var current = null;
|
||||
@@ -44,7 +44,7 @@ var currentRenderer = (function () {
|
||||
})();
|
||||
|
||||
TAG = "_spark_" + Random.id();
|
||||
_SparkTest.TAG = TAG;
|
||||
SparkTest.TAG = TAG;
|
||||
|
||||
// We also export this as Spark._TAG due to a historical accident. I
|
||||
// don't know if anything uses it (possibly some of Chris Mather's
|
||||
@@ -67,7 +67,7 @@ var ANNOTATION_LIST_ITEM = "item";
|
||||
|
||||
// Use from tests to turn on extra UniversalEventListener sanity checks
|
||||
var checkIECompliance = false;
|
||||
_SparkTest.setCheckIECompliance = function (value) {
|
||||
SparkTest.setCheckIECompliance = function (value) {
|
||||
checkIECompliance = value;
|
||||
};
|
||||
|
||||
@@ -1244,7 +1244,7 @@ Spark.createLandmark = function (options, htmlFunc) {
|
||||
});
|
||||
};
|
||||
|
||||
_SparkTest.getEnclosingLandmark = function (node) {
|
||||
SparkTest.getEnclosingLandmark = function (node) {
|
||||
var range = findRangeOfType(ANNOTATION_LANDMARK, node);
|
||||
return range ? range.landmark : null;
|
||||
};
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// XXX test variable wrapping (eg TR vs THEAD) inside each branch of Spark.list?
|
||||
|
||||
|
||||
_SparkTest.setCheckIECompliance(true);
|
||||
SparkTest.setCheckIECompliance(true);
|
||||
|
||||
// Tests can use {preserve: idNameLabels} or renderWithPreservation
|
||||
// to cause any element with an id or name to be preserved. This effect
|
||||
@@ -74,7 +74,7 @@ Tinytest.add("spark - assembly", function (test) {
|
||||
test.equal(furtherCanon(f.html()), html);
|
||||
|
||||
var actualGroups = [];
|
||||
var tempRange = new LiveRange(_SparkTest.TAG, frag);
|
||||
var tempRange = new LiveRange(SparkTest.TAG, frag);
|
||||
tempRange.visit(function (isStart, rng) {
|
||||
if (! isStart && rng.type === "data" /* Spark._ANNOTATION_DATA */)
|
||||
actualGroups.push(furtherCanon(canonicalizeHtml(
|
||||
@@ -3341,8 +3341,8 @@ Tinytest.add("spark - current landmark", function (test) {
|
||||
test.equal(callbacks, 1);
|
||||
Deps.flush();
|
||||
test.equal(callbacks, 2);
|
||||
test.equal(null, _SparkTest.getEnclosingLandmark(d.node()));
|
||||
var enc = _SparkTest.getEnclosingLandmark(d.node().firstChild);
|
||||
test.equal(null, SparkTest.getEnclosingLandmark(d.node()));
|
||||
var enc = SparkTest.getEnclosingLandmark(d.node().firstChild);
|
||||
test.equal(enc.a, 9);
|
||||
test.equal(enc.b, 2);
|
||||
test.isFalse('c' in enc);
|
||||
@@ -3358,32 +3358,32 @@ Tinytest.add("spark - current landmark", function (test) {
|
||||
Deps.flush();
|
||||
test.equal(callbacks, 4);
|
||||
|
||||
test.isTrue(_SparkTest.getEnclosingLandmark(findOuter()).outer);
|
||||
test.isTrue(_SparkTest.getEnclosingLandmark(findInnerA()).innerA);
|
||||
test.isTrue(_SparkTest.getEnclosingLandmark(findInnerB()).innerB);
|
||||
test.equal(1, _SparkTest.getEnclosingLandmark(findOuter()).renderCount);
|
||||
test.equal(1, _SparkTest.getEnclosingLandmark(findInnerA()).renderCount);
|
||||
test.equal(1, _SparkTest.getEnclosingLandmark(findInnerB()).renderCount);
|
||||
test.isTrue(SparkTest.getEnclosingLandmark(findOuter()).outer);
|
||||
test.isTrue(SparkTest.getEnclosingLandmark(findInnerA()).innerA);
|
||||
test.isTrue(SparkTest.getEnclosingLandmark(findInnerB()).innerB);
|
||||
test.equal(1, SparkTest.getEnclosingLandmark(findOuter()).renderCount);
|
||||
test.equal(1, SparkTest.getEnclosingLandmark(findInnerA()).renderCount);
|
||||
test.equal(1, SparkTest.getEnclosingLandmark(findInnerB()).renderCount);
|
||||
|
||||
R.set(4)
|
||||
Deps.flush();
|
||||
test.equal(callbacks, 5);
|
||||
test.equal(2, _SparkTest.getEnclosingLandmark(findOuter()).renderCount);
|
||||
test.equal(2, _SparkTest.getEnclosingLandmark(findInnerA()).renderCount);
|
||||
test.equal(2, SparkTest.getEnclosingLandmark(findOuter()).renderCount);
|
||||
test.equal(2, SparkTest.getEnclosingLandmark(findInnerA()).renderCount);
|
||||
|
||||
R.set(5)
|
||||
Deps.flush();
|
||||
test.equal(callbacks, 6);
|
||||
test.equal(3, _SparkTest.getEnclosingLandmark(findOuter()).renderCount);
|
||||
test.equal(3, _SparkTest.getEnclosingLandmark(findInnerA()).renderCount);
|
||||
test.equal(1, _SparkTest.getEnclosingLandmark(findInnerB()).renderCount);
|
||||
test.equal(3, SparkTest.getEnclosingLandmark(findOuter()).renderCount);
|
||||
test.equal(3, SparkTest.getEnclosingLandmark(findInnerA()).renderCount);
|
||||
test.equal(1, SparkTest.getEnclosingLandmark(findInnerB()).renderCount);
|
||||
|
||||
R.set(6)
|
||||
Deps.flush();
|
||||
test.equal(callbacks, 7);
|
||||
test.equal(4, _SparkTest.getEnclosingLandmark(findOuter()).renderCount);
|
||||
test.equal(4, _SparkTest.getEnclosingLandmark(findInnerA()).renderCount);
|
||||
test.equal(2, _SparkTest.getEnclosingLandmark(findInnerB()).renderCount);
|
||||
test.equal(4, SparkTest.getEnclosingLandmark(findOuter()).renderCount);
|
||||
test.equal(4, SparkTest.getEnclosingLandmark(findInnerA()).renderCount);
|
||||
test.equal(2, SparkTest.getEnclosingLandmark(findInnerB()).renderCount);
|
||||
|
||||
d.kill();
|
||||
Deps.flush();
|
||||
|
||||
Reference in New Issue
Block a user