示例#1
0
文件: extend.js 项目: medikoo/dom-ext
module.exports = function (t, a) {
	var el1, el2, el3, el4, fn = function () {}, node;

	if (typeof document === "undefined") return;

	el1 = document.createElement("p");
	el2 = document.createElement("div");
	el2 = t.call(el2, { class: "test",
onclick: fn,
foo: true,
bar: false,
		   other: null,
another: undefined });

	a(el2.childNodes.length, 0, "With attrs: Children");
	a(el2.getAttribute("class"), "test", "With attrs: Attribute");
	a(el2.onclick, fn, "With attrs: Listener attribute");
	a(el2.getAttribute("foo"), "foo", "With attrs: Boolean (true) attribute");
	a(el2.hasAttribute("bar"), false, "With attrs: Boolean (false) attribute");
	a(el2.hasAttribute("other"), false, "With attrs: Boolean (false) attribute");
	a(el2.hasAttribute("another"), false,
		"With attrs: Boolean (false) attribute");

	t.call(el2, { class: false, onclick: null });
	a(el2.hasAttribute("class"), false, "Cancelled attribute (false)");
	a(el2.hasAttribute("onclick"), false, "Cancelled attribute (null)");
	a(el2.onclick, null, "Cancelled function property");

	el3 = document.createElement("form");
	t.call(el3, el1, el2);
	a(el3.nodeName.toLowerCase(), "form", "With children: NodeName");
	a(el3.nodeType, 1, "With children: NodeType");
	a.deep(aFrom(el3.childNodes), [el1, el2],
		"With children: Children");

	el4 = document.createElement("section");
	el4 = t.call(el4, { class: "bar" }, el3, el2);
	a(el4.nodeName.toLowerCase(), "section", "With attrs & children: NodeName");
	a(el4.nodeType, 1, "With attrs & children: NodeType");
	a(el4.getAttribute("class"), "bar", "With attrs & children: Attribute");
	a.deep(aFrom(el4.childNodes), [el3, el2],
		"With attrs & children: Children");

	node = t.call(document.createElement("div"), el2, "Test").childNodes[1];
	a(node.nodeType, 3, "String to Text node");
	a(node.data, "Test", "String to Text node: content");

	node = t.call(document.createElement("div"), "String").childNodes[0];
	a(node.data, "String", "String to Text node (no attrs)");
};
示例#2
0
	onChange: d(function () {
		var value, changed, valid, emitChanged, emitValid, isRequired;
		if (this.control.form) {
			if (this.form !== this.control.form) {
				if (this.form) this.form.removeEventListener('reset', this._onReset, false);
				this.form = this.control.form;
				this.form.addEventListener('reset', this._onReset, false);
			}
		}
		value = this.inputValue;
		changed = aFrom(this.valueDOM.querySelectorAll('input[type=checkbox]')).some(function (input) {
			return input.checked;
		});
		changed = (this.multiple && (this._value != null) && (value != null))
			? isCopy.call(value, this._value) : (value !== this._value);
		if (this.required) isRequired = true;
		else if (this.observable) isRequired = this.observable.descriptor.required;
		valid = isRequired ? (value != null) : true;

		if (this.changed !== changed) {
			this.changed = changed;
			emitChanged = true;
		}
		if (this.valid !== valid) {
			this.valid = valid;
			emitValid = true;
		}
		this.updateRequired();
		this.emit('change', value);
		if (emitChanged) this.emit('change:changed', this.changed);
		if (emitValid) this.emit('change:valid', this.valid);
	}),
示例#3
0
	updateRequired: d(function () {
		if (!this._required) return;
		this.castControlAttribute('required',
			aFrom(this.valueDOM.querySelectorAll('input[type=checkbox]')).every(function (input) {
				return input.checked;
			}));
	}),
示例#4
0
		cb = function self(err) {
			var cb, args, id = self.id;
			if (id == null) {
				// Shouldn't happen, means async callback was called sync way
				nextTick(apply.bind(self, this, arguments));
				return;
			}
			delete self.id;
			cb = waiting[id];
			delete waiting[id];
			if (!cb) {
				// Already processed,
				// outcome of race condition: asyncFn(1, cb), asyncFn.clear(), asyncFn(1, cb)
				return;
			}
			args = aFrom(arguments);
			if (conf.has(id)) {
				if (err) {
					conf.delete(id);
				} else {
					cache[id] = { context: this, args: args };
					conf.emit('setasync', id, (typeof cb === 'function') ? 1 : cb.length);
				}
			}
			if (typeof cb === 'function') {
				result = apply.call(cb, this, args);
			} else {
				cb.forEach(function (cb) { result = apply.call(cb, this, args); }, this);
			}
			return result;
		};
module.exports = exports = function (nodes, parent) {
	var styleSheetsData, result;
	if (!exports.enabled) return aFrom(nodes);
	styleSheetsData = [];
	result = [];
	forEach.call(nodes, function self(node) {
		var sibling;
		if (isStyleSheet(node)) {
			if (node.hasAttribute('href')) {
				sibling = node.nextSibling;
				if (!sibling) {
					sibling = parent.appendChild(node.ownerDocument.createTextNode(''));
					result.push(defineProperty(sibling, '$siteTreeTemporary', d(true)));
				}
				styleSheetsData.push({ styleSheet: node, nextSibling: sibling });
				return;
			}
		}
		result.push(node);
	});
	if (!styleSheetsData.length) return result;
	setTimeout(function () {
		styleSheetsData.forEach(function (data) {
			if (data.nextSibling.parentNode) {
				data.nextSibling.parentNode.insertBefore(data.styleSheet, data.nextSibling);
				if (data.nextSibling.$siteTreeTemporary) {
					data.nextSibling.parentNode.removeChild(data.nextSibling);
				}
			} else if (data.styleSheet.parentNode) {
				data.styleSheet.parentNode.removeChild(data.styleSheet);
			}
		});
	}, 100);
	return result;
};
				"No args": function () {
					i = 0;
					a.deep(aFrom(r = fn()), [], "First");
					a(fn(), r, "Second");
					a(fn(), r, "Third");
					a(i, 1, "Called once");
				},
				"No args": function (a) {
					i = 0;
					a.deep(aFrom(r = fn()), [false, "undefined"], "First");
					a(fn(), r, "Second");
					a(fn(), r, "Third");
					a(i, 1, "Called once");
				},
				"Many args": function () {
					var x = {};
					i = 0;
					a.deep(aFrom(r = fn(x, 8, 23, 98)), [x, 8, 23, 98], "First");
					a(fn(x, 8, 23, 98), r, "Second");
					a(fn(x, 8, 23, 98), r, "Third");
					a(i, 1, "Called once");
				}
示例#9
0
 desc.value = function() {
   var i,
       emitter,
       data = aFrom(pipes);
   emit.apply(this, arguments);
   for (i = 0; (emitter = data[i]); ++i)
     emit.apply(emitter, arguments);
 };
示例#10
0
	testObject = function (obj) {
		var desc;
		a.h3("Not imported");
		a.not(obj.$get('regular').object, obj);
		a.not(obj.$get('regularValue').object.__id__, obj.__id__, "Value");
		a.not(obj.$get('regularComputed').object, obj, "Computed");
		a.not(obj.$get('multiple').object, obj, "Computed");

		a.h3("Imported");
		a.h4("Regular");
		desc = obj.$get('statsRegular');
		a(desc.object.__id__, obj.__id__, "Owner");
		a(desc._value_, undefined, "Value");
		a.deep(desc, { type: target.String }, "Data");

		a.h4("Regular Stats Value");
		desc = obj.$get('statsRegularStatsValue');
		a(desc.object, obj, "Owner");
		a(desc._value_, undefined, "Value");
		a.deep(desc, { type: target.String }, "Data");

		a.h4("Regular Value");
		desc = obj.$get('statsRegularValue');
		a(desc.object, obj, "Owner");
		a(desc.hasOwnProperty('_value_') && desc._value_, 'foo', "Value");
		a.deep(desc, { type: target.String }, "Data");

		a.h4("Regular Value StatsValue");
		desc = obj.$get('statsRegularValueStatsValue');
		a(desc.object, obj, "Owner");
		a(desc.hasOwnProperty('_value_') && desc._value_, 'bar', "Value");
		a.deep(desc, { type: target.StringLine }, "Data");

		a.h4("Regular Computed");
		desc = obj.$get('statsRegularComputed');
		a(desc.object, obj, "Owner");
		a(desc._value_, 'foolorem', "Value");
		a.deep(desc, { type: target.String }, "Data");

		a.h4("Regular Computed Stats Value");
		desc = obj.$get('statsRegularComputedStatsValue');
		a(desc.object, obj, "Owner");
		a(desc.hasOwnProperty('_value_') && desc._value_, 'fooipsum', "Value");
		a.deep(desc, { type: target.String }, "Data");

		a.h4("Multiple");
		desc = obj.$get('statsMultiple');
		a(desc.object, obj, "Owner");
		a(desc.hasOwnProperty('_value_') && desc._value_, undefined, "Value");
		a.deep(desc, { type: target.Number, multiple: true }, "Data");

		a.h4("Multiple computed");
		desc = obj.$get('statsMultipleComputed');
		a(desc.object, obj, "Owner");
		a(desc.hasOwnProperty('_value_') && desc._value_, undefined, "Desc Value");
		a.deep(desc, { type: target.String, multiple: true }, "Data");
		a.deep(aFrom(obj.statsMultipleComputed), [], "Value");
	};
示例#11
0
	return from(iterable(rows), function (row, index) {
		return from(iterable(row), function (str, index) {
			var col = cols[index];
			if (!col) col = cols[index] = { width: 0 };
			str = stringifiable(str);
			if (str.length > col.width) col.width = str.length;
			return str;
		});
	}).map(function (row) {
				"One arg": function (a) {
					var fn = memoize(
						function (elo) {
							++i;
							return arguments;
						},
						{ resolvers: [Boolean] }
					);
					a.deep(aFrom(r = fn("elo")), [true], "First");
				},
	return from(iterable(rows), function (row, index) {
		return from(iterable(row), function (str, index) {
			var col = cols[index], strLength;
			if (!col) col = cols[index] = { width: 0 };
			str = stringifiable(str);
			strLength = getStrippedLength(str);
			if (strLength > col.width) col.width = strLength;
			return { str: str, length: strLength };
		});
	}).map(function (row) {
示例#14
0
	_onReset: d(function () {
		this.control.value = null;
		if (this.control.files && this.control.files.length) {
			// In Opera control is not reset properly, force it with hack
			getForceReset(this.document)(this.control);
		}
		aFrom(this.valueDOM.querySelectorAll('input[type=checkbox]')).every(function (input) {
			input.checked = false;
		});
		this.onChange();
	})
示例#15
0
	set.forEach(function () {
		a.deep(aFrom(arguments), [arr[i], arr[i], set],
			"ForEach: Arguments:  #" + i);
		a(this, y, "ForEach: Context: #" + i);
		if (i === 0) {
			a(set.delete('raz'), true, "Delete: true");
			a(set.has('raz'), false, "Delete");
			a(set.size, 3, "Delete: size");
			set.add('cztery');
			arr.push('cztery');
		}
		i++;
	}, y);
示例#16
0
文件: after.js 项目: medikoo/dom-ext
module.exports = function (t, a) {
	var parent, el, pre, post, child, text;
	if (typeof document === "undefined") return;

	parent = document.createElement("p");
	pre = parent.appendChild(document.createElement("span"));
	el = parent.appendChild(document.createElement("span"));
	post = parent.appendChild(document.createElement("span"));

	t.call(el, "raz", child = document.createElement("span"));
	text = parent.childNodes[2];
	a(text.nodeType, 3, "String: Type");
	a.deep(aFrom(parent.childNodes), [pre, el, text, child, post]);
	a(el.childNodes.length, 0, "No self children");
};
				"Some Args": function (a) {
					var x = {};
					i = 0;
					a.deep(aFrom(r = fn(0, 34, x, 45)), [false, "34", x, 45], "First");
					a(fn(0, 34, x, 22), r, "Second");
					a(fn(0, 34, x, false), r, "Third");
					a(i, 1, "Called once");
					return {
						Other: function (a) {
							a.deep(aFrom(r = fn(1, 34, x, 34)), [true, "34", x, 34], "Second");
							a(fn(1, 34, x, 89), r, "Third");
							a(i, 2, "Called once");
						}
					};
				}
示例#18
0
文件: parse.js 项目: medikoo/xlint
extendOption = function (conf, name, value) {
	if (!conf.hasOwnProperty(name) || !value.mod || !isArray(conf[name])) {
		conf[name] = value;
		return;
	}
	if (conf[name].mod) {
		conf[name] = conf[name].concat(value);
		conf[name].mod = true;
		return;
	}
	conf[name] = aFrom(conf[name]);
	value.forEach(function (data) {
		if (data.action === 'add') push.apply(this, data.value);
		else remove.apply(this, data.value);
	}, conf[name]);
};
示例#19
0
module.exports = function (rows/*, options*/) {
	var options = Object(arguments[1]), cols = [];
	return from(iterable(rows), function (row, index) {
		return from(iterable(row), function (str, index) {
			var col = cols[index];
			if (!col) col = cols[index] = { width: 0 };
			str = stringifiable(str);
			if (str.length > col.width) col.width = str.length;
			return str;
		});
	}).map(function (row) {
		return row.map(function (item, index) {
			return pad.call(item, ' ', -cols[index].width);
		}).join((options.sep == null) ? ' | ' : options.sep);
	}).join('\n') + '\n';
};
示例#20
0
文件: extend.js 项目: medikoo/dom-ext
module.exports = function (t, a) {
	var el1, el2, node, df;

	if (typeof document === "undefined") return;

	el1 = document.createElement("p");
	el2 = document.createElement("div");
	df = document.createDocumentFragment();

	t.call(df, el1, "foo:bar", el2);

	node = df.childNodes[1];
	a(node.nodeType, 3, "String to Text node");
	a(node.data, "foo:bar", "String to Text node: content");
	a.deep(aFrom(df.childNodes), [el1, node, el2], "Children");
};
示例#21
0
					nextTick(function () {
						var result;
						if (preFetchTimeouts[id] !== 'nextTick') return;
						delete preFetchTimeouts[id];
						conf.delete(id);
						if (options.async) {
							args = aFrom(args);
							args.push(noop);
						}
						result = conf.memoized.apply(context, args);
						if (options.promise) {
							// Supress eventual error warnings
							if (isPromise(result)) {
								if (typeof result.done === 'function') result.done(noop, noop);
								else result.then(noop, noop);
							}
						}
					});
	conf.original = function () {
		var args, cb, origCb, result;
		if (!currentCallback) return apply.call(original, this, arguments);
		args = aFrom(arguments);
		cb = function self(err) {
			var cb, args, id = self.id;
			if (id == null) {
				// Shouldn't happen, means async callback was called sync way
				nextTick(apply.bind(self, this, arguments));
				return undefined;
			}
			delete self.id;
			cb = waiting[id];
			delete waiting[id];
			if (!cb) {
				// Already processed,
				// outcome of race condition: asyncFn(1, cb), asyncFn.clear(), asyncFn(1, cb)
				return undefined;
			}
			args = aFrom(arguments);
			if (conf.has(id)) {
				if (err) {
					conf.delete(id);
				} else {
					cache[id] = { context: this, args: args };
					conf.emit("setasync", id, typeof cb === "function" ? 1 : cb.length);
				}
			}
			if (typeof cb === "function") {
				result = apply.call(cb, this, args);
			} else {
				cb.forEach(function (cb) { result = apply.call(cb, this, args); }, this);
			}
			return result;
		};
		origCb = currentCallback;
		currentCallback = currentContext = currentArgs = null;
		args.push(cb);
		result = apply.call(original, this, args);
		cb.cb = origCb;
		currentCallback = cb;
		return result;
	};
示例#23
0
	inputValue: d.gs(function () {
		var value, item;
		if (!this.multiple) {
			if (this.control.files && this.control.files[0]) return this.control.files[0];
			item = this.valueDOM.firstElementChild;
			if (!item) return null;
			if (item.classList.contains('empty')) return null;
			if (item.querySelector('input[type=checkbox]').checked) return null;
			return this.valueDOM.firstElementChild.getAttribute('data-id');
		}
		value = compact.call(map.call(this.valueDOM.childNodes, function (item) {
			var id;
			if (item.classList.contains('empty')) return null;
			if (item.querySelector('input[type=checkbox]').checked) return null;
			id = item.getAttribute('data-id');
			if (!id) throw new TypeError("Missing id (data-id attribute) on file item");
			return id;
		})).concat(this.control.files ? aFrom(this.control.files) : []);
		return value.length ? value : null;
	}, function (nu) {
示例#24
0
	conf.original = function () {
		var args, cb, origCb, result;
		if (!currentCallback) return apply.call(original, this, arguments);
		args = aFrom(arguments);
		cb = function self(err) {
			var cb, args, id = self.id;
			if (id == null) {
				// Shouldn't happen, means async callback was called sync way
				nextTick(apply.bind(self, this, arguments));
				return;
			}
			delete self.id;
			cb = waiting[id];
			delete waiting[id];
			args = aFrom(arguments);
			if (conf.has(id)) {
				if (err) {
					conf.delete(id);
				} else {
					cache[id] = { context: this, args: args };
					conf.emit('setasync', id, (typeof cb === 'function') ? 1 : cb.length);
				}
			}
			if (typeof cb === 'function') {
				result = apply.call(cb, this, args);
			} else {
				cb.forEach(function (cb) {
					result = apply.call(cb, this, args);
				}, this);
			}
			return result;
		};
		origCb = currentCallback;
		currentCallback = currentContext = currentArgs = null;
		args.push(cb);
		result = apply.call(original, this, args);
		cb.cb = origCb;
		currentCallback = cb;
		return result;
	};
module.exports = function (rows/*, options*/) {
	var options = Object(arguments[1]), cols = []
	  , colsOptions = options.columns || [];
	return from(iterable(rows), function (row, index) {
		return from(iterable(row), function (str, index) {
			var col = cols[index], strLength;
			if (!col) col = cols[index] = { width: 0 };
			str = stringifiable(str);
			strLength = getStrippedLength(str);
			if (strLength > col.width) col.width = strLength;
			return { str: str, length: strLength };
		});
	}).map(function (row) {
		return row.map(function (item, index) {
			var pad, align = 'left', colOptions = colsOptions && colsOptions[index];
			align = (colOptions && (colOptions.align === 'right')) ? 'right' : 'left';
			pad = repeat.call(' ', cols[index].width - item.length);
			if (align === 'left') return item.str + pad;
			return pad + item.str;
		}).join((options.sep == null) ? ' | ' : options.sep);
	}).join('\n') + '\n';
};
示例#26
0
module.exports = function (operation1/*, ...operationn*/) {
	var errors = [], previousResult = {}, operations = aFrom(arguments);
	if (isError(operations[0])) errors.push(operations.shift());
	forEach.call(operations, ensureCallable);

	if (operations.length === 1) operations.push(identity);
	var result = bind.apply(compose, map.call(operations, function (fn) {
		return function () {
			try {
				return (previousResult = (fn(previousResult) || previousResult));
			} catch (e) {
				if (e.name !== "DbjsError") throw e;
				errors.push(e);
			}
		};
	}).reverse())()();

	if (!errors.length) return result;

	throw new DbjsError("Invalid properties:\n\t" +
		errors.map(getMessage).join('\t\n'), 'SET_PROPERTIES_ERROR', { errors: errors });
};
示例#27
0
	resolve: function (fromfile, dirname, scope, tree, dep) {
		// console.log("R", dep.value);
		tree = aFrom(tree);
		if (dep.value[0] === '.') return this.resolveLocal(fromfile, dirname, scope, tree, dep);
		return this.resolveExternal(fromfile, dirname, scope, dep);
	},
示例#28
0
'use strict';

var from         = require('es5-ext/array/from')
  , primitiveSet = require('es5-ext/object/primitive-set');

module.exports = primitiveSet.apply(null, from(' \f\t\v​\u00a0\u1680​\u180e' +
	'\u2000​\u2001\u2002​\u2003\u2004​\u2005\u2006​\u2007\u2008​\u2009\u200a' +
	'​​​\u202f\u205f​\u3000'));
示例#29
0
module.exports = function (t, a) {
	var target = t(source, 'reduceBase'), targetUser = target.User.prototype, desc, testObject;

	t(new Database(), 'test'); // test empty database

	testObject = function (obj) {
		var desc;
		a.h3("Not imported");
		a.not(obj.$get('regular').object, obj);
		a.not(obj.$get('regularValue').object.__id__, obj.__id__, "Value");
		a.not(obj.$get('regularComputed').object, obj, "Computed");
		a.not(obj.$get('multiple').object, obj, "Computed");

		a.h3("Imported");
		a.h4("Regular");
		desc = obj.$get('statsRegular');
		a(desc.object.__id__, obj.__id__, "Owner");
		a(desc._value_, undefined, "Value");
		a.deep(desc, { type: target.String }, "Data");

		a.h4("Regular Stats Value");
		desc = obj.$get('statsRegularStatsValue');
		a(desc.object, obj, "Owner");
		a(desc._value_, undefined, "Value");
		a.deep(desc, { type: target.String }, "Data");

		a.h4("Regular Value");
		desc = obj.$get('statsRegularValue');
		a(desc.object, obj, "Owner");
		a(desc.hasOwnProperty('_value_') && desc._value_, 'foo', "Value");
		a.deep(desc, { type: target.String }, "Data");

		a.h4("Regular Value StatsValue");
		desc = obj.$get('statsRegularValueStatsValue');
		a(desc.object, obj, "Owner");
		a(desc.hasOwnProperty('_value_') && desc._value_, 'bar', "Value");
		a.deep(desc, { type: target.StringLine }, "Data");

		a.h4("Regular Computed");
		desc = obj.$get('statsRegularComputed');
		a(desc.object, obj, "Owner");
		a(desc._value_, 'foolorem', "Value");
		a.deep(desc, { type: target.String }, "Data");

		a.h4("Regular Computed Stats Value");
		desc = obj.$get('statsRegularComputedStatsValue');
		a(desc.object, obj, "Owner");
		a(desc.hasOwnProperty('_value_') && desc._value_, 'fooipsum', "Value");
		a.deep(desc, { type: target.String }, "Data");

		a.h4("Multiple");
		desc = obj.$get('statsMultiple');
		a(desc.object, obj, "Owner");
		a(desc.hasOwnProperty('_value_') && desc._value_, undefined, "Value");
		a.deep(desc, { type: target.Number, multiple: true }, "Data");

		a.h4("Multiple computed");
		desc = obj.$get('statsMultipleComputed');
		a(desc.object, obj, "Owner");
		a(desc.hasOwnProperty('_value_') && desc._value_, undefined, "Desc Value");
		a.deep(desc, { type: target.String, multiple: true }, "Data");
		a.deep(aFrom(obj.statsMultipleComputed), [], "Value");
	};

	a.h1("Direct properties");
	testObject(targetUser);

	a.h1("Multiple properties");
	a.h2("Not Imported");
	a.not(targetUser.$get('multipleObj').object, targetUser);

	a.h2("Imported");
	desc = targetUser.$get('statsMultipleObj');
	a(desc.object.__id__, targetUser.__id__, "Owner");
	a(desc._value_, undefined, "Value");
	a.deep(desc, { type: target.TypeD, multiple: true }, "Data");

	a.h1("Nested properties");
	a.h2("Not Imported");
	a.not(targetUser.$get('nested').object, targetUser);
	a.not(targetUser.$get('nestedRich').object, targetUser, "Rich");

	a.h2("Imported");
	a(targetUser.nestedStatsBase instanceof target.Object, true, "Marked");
	a(targetUser.statsNestedEmpty instanceof target.Object, true, "Nested empty");
	testObject(targetUser.statsNested);
	testObject(targetUser.statsNestedStatsBase);

	a.h1("Nested deep properties");
	a.h2("Not Imported");
	a.not(targetUser.statsNestedDeep.$get('nested').object, targetUser.statsNestedDeep, "Nested");
	a.not(targetUser.statsNestedDeep.$get('regular').object, targetUser.statsNestedDeep, "Regular");
	a.not(targetUser.statsNestedDeep.$get('regularValue').object, targetUser.statsNestedDeep,
		"Regular value");

	a.h2("Imported");
	testObject(targetUser.statsNestedDeep.statsNested);

	a.h1("Nested bridge");
	a.h2("Not Imported");
	a(targetUser.nestedBridge instanceof target.TypeB, true, "Type with stats base");
	a(targetUser.nestedBridgeStats.getDescriptor('statsRegular').required,
		true, "Parent");

	a.h2("Imported");
	desc = targetUser.nestedBridgeStats.$get('bridgeRegularValue');
	a(desc.object, targetUser.nestedBridgeStats, "Owner");
	a(!desc.hasOwnProperty('_value_') || desc._value_ === undefined, true, "Value");
	a.deep(desc, { type: target.UsDollar }, "Data");

	a.h3("Computed deep");
	desc = targetUser.nestedBridgeStats.$get('bridgeRegularComputed');
	a(desc.object, targetUser.nestedBridgeStats, "Owner");
	a(desc._value_, 'fooundefined', "Value");
	a.deep(desc, {}, "Data");

	a.h1("Types");
	a.h2("Not Imported");
	a(target.Date, undefined, "Date");

	a.h2("Imported");
	a(target.StringLine.__id__, 'StringLine', "StringLine");
	a(target.Currency.__id__, 'Currency', "Interim type");
	a(target.UsDollar.__id__, 'UsDollar', "Parent type");
	a(target.TypeD.__id__, 'TypeD', "TypeD");
	a(target.PTypeA.__id__, 'PTypeA', "PTypeA");
	a(target.PTypeCObj.__id__, 'PTypeCObj', "PTypeCObj");
	a(target.PTypeC.__id__, 'PTypeC', "PTypeC");
	a(target.PTypeB.meta.foobar.marko, 'zagalo');

	a.h2("Constructor properties");
	desc = target.TypeC.$get('regularValue');
	a(desc.object.__id__, target.TypeC.__id__, "Owner");
	a(desc._value_, 'foo', "Value");
	a.deep(desc, { type: target.String }, "Data");

	desc = target.TypeC.$get('statsRegular');
	a(desc.object, target.TypeC, "Owner");
	a(desc._value_, undefined, "Value");
	a.deep(desc, { type: target.String }, "Data");

	a.h3("Multiple");
	desc = target.TypeC.$get('multiple');
	a(desc.object.__id__, target.TypeC.__id__, "Owner");
	a.deep(desc, { type: target.PTypeB, multiple: true }, "Data");
	a.deep(aFrom(target.TypeC.multiple), ['foo', 'bar'], "Value");

	a.h2("Prototype properties");
	testObject(target.TypeC.prototype);
	a.h3("Demanded by extension");
	desc = target.TypeC.prototype.$get('bridgeRegularValue');
	a(desc.object, target.TypeC.prototype, "Owner");
	a(desc._value_, 20, "Value");
	a.deep(desc, { type: target.Number }, "Data");

	desc = target.TypeC.prototype.$get('bridgeRegularComputed');
	a(desc.object, target.TypeC.prototype, "Owner");
	a(desc._value_, undefined, "Value");
	a.deep(desc, { type: target.String }, "Data");

	a.h1("Nested map");
	a(target.NestedMapContainerChild.prototype.nestedMap.someMapNestedObj.constructor.__id__,
		target.NestedMapType.__id__);

	a(target.RealNestedMapContainer.prototype.nestedMap.map.get('whatever').constructor.__id__,
		target.CustomNestedType.__id__);
};
示例#30
0
	map.forEach(function () {
		result.push(aFrom(arguments));
		a(this, y, "ForEach: Context: #" + i);
	}, y);