www_app 1.3.0 → 2.0.0
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.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/README.md +42 -24
- data/VERSION +1 -1
- data/bin/www_app +15 -4
- data/lib/public/vendor/hogan-3.0.2.min.js +5 -0
- data/lib/public/vendor/instruct_instruct_instruct.js +247 -0
- data/lib/public/vendor/jquery-2.1.3.min.js +4 -0
- data/lib/public/vendor/lodash.min.js +89 -0
- data/lib/public/www_app.js +885 -625
- data/lib/www_app/CSS.rb +310 -0
- data/lib/www_app/HTML.rb +219 -0
- data/lib/www_app/JavaScript.rb +51 -0
- data/lib/www_app/TO.rb +897 -0
- data/lib/www_app.rb +324 -945
- data/playground/config.ru +102 -0
- data/specs/client-side/index.html +1 -1
- data/specs/client-side/index.js +31 -379
- data/specs/lib/config.ru +60 -31
- data/specs/lib/helpers.rb +24 -2
- data/specs/server-side/0000-new.rb +1 -1
- data/specs/server-side/0001-underscore-double.rb +38 -0
- data/specs/server-side/0001-underscore.rb +73 -0
- data/specs/server-side/0010-attrs.rb +3 -4
- data/specs/server-side/0011-id.rb +5 -5
- data/specs/server-side/0020-tag.rb +2 -2
- data/specs/server-side/0020-tag_content.rb +1 -1
- data/specs/server-side/0021-body.rb +1 -1
- data/specs/server-side/0021-script.rb +66 -20
- data/specs/server-side/{0021-page_title.rb → 0021-title.rb} +5 -3
- data/specs/server-side/0030-mustache.rb +27 -20
- data/specs/server-side/0030-style.rb +64 -21
- data/specs/server-side/0040-css.rb +4 -4
- data/specs/server-side/0041-pseudo.rb +55 -0
- data/specs/server-side/0042-slash.rb +20 -0
- data/specs/server-side/0060-text.rb +26 -0
- metadata +18 -13
- data/lib/public/jquery-2.1.1.js +0 -4
- data/lib/public/underscore-1.7.0.js +0 -6
- data/lib/public/underscore-min.map +0 -1
- data/lib/public/underscore.string-2.3.0.js +0 -1
- data/lib/www_app/Clean.rb +0 -169
- data/lib/www_app/dsl.rb +0 -86
- data/lib/www_app/source.rb +0 -53
- data/specs/server-side/0050-on.rb +0 -64
- data/specs/server-side/0060-string.rb +0 -32
- /data/lib/public/{jquery.serialize-object.min.js → vendor/jquery.serialize-object.min.js} +0 -0
data/specs/client-side/index.js
CHANGED
@@ -38,363 +38,15 @@ var do_this = function (do_f) {
|
|
38
38
|
QUnit.module("WWW_App");
|
39
39
|
// ==================================================================
|
40
40
|
|
41
|
-
QUnit.test( "it runs the code", function ( assert ) {
|
42
|
-
WWW_App.run([
|
43
|
-
'#box_1',
|
44
|
-
"add class", ['weird']
|
45
|
-
]);
|
46
|
-
assert.ok( $('#box_1').hasClass('weird') === true, "Passed!" );
|
47
|
-
});
|
48
|
-
|
49
|
-
|
50
|
-
QUnit.test( "it evals the args as code", function( assert ) {
|
51
|
-
var o = WWW_App.run([
|
52
|
-
"add to stack", ["array", [1,2,3]]
|
53
|
-
]);
|
54
|
-
assert.deepEqual( o.right('all'), [[1,2,3]], "Args are eval'd before run." );
|
55
|
-
});
|
56
|
-
|
57
|
-
|
58
|
-
QUnit.test("throws error if not enough stack values", function (assert) {
|
59
|
-
assert.throws(function () {
|
60
|
-
WWW_App.run(['less or equal', [5]]);
|
61
|
-
}, /Not enough values in stack/);
|
62
|
-
});
|
63
|
-
|
64
41
|
|
65
|
-
QUnit.test("throws error if not enough arg values", function (assert) {
|
66
|
-
assert.throws(function () {
|
67
|
-
WWW_App.run(['less or equal', []]);
|
68
|
-
}, /Not enough values in args/);
|
69
|
-
});
|
70
|
-
|
71
|
-
|
72
|
-
// ==================================================================
|
73
|
-
QUnit.module("less or equal");
|
74
|
-
// ==================================================================
|
75
42
|
|
76
|
-
QUnit.test('it places true if: 5 <= 6', function (assert) {
|
77
|
-
var o = WWW_App.run([
|
78
|
-
5, "less or equal", [ 6 ]
|
79
|
-
]);
|
80
|
-
assert.equal( o.right('last'), true);
|
81
|
-
});
|
82
|
-
|
83
|
-
QUnit.test('it places true if: 6 <= 6', function (assert) {
|
84
|
-
var o = WWW_App.run([
|
85
|
-
6, "less or equal", [ 6 ]
|
86
|
-
]);
|
87
|
-
assert.equal( o.right('last'), true);
|
88
|
-
});
|
89
|
-
|
90
|
-
QUnit.test('it places false if: 7 <= 6', function (assert) {
|
91
|
-
var o = WWW_App.run([
|
92
|
-
7, "less or equal", [ 6 ]
|
93
|
-
]);
|
94
|
-
assert.equal( o.right('last'), false);
|
95
|
-
});
|
96
|
-
|
97
|
-
QUnit.test('throws error if first num is not a number', function (assert) {
|
98
|
-
assert.throws(function () {
|
99
|
-
WWW_App.run([
|
100
|
-
'5', 'less or equal', [5]
|
101
|
-
]);
|
102
|
-
}, /Value in stack is not a Number: String: 5/);
|
103
|
-
});
|
104
|
-
|
105
|
-
QUnit.test('throws error if second num is not a number', function (assert) {
|
106
|
-
assert.throws(function () {
|
107
|
-
WWW_App.run([
|
108
|
-
5, 'less or equal', ["6"]
|
109
|
-
]);
|
110
|
-
}, /Value in args is not a Number: String: 6/);
|
111
|
-
});
|
112
|
-
|
113
|
-
|
114
|
-
// ==================================================================
|
115
|
-
QUnit.module("bigger or equal");
|
116
|
-
// ==================================================================
|
117
|
-
|
118
|
-
QUnit.test('it places true if: 6 >= 4', function (assert) {
|
119
|
-
var o = WWW_App.run([
|
120
|
-
6, "bigger or equal", [ 4 ]
|
121
|
-
]);
|
122
|
-
assert.equal( o.right('last'), true);
|
123
|
-
});
|
124
|
-
|
125
|
-
QUnit.test('it places true if: 6 >= 6', function (assert) {
|
126
|
-
var o = WWW_App.run([
|
127
|
-
6, "bigger or equal", [ 6 ]
|
128
|
-
]);
|
129
|
-
assert.equal( o.right('last'), true);
|
130
|
-
});
|
131
|
-
|
132
|
-
QUnit.test('it places false if: 6 >= 7', function (assert) {
|
133
|
-
var o = WWW_App.run([
|
134
|
-
6, "bigger or equal", [ 7 ]
|
135
|
-
]);
|
136
|
-
assert.equal( o.right('last'), false);
|
137
|
-
});
|
138
|
-
|
139
|
-
QUnit.test('throws error if first num is not a number', function (assert) {
|
140
|
-
assert.throws(function () {
|
141
|
-
WWW_App.run([
|
142
|
-
'3', 'bigger or equal', [5]
|
143
|
-
]);
|
144
|
-
}, /Value in stack is not a Number: String: 3/);
|
145
|
-
});
|
146
|
-
|
147
|
-
QUnit.test('throws error if second num is not a number', function (assert) {
|
148
|
-
assert.throws(function () {
|
149
|
-
WWW_App.run([
|
150
|
-
5, 'bigger or equal', ["9"]
|
151
|
-
]);
|
152
|
-
}, /Value in args is not a Number: String: 9/);
|
153
|
-
});
|
154
|
-
|
155
|
-
|
156
|
-
// ==================================================================
|
157
|
-
QUnit.module('bigger');
|
158
|
-
// ==================================================================
|
159
|
-
|
160
|
-
QUnit.test('it places true on stack if: 6 > 1', function (assert) {
|
161
|
-
var o = WWW_App.run([
|
162
|
-
6, 'bigger', [1]
|
163
|
-
]);
|
164
|
-
assert.equal(o.right('last'), true);
|
165
|
-
});
|
166
|
-
|
167
|
-
|
168
|
-
QUnit.test('it places false on stack if: 6 > 6', function (assert) {
|
169
|
-
var o = WWW_App.run([
|
170
|
-
6, 'bigger', [6]
|
171
|
-
]);
|
172
|
-
assert.equal(o.right('last'), false);
|
173
|
-
});
|
174
|
-
|
175
|
-
|
176
|
-
// ==================================================================
|
177
|
-
QUnit.module('less');
|
178
|
-
// ==================================================================
|
179
|
-
|
180
|
-
QUnit.test('it places true on stack if: 1 < 6', function (assert) {
|
181
|
-
var o = WWW_App.run([
|
182
|
-
1, 'less', [6]
|
183
|
-
]);
|
184
|
-
assert.equal(o.right('last'), true);
|
185
|
-
});
|
186
|
-
|
187
|
-
|
188
|
-
QUnit.test('it places false on stack if: 6 < 6', function (assert) {
|
189
|
-
var o = WWW_App.run([
|
190
|
-
6, 'less', [6]
|
191
|
-
]);
|
192
|
-
assert.equal(o.right('last'), false);
|
193
|
-
});
|
194
|
-
|
195
|
-
QUnit.test('it places false on stack if: 6 < 1', function (assert) {
|
196
|
-
var o = WWW_App.run([
|
197
|
-
6, 'less', [1]
|
198
|
-
]);
|
199
|
-
assert.equal(o.right('last'), false);
|
200
|
-
});
|
201
|
-
|
202
|
-
|
203
|
-
// ==================================================================
|
204
|
-
QUnit.module('equal');
|
205
|
-
// ==================================================================
|
206
|
-
|
207
|
-
QUnit.test('it places true on stack if: 1 === 1', function (assert) {
|
208
|
-
var o = WWW_App.run([
|
209
|
-
1, 'equal', [1]
|
210
|
-
]);
|
211
|
-
assert.equal(o.right('last'), true);
|
212
|
-
});
|
213
|
-
|
214
|
-
QUnit.test('it places true on stack if: \'a\' === \'a\'', function (assert) {
|
215
|
-
var o = WWW_App.run([
|
216
|
-
"a", 'equal', ["a"]
|
217
|
-
]);
|
218
|
-
assert.equal(o.right('last'), true);
|
219
|
-
});
|
220
|
-
|
221
|
-
QUnit.test('it places false on stack if: \'5\' === 5', function (assert) {
|
222
|
-
var o = WWW_App.run([
|
223
|
-
"5", 'equal', [5]
|
224
|
-
]);
|
225
|
-
assert.equal(o.right('last'), false);
|
226
|
-
});
|
227
|
-
|
228
|
-
|
229
|
-
QUnit.test('it places false on stack if: 6 === \'6\'', function (assert) {
|
230
|
-
var o = WWW_App.run([
|
231
|
-
6, 'equal', ["6"]
|
232
|
-
]);
|
233
|
-
assert.equal(o.right('last'), false);
|
234
|
-
});
|
235
|
-
|
236
|
-
|
237
|
-
// ==================================================================
|
238
|
-
QUnit.module('and');
|
239
|
-
// ==================================================================
|
240
|
-
|
241
|
-
QUnit.test('throws error if last value on stack is not a bool', function (assert) {
|
242
|
-
assert.throws(function () {
|
243
|
-
var o = WWW_App.run([
|
244
|
-
1, 'and', [true]
|
245
|
-
]);
|
246
|
-
}, /Value in stack is not a Boolean: Number: 1/);
|
247
|
-
});
|
248
|
-
|
249
|
-
QUnit.test('throws if last value of args is not a bool', function (assert) {
|
250
|
-
assert.throws(function () {
|
251
|
-
var o = WWW_App.run([
|
252
|
-
true, 'and', [2]
|
253
|
-
]);
|
254
|
-
}, /Value in args is not a Boolean: Number: 2/);
|
255
|
-
});
|
256
|
-
|
257
|
-
QUnit.test('it places true on stack if both conditions are true', function (assert) {
|
258
|
-
var o = WWW_App.run([
|
259
|
-
true, 'and', [6, 'equal', [6]]
|
260
|
-
]);
|
261
|
-
assert.equal(o.right('last'), true);
|
262
|
-
});
|
263
|
-
|
264
|
-
QUnit.test('it places false on stack if first condition is false', function (assert) {
|
265
|
-
var o = WWW_App.run([
|
266
|
-
false, 'and', [6, 'equal', [6]]
|
267
|
-
]);
|
268
|
-
assert.deepEqual(o.right('all'), [false, false]);
|
269
|
-
});
|
270
|
-
|
271
|
-
QUnit.test('it places false on stack if second condition is false', function (assert) {
|
272
|
-
var o = WWW_App.run([
|
273
|
-
true, 'and', [6, 'equal', [7]]
|
274
|
-
]);
|
275
|
-
assert.deepEqual(o.right('all'), [true, false]);
|
276
|
-
});
|
277
|
-
|
278
|
-
QUnit.test('does not evaluate args if right-hand value is false', function (assert) {
|
279
|
-
var o = WWW_App.run([
|
280
|
-
false, 'and', ['unknown method', []]
|
281
|
-
]);
|
282
|
-
assert.deepEqual(o.right('all'), [false, false]);
|
283
|
-
});
|
284
|
-
|
285
|
-
|
286
|
-
// ==================================================================
|
287
|
-
QUnit.module('or');
|
288
|
-
// ==================================================================
|
289
|
-
|
290
|
-
QUnit.test('it throws an error if first condition is not a bool', function (assert) {
|
291
|
-
assert.throws(function () {
|
292
|
-
WWW_App.run(["something", 'or', [false]]);
|
293
|
-
}, /Value in stack is not a Boolean: String: something/);
|
294
|
-
});
|
295
|
-
|
296
|
-
QUnit.test('it throws an error if second condition is not a bool', function (assert) {
|
297
|
-
assert.throws(function () {
|
298
|
-
WWW_App.run([false, 'or', [false, "something"]]);
|
299
|
-
}, /Value in args is not a Boolean: String: something/);
|
300
|
-
});
|
301
|
-
|
302
|
-
QUnit.test('it places true on stack if both conditions are true', function (assert) {
|
303
|
-
var o = WWW_App.run([
|
304
|
-
true, 'or', [6, 'equal', [6]]
|
305
|
-
]);
|
306
|
-
assert.deepEqual(o.right('all'), [true, true]);
|
307
|
-
});
|
308
|
-
|
309
|
-
QUnit.test('it places true on stack if: true or false', function (assert) {
|
310
|
-
var o = WWW_App.run([
|
311
|
-
true, 'or', [9, 'equal', [6]]
|
312
|
-
]);
|
313
|
-
assert.deepEqual(o.right('all'), [true, true]);
|
314
|
-
});
|
315
|
-
|
316
|
-
QUnit.test('it places true on stack if: false or true', function (assert) {
|
317
|
-
var o = WWW_App.run([
|
318
|
-
false, 'or', [9, 'equal', [9]]
|
319
|
-
]);
|
320
|
-
assert.deepEqual(o.right('all'), [false, true]);
|
321
|
-
});
|
322
|
-
|
323
|
-
QUnit.test('does not evaluate args if first condition is true', function (assert) {
|
324
|
-
var o = WWW_App.run([
|
325
|
-
true, 'or', ['no known method', []]
|
326
|
-
]);
|
327
|
-
assert.deepEqual(o.right('all'), [true, true]);
|
328
|
-
});
|
329
|
-
|
330
|
-
|
331
|
-
// ==================================================================
|
332
|
-
QUnit.module('if true');
|
333
|
-
// ==================================================================
|
334
|
-
|
335
|
-
QUnit.test('throws an error if righ hand value is not a bool', function (assert) {
|
336
|
-
assert.throws(function () {
|
337
|
-
WWW_App.run([
|
338
|
-
6, "if true", [5]
|
339
|
-
]);
|
340
|
-
}, /Value in stack is not a Boolean: Number: 6/);
|
341
|
-
});
|
342
|
-
|
343
|
-
QUnit.test('does not place a value on stack', function (assert) {
|
344
|
-
var o = WWW_App.run([
|
345
|
-
true, "if true", [
|
346
|
-
100
|
347
|
-
]
|
348
|
-
]);
|
349
|
-
|
350
|
-
assert.deepEqual(o.right('all'), [true]);
|
351
|
-
});
|
352
|
-
|
353
|
-
QUnit.test('does not run tokens if stack value is false', function (assert) {
|
354
|
-
var o = WWW_App.run([
|
355
|
-
false, "if true", [
|
356
|
-
"something unknown", []
|
357
|
-
]
|
358
|
-
]);
|
359
|
-
|
360
|
-
assert.deepEqual(o.right('all'), [false]);
|
361
|
-
});
|
362
|
-
|
363
|
-
|
364
|
-
// ==================================================================
|
365
|
-
QUnit.module('if false');
|
366
|
-
// ==================================================================
|
367
|
-
|
368
|
-
QUnit.test('throws an error if righ hand value is not a bool', function (assert) {
|
369
|
-
assert.throws(function () {
|
370
|
-
WWW_App.run([
|
371
|
-
7, "if false", [5]
|
372
|
-
]);
|
373
|
-
}, /Value in stack is not a Boolean: Number: 7/);
|
374
|
-
});
|
375
|
-
|
376
|
-
QUnit.test('does not place a value on stack', function (assert) {
|
377
|
-
var o = WWW_App.run([
|
378
|
-
false, "if false", [ 100 ]
|
379
|
-
]);
|
380
|
-
|
381
|
-
assert.deepEqual(o.right('all'), [false]);
|
382
|
-
});
|
383
|
-
|
384
|
-
QUnit.test('does not run tokens if stack value is true', function (assert) {
|
385
|
-
var o = WWW_App.run([
|
386
|
-
true, "if false", [ "something unknown", [] ]
|
387
|
-
]);
|
388
|
-
|
389
|
-
assert.deepEqual(o.right('all'), [true]);
|
390
|
-
});
|
391
43
|
|
392
44
|
|
393
45
|
// ==================================================================
|
394
|
-
|
46
|
+
describe('on click button');
|
395
47
|
// ==================================================================
|
396
48
|
|
397
|
-
|
49
|
+
it('only runs specified callback', function (assert) {
|
398
50
|
|
399
51
|
$('#event').html(
|
400
52
|
'\
|
@@ -407,7 +59,7 @@ QUnit.test('only runs specified callback', function (assert) {
|
|
407
59
|
'
|
408
60
|
);
|
409
61
|
|
410
|
-
var event =
|
62
|
+
var event = iii.run([
|
411
63
|
'/red/div.the_box', 'does', [ 'add class', ['red'] ],
|
412
64
|
'/red/div.the_box', 'does', [ 'add class', ['red_two'] ],
|
413
65
|
'/blue/div.the_box', 'does', [ 'unknown func', ['blue'] ],
|
@@ -419,7 +71,7 @@ QUnit.test('only runs specified callback', function (assert) {
|
|
419
71
|
|
420
72
|
}); // === only runs one callback
|
421
73
|
|
422
|
-
|
74
|
+
it('adds event to element', function (assert) {
|
423
75
|
|
424
76
|
$('#event').html(
|
425
77
|
'\
|
@@ -432,7 +84,7 @@ QUnit.test('adds event to element', function (assert) {
|
|
432
84
|
'
|
433
85
|
);
|
434
86
|
|
435
|
-
var event =
|
87
|
+
var event = iii.run([
|
436
88
|
'/red/div.the_box', 'does', [ 'add class', ['red'] ],
|
437
89
|
'/blue/div.the_box', 'does', [ 'reove class', ['red'], 'ad clss', ['blue'] ],
|
438
90
|
]); // ======================
|
@@ -444,10 +96,10 @@ QUnit.test('adds event to element', function (assert) {
|
|
444
96
|
|
445
97
|
|
446
98
|
// ==================================================================
|
447
|
-
|
99
|
+
describe('on click "a" link');
|
448
100
|
// ==================================================================
|
449
101
|
|
450
|
-
|
102
|
+
it('adds event to element', function (assert) {
|
451
103
|
|
452
104
|
$('#event').html(
|
453
105
|
'\
|
@@ -460,7 +112,7 @@ QUnit.test('adds event to element', function (assert) {
|
|
460
112
|
'
|
461
113
|
);
|
462
114
|
|
463
|
-
var event =
|
115
|
+
var event = iii.run([
|
464
116
|
'/white/div.the_box', 'does', [ 'add class', ['white'] ]
|
465
117
|
]); // ======================
|
466
118
|
|
@@ -471,10 +123,10 @@ QUnit.test('adds event to element', function (assert) {
|
|
471
123
|
|
472
124
|
|
473
125
|
// ==================================================================
|
474
|
-
|
126
|
+
describe('allow (event)');
|
475
127
|
// ==================================================================
|
476
128
|
|
477
|
-
|
129
|
+
it('adds event to element', function (assert) {
|
478
130
|
|
479
131
|
$('#event').html(
|
480
132
|
'\
|
@@ -486,7 +138,7 @@ QUnit.test('adds event to element', function (assert) {
|
|
486
138
|
'
|
487
139
|
);
|
488
140
|
|
489
|
-
var event =
|
141
|
+
var event = iii.run([
|
490
142
|
'div.the_box div.blue', 'allows', [ 'mousedown' ],
|
491
143
|
'/blue/div.the_box', 'does', [ 'add class', ['blue'] ]
|
492
144
|
]); // ======================
|
@@ -496,7 +148,7 @@ QUnit.test('adds event to element', function (assert) {
|
|
496
148
|
|
497
149
|
}); // === adds event to element
|
498
150
|
|
499
|
-
|
151
|
+
it('runs multiple defined "does"', function (assert) {
|
500
152
|
|
501
153
|
$('#event').html(
|
502
154
|
'\
|
@@ -508,7 +160,7 @@ QUnit.test('runs multiple defined "does"', function (assert) {
|
|
508
160
|
'
|
509
161
|
);
|
510
162
|
|
511
|
-
var event =
|
163
|
+
var event = iii.run([
|
512
164
|
'div.the_box div.orange', 'allows', [ 'mousedown' ],
|
513
165
|
'/orange/div.the_box', 'does', [ 'add class', ['orange'] ],
|
514
166
|
'/orange/div.the_box', 'does', [ 'add class', ['white'] ],
|
@@ -519,7 +171,7 @@ QUnit.test('runs multiple defined "does"', function (assert) {
|
|
519
171
|
assert.equal($('#event div.the_box').attr('class'), 'the_box orange white black');
|
520
172
|
});
|
521
173
|
|
522
|
-
|
174
|
+
it('is ignored if called before on the same element', function (assert) {
|
523
175
|
$('#event').html(
|
524
176
|
'\
|
525
177
|
<div class="the_box"> \
|
@@ -530,7 +182,7 @@ QUnit.test('is ignored if called before on the same element', function (assert)
|
|
530
182
|
'
|
531
183
|
);
|
532
184
|
|
533
|
-
var event =
|
185
|
+
var event = iii.run([
|
534
186
|
'div.the_box', 'allows', ['click'],
|
535
187
|
'div.the_box', 'allows', ['click'],
|
536
188
|
'div.the_box', 'allows', ['click'],
|
@@ -542,7 +194,7 @@ QUnit.test('is ignored if called before on the same element', function (assert)
|
|
542
194
|
assert.equal($('#event div.the_box div').length, 2);
|
543
195
|
});
|
544
196
|
|
545
|
-
|
197
|
+
it('runs "does" on child elements of event target', function (assert) {
|
546
198
|
|
547
199
|
$('#event').html(
|
548
200
|
'\
|
@@ -556,7 +208,7 @@ QUnit.test('runs "does" on child elements of event target', function (assert) {
|
|
556
208
|
'
|
557
209
|
);
|
558
210
|
|
559
|
-
var event =
|
211
|
+
var event = iii.run([
|
560
212
|
'div.the_box div.grey', 'allows', [ 'mousedown' ],
|
561
213
|
'/grey/div.child', 'does', [ 'add class', ['one'] ],
|
562
214
|
'/grey/div.child', 'does', [ 'add class', ['two'] ]
|
@@ -566,7 +218,7 @@ QUnit.test('runs "does" on child elements of event target', function (assert) {
|
|
566
218
|
assert.equal($('#event div.the_box div.grey div.child').attr('class'), 'child one two');
|
567
219
|
});
|
568
220
|
|
569
|
-
|
221
|
+
it('runs "does" on event target itself: /grey', function (assert) {
|
570
222
|
|
571
223
|
$('#event').html(
|
572
224
|
'\
|
@@ -580,7 +232,7 @@ QUnit.test('runs "does" on event target itself: /grey', function (assert) {
|
|
580
232
|
'
|
581
233
|
);
|
582
234
|
|
583
|
-
var event =
|
235
|
+
var event = iii.run([
|
584
236
|
'div.the_box div.grey', 'allows', [ 'mousedown' ],
|
585
237
|
'/grey', 'does', [ 'add class', ['three'] ],
|
586
238
|
'/grey', 'does', [ 'add class', ['four'] ]
|
@@ -590,7 +242,7 @@ QUnit.test('runs "does" on event target itself: /grey', function (assert) {
|
|
590
242
|
assert.equal($('#event div.the_box div.grey').attr('class'), 'grey three four');
|
591
243
|
});
|
592
244
|
|
593
|
-
|
245
|
+
it('accepts path with /event_name/target/selector', function (assert) {
|
594
246
|
|
595
247
|
$('#event').html(
|
596
248
|
'\
|
@@ -601,7 +253,7 @@ QUnit.test('accepts path with /event_name/target/selector', function (assert) {
|
|
601
253
|
'
|
602
254
|
);
|
603
255
|
|
604
|
-
var event =
|
256
|
+
var event = iii.run([
|
605
257
|
'div.the_box div.grey', 'allows', [ 'mousedown' ],
|
606
258
|
'/mousedown/div.grey:first/div.the_box', 'does', [ 'add class', ['one'] ],
|
607
259
|
'/mousedown/div.grey:last/div.the_box', 'does', [ 'add class', ['two'] ]
|
@@ -615,24 +267,24 @@ QUnit.test('accepts path with /event_name/target/selector', function (assert) {
|
|
615
267
|
});
|
616
268
|
|
617
269
|
// ==================================================================
|
618
|
-
|
270
|
+
describe('forms');
|
619
271
|
// ==================================================================
|
620
272
|
|
621
|
-
|
273
|
+
it('throws error if url contains invalid char: :', function (assert) {
|
622
274
|
$('#form_1').attr('action', 'javascrip://alert');
|
623
275
|
assert.throws(function () {
|
624
276
|
$('#form_1 button.submit').trigger('click');
|
625
277
|
}, /Invalid chars in form action url: :/);
|
626
278
|
});
|
627
279
|
|
628
|
-
|
280
|
+
it('throws error if url contains invalid char: &', function (assert) {
|
629
281
|
$('#form_1').attr('action', 'javascript&//alert');
|
630
282
|
assert.throws(function () {
|
631
283
|
$('#form_1 button.submit').trigger('click');
|
632
284
|
}, /Invalid chars in form action url: &/);
|
633
285
|
});
|
634
286
|
|
635
|
-
|
287
|
+
it('throws error if url contains invalid char: ;', function (assert) {
|
636
288
|
$('#form_1').attr('action', 'http;amp//alert');
|
637
289
|
assert.throws(function () {
|
638
290
|
$('#form_1 button.submit').trigger('click');
|
@@ -645,7 +297,7 @@ QUnit.asyncTest('submits form values', function (assert) {
|
|
645
297
|
|
646
298
|
$('#form_1').attr('action', '/repeat/vals');
|
647
299
|
|
648
|
-
var env =
|
300
|
+
var env = iii.run([
|
649
301
|
'/success/#form_1', 'does', [
|
650
302
|
'log', ['get', ['data']]
|
651
303
|
]
|
@@ -668,7 +320,7 @@ QUnit.asyncTest('submits form values', function (assert) {
|
|
668
320
|
QUnit.asyncTest('displays success msg', function (assert) {
|
669
321
|
expect(1);
|
670
322
|
$('#form_1').attr('action', '/repeat/success_msg');
|
671
|
-
var env =
|
323
|
+
var env = iii.run([]);
|
672
324
|
|
673
325
|
|
674
326
|
var has_class = function () {
|
@@ -688,7 +340,7 @@ QUnit.asyncTest('displays success msg', function (assert) {
|
|
688
340
|
QUnit.asyncTest('displays error msg', function (assert) {
|
689
341
|
expect(1);
|
690
342
|
$('#form_1').attr('action', '/repeat/error_msg');
|
691
|
-
var env =
|
343
|
+
var env = iii.run([]);
|
692
344
|
|
693
345
|
|
694
346
|
var has_class = function () {
|
@@ -706,7 +358,7 @@ QUnit.asyncTest('displays error msg', function (assert) {
|
|
706
358
|
|
707
359
|
|
708
360
|
// ==================================================================
|
709
|
-
|
361
|
+
describe("looping getting/inserting of partials");
|
710
362
|
// ==================================================================
|
711
363
|
|
712
364
|
QUnit.asyncTest('inserts status on top of parent', function (assert) {
|
@@ -720,7 +372,7 @@ QUnit.asyncTest('inserts status on top of parent', function (assert) {
|
|
720
372
|
'
|
721
373
|
);
|
722
374
|
|
723
|
-
var loop =
|
375
|
+
var loop = iii.run([]);
|
724
376
|
|
725
377
|
var items_status = function () {
|
726
378
|
return $('div.the_box div.items_status');
|
@@ -750,7 +402,7 @@ QUnit.asyncTest('removes status element after showing them', function (assert) {
|
|
750
402
|
'
|
751
403
|
);
|
752
404
|
|
753
|
-
var loop =
|
405
|
+
var loop = iii.run([]);
|
754
406
|
|
755
407
|
var items_status = function () {
|
756
408
|
return $('div.the_box div.items_status');
|