react 0.5.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.travis.yml +4 -0
- package/Jakefile.js +39 -0
- package/README.md +18 -26
- package/browser-test/dist.html +89 -0
- package/browser-test/index.html +85 -0
- package/browser-test/min.html +89 -0
- package/dist/react.js +3093 -0
- package/dist/react.min.js +1 -0
- package/doc/advanced.md +7 -2
- package/doc/simple.dot +25 -0
- package/doc/simple.png +0 -0
- package/examples/{default1.js → longer-example.js} +0 -0
- package/examples/{default-simple.js → simple.js} +0 -0
- package/examples/{ast1.js → using-ast-directly.js} +4 -0
- package/examples/{default-events1.js → using-events1.js} +1 -1
- package/examples/{default-log-events.js → using-log-events.js} +0 -0
- package/lib/base-task.js +116 -110
- package/lib/cb-task.js +71 -67
- package/lib/core.js +118 -107
- package/lib/dsl.js +120 -115
- package/lib/error.js +44 -36
- package/lib/event-collector.js +69 -53
- package/lib/event-manager.js +69 -55
- package/lib/eventemitter.js +20 -0
- package/lib/finalcb-first-task.js +56 -53
- package/lib/finalcb-task.js +55 -51
- package/lib/id.js +18 -6
- package/lib/input-parser.js +49 -41
- package/lib/log-events.js +79 -73
- package/lib/parse.js +34 -25
- package/lib/promise-resolve.js +42 -27
- package/lib/promise-task.js +78 -74
- package/lib/react.js +59 -0
- package/lib/ret-task.js +59 -55
- package/lib/sprintf.js +18 -0
- package/lib/status.js +11 -2
- package/lib/task.js +216 -213
- package/lib/track-tasks.js +72 -58
- package/lib/validate.js +136 -136
- package/lib/vcon.js +78 -69
- package/lib/when-task.js +69 -65
- package/package.json +10 -9
- package/src/dist.build.requirejs +20 -0
- package/test/ast.mocha.js +136 -0
- package/test/cb-task.mocha.js +220 -0
- package/test/core-deferred.mocha.js +143 -0
- package/test/core-when.mocha.js +96 -0
- package/test/core.mocha.js +589 -0
- package/test/dsl.mocha.js +350 -0
- package/test/event-manager.mocha.js +119 -0
- package/test/exec-options.mocha.js +48 -0
- package/test/finalcb-task.mocha.js +58 -0
- package/test/input-parser.mocha.js +86 -0
- package/test/mocha.opts +2 -0
- package/test/module-use.mocha.js +147 -0
- package/test/promise-auto-resolve.mocha.js +68 -0
- package/test/ret-task.mocha.js +220 -0
- package/test/task.mocha.js +42 -0
- package/test/validate-cb-task.mocha.js +100 -0
- package/test/validate-ret-task.mocha.js +110 -0
- package/test/validate.mocha.js +324 -0
- package/test/vcon.mocha.js +193 -0
- package/vendor/chai/chai.js +2038 -0
- package/vendor/jquery/jquery-1.7.1.js +9266 -0
- package/vendor/jquery/jquery-1.7.1.min.js +4 -0
- package/vendor/mocha/mocha.css +135 -0
- package/vendor/mocha/mocha.js +3589 -0
- package/vendor/node/util.js +531 -0
- package/vendor/requirejs/require.js +2053 -0
- package/vendor/requirejs/require.min.js +33 -0
- package/doc/default-simple.dot +0 -19
- package/doc/default-simple.dot.png +0 -0
- package/react.js +0 -40
- package/test/ast.test.js +0 -69
- package/test/cb-task.test.js +0 -197
- package/test/core-deferred.test.js +0 -134
- package/test/core-promised.test.js +0 -132
- package/test/core-when.test.js +0 -84
- package/test/core.test.js +0 -568
- package/test/dsl.test.js +0 -330
- package/test/event-manager.test.js +0 -102
- package/test/exec-options.test.js +0 -33
- package/test/finalcb-task.test.js +0 -38
- package/test/input-parser.test.js +0 -66
- package/test/module-use.test.js +0 -134
- package/test/promise-auto-resolve.test.js +0 -52
- package/test/ret-task.test.js +0 -199
- package/test/task.test.js +0 -21
- package/test/validate-cb-task.test.js +0 -74
- package/test/validate-ret-task.test.js +0 -83
- package/test/validate.test.js +0 -295
- package/test/vcon.test.js +0 -173
package/test/vcon.test.js
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var test = require('tap').test;
|
|
4
|
-
|
|
5
|
-
var VContext = require('../lib/vcon.js');
|
|
6
|
-
|
|
7
|
-
test('VContext.create with empty args returns empty vCon', function (t) {
|
|
8
|
-
t.deepEqual(VContext.create([], []).values, {}, 'should be empty object');
|
|
9
|
-
t.deepEqual(VContext.create([], ['a']).values, {}, 'should be empty object');
|
|
10
|
-
t.end();
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
test('VContext.create with more args than params, ignore extra args', function (t) {
|
|
14
|
-
t.deepEqual(VContext.create([1], []).values, {}, 'should be empty object');
|
|
15
|
-
t.deepEqual(VContext.create([1, 2], ['a']).values, { a: 1 },
|
|
16
|
-
'should be object with one value');
|
|
17
|
-
t.end();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
test('VContext.create sets vCon[paramName] to arg value', function (t) {
|
|
21
|
-
t.deepEqual(VContext.create([1, 2], ['a', 'b']).values, { a: 1, b: 2 },
|
|
22
|
-
'should have all values');
|
|
23
|
-
t.end();
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
test('create with locals is merged with args taking precedence', function (t) {
|
|
27
|
-
var locals = { a: 11, c: 30 };
|
|
28
|
-
t.deepEqual(VContext.create([1, 2], ['a', 'b'], locals).values,
|
|
29
|
-
{ a: 1, c: 30, b: 2 }, 'should have merge of values');
|
|
30
|
-
t.end();
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
test('create with locals should not modify original locals', function (t) {
|
|
34
|
-
var locals = { a: 11, c: 30 };
|
|
35
|
-
t.deepEqual(VContext.create([1, 2], ['a', 'b'], locals).values,
|
|
36
|
-
{ a: 1, c: 30, b: 2 }, 'should have merge of values');
|
|
37
|
-
t.deepEqual(locals, { a: 11, c: 30 }, 'should not modify original locals object');
|
|
38
|
-
t.end();
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
test('getVar on null returns null', function (t) {
|
|
42
|
-
t.equal(VContext.create([null], ['a']).getVar('a'), null);
|
|
43
|
-
t.equal(VContext.create([{ b: null }], ['a']).getVar('a.b'), null);
|
|
44
|
-
t.end();
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
test('getVar on undefined or null parent returns undefined', function (t) {
|
|
48
|
-
t.equal(VContext.create([], []).getVar('a'), undefined);
|
|
49
|
-
t.equal(VContext.create([], ['a']).getVar('a'), undefined);
|
|
50
|
-
t.equal(VContext.create([], ['a']).getVar('a.b'), undefined);
|
|
51
|
-
t.equal(VContext.create([], ['a']).getVar('a.b.c'), undefined);
|
|
52
|
-
t.equal(VContext.create([null], ['a']).getVar('a.b'), undefined);
|
|
53
|
-
t.equal(VContext.create([null], ['a']).getVar('a.b.c'), undefined);
|
|
54
|
-
t.equal(VContext.create([1], ['a']).getVar('a.b'), undefined);
|
|
55
|
-
t.equal(VContext.create([1], ['a']).getVar('a.b.c'), undefined);
|
|
56
|
-
t.end();
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
test('simple getVar returns existing value', function (t) {
|
|
60
|
-
t.equal(VContext.create([null], ['a']).getVar('a'), null);
|
|
61
|
-
t.equal(VContext.create([1], ['a']).getVar('a'), 1);
|
|
62
|
-
t.equal(VContext.create([true], ['a']).getVar('a'), true);
|
|
63
|
-
t.equal(VContext.create(['banana'], ['a']).getVar('a'), 'banana');
|
|
64
|
-
t.end();
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
test('getVar on literals returns the literal', function (t) {
|
|
68
|
-
t.equal(VContext.create([], []).getVar(true), true);
|
|
69
|
-
t.equal(VContext.create([], []).getVar(false), false);
|
|
70
|
-
t.equal(VContext.create([], []).getVar(null), null);
|
|
71
|
-
t.equal(VContext.create([], []).getVar('true'), true);
|
|
72
|
-
t.equal(VContext.create([], []).getVar('false'), false);
|
|
73
|
-
t.equal(VContext.create([], []).getVar('null'), null);
|
|
74
|
-
t.equal(VContext.create([], []).getVar(-100), -100);
|
|
75
|
-
t.equal(VContext.create([], []).getVar(100), 100);
|
|
76
|
-
t.equal(VContext.create([], []).getVar(123.4), 123.4);
|
|
77
|
-
t.equal(VContext.create([], []).getVar(-987.6), -987.6);
|
|
78
|
-
t.equal(VContext.create([], []).getVar('-100'), -100);
|
|
79
|
-
t.equal(VContext.create([], []).getVar('100'), 100);
|
|
80
|
-
t.equal(VContext.create([], []).getVar('123.4'), 123.4);
|
|
81
|
-
t.equal(VContext.create([], []).getVar('-987.6'), -987.6);
|
|
82
|
-
t.equal(VContext.create([], []).getVar('"foo"'), 'foo');
|
|
83
|
-
t.equal(VContext.create([], []).getVar("'foo'"), 'foo');
|
|
84
|
-
t.equal(VContext.create([], []).getVar("'foo.bar'"), 'foo.bar');
|
|
85
|
-
t.equal(VContext.create([], []).getVar("'foo-bar'"), 'foo-bar');
|
|
86
|
-
t.equal(VContext.create([], []).getVar("'foo-bar.json'"), 'foo-bar.json');
|
|
87
|
-
t.equal(VContext.create([], []).getVar('"foo-bar.json"'), 'foo-bar.json');
|
|
88
|
-
t.deepEqual(VContext.create([], [], null, { a: 1}).getVar('this'), { a: 1});
|
|
89
|
-
t.end();
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
test('getVar for property returns the property', function (t) {
|
|
93
|
-
var o = { b: 100};
|
|
94
|
-
t.equal(VContext.create([o], ['a']).getVar('a.b'), 100);
|
|
95
|
-
o = { b: { c: 200 }};
|
|
96
|
-
t.equal(VContext.create([o], ['a']).getVar('a.b.c'), 200);
|
|
97
|
-
t.end();
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
test('setVar will create objects if needed', function (t) {
|
|
101
|
-
var v = VContext.create([], []);
|
|
102
|
-
v.setVar('foo.bar.baz', 100);
|
|
103
|
-
t.deepEqual(v.values, { foo: { bar: { baz: 100}}});
|
|
104
|
-
t.end();
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
test('simple setVar', function (t) {
|
|
108
|
-
var v = VContext.create([], []);
|
|
109
|
-
v.setVar('foo', 100);
|
|
110
|
-
t.deepEqual(v.values, { foo: 100});
|
|
111
|
-
t.end();
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
test('setVar will not affect other vars', function (t) {
|
|
115
|
-
var v = VContext.create([{ bar: 1}], ['foo']);
|
|
116
|
-
v.setVar('foo.baz', 2);
|
|
117
|
-
t.deepEqual(v.values, { foo: { bar: 1, baz: 2 }});
|
|
118
|
-
t.end();
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
test('setVar with null key, will not set anything', function (t) {
|
|
122
|
-
var v = VContext.create([{ bar: 1}], ['foo']);
|
|
123
|
-
v.setVar(null, 2);
|
|
124
|
-
t.deepEqual(v.values, { foo: { bar: 1 }});
|
|
125
|
-
t.end();
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
test('setVar with undefined key, will not set anything', function (t) {
|
|
129
|
-
var v = VContext.create([{ bar: 1}], ['foo']);
|
|
130
|
-
v.setVar(undefined, 2);
|
|
131
|
-
t.deepEqual(v.values, { foo: { bar: 1 }});
|
|
132
|
-
t.end();
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
test('saveResults will set values for params and :LAST_RESULTS', function (t) {
|
|
136
|
-
var v = VContext.create([], []);
|
|
137
|
-
v.saveResults(['foo', 'bar', 'cat'], [1, 'hello', null]);
|
|
138
|
-
t.deepEqual(v.values, { foo: 1, bar: 'hello', cat: null ,
|
|
139
|
-
':LAST_RESULTS': [1, 'hello', null] });
|
|
140
|
-
t.end();
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
test('saveResults set :LAST_RESULT w/all even params is short', function (t) {
|
|
144
|
-
var v = VContext.create([], []);
|
|
145
|
-
v.saveResults(['foo'], [1, 'hello', null]);
|
|
146
|
-
t.deepEqual(v.values, { foo: 1,
|
|
147
|
-
':LAST_RESULTS': [1, 'hello', null] });
|
|
148
|
-
t.end();
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
test('saveResults will set values for params and :LAST_RESULTS', function (t) {
|
|
152
|
-
var v = VContext.create([], []);
|
|
153
|
-
v.saveResults(['foo', 'bar', 'cat'], [1, 'hello', null]);
|
|
154
|
-
t.deepEqual(v.values, { foo: 1, bar: 'hello', cat: null ,
|
|
155
|
-
':LAST_RESULTS': [1, 'hello', null] });
|
|
156
|
-
t.end();
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
test('saveResults upgrades undefined to null, but :LAST_RESULT is exact', function (t) {
|
|
160
|
-
var v = VContext.create([], []);
|
|
161
|
-
v.saveResults(['foo', 'bar', 'baz'], [1, undefined]);
|
|
162
|
-
t.deepEqual(v.values, { foo: 1, bar: null, baz: null,
|
|
163
|
-
':LAST_RESULTS': [1, undefined] });
|
|
164
|
-
t.end();
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
test('saveResults null params skips saving, :LAST_RESULT is exact', function (t) {
|
|
168
|
-
var v = VContext.create([], []);
|
|
169
|
-
v.saveResults(['foo', null], [1, 20]); //skip second param
|
|
170
|
-
t.deepEqual(v.values, { foo: 1, ':LAST_RESULTS': [1, 20] });
|
|
171
|
-
t.end();
|
|
172
|
-
});
|
|
173
|
-
|