corrade-nucleus-nucleons – Blame information for rev 37

Subversion Repositories:
Rev:
Rev Author Line No. Line
37 office 1 (function (root, factory) {
2 'use strict';
3  
4 if (typeof module === 'object' && module.exports) {
5 // Node. Does not work with strict CommonJS, but only CommonJS-like
6 // environments that support module.exports, like Node.
7 factory(require('./x2js'), require('qunit-cli'));
8 } else {
9 // Browser globals (root is window)
10 factory(root.X2JS, root.QUnit);
11 }
12 })(this, function (X2JS, QUnit) {
13 'use strict';
14  
15 QUnit.module('Funky tests');
16  
17 QUnit.test('asArray() converts to array', function (assert) {
18 var x = new X2JS();
19  
20 // It preserves existing arrays.
21 assert.propEqual(x.asArray([1, 2, 3]), [1, 2, 3]);
22  
23 // And converts anything else.
24 assert.propEqual(x.asArray('stringvalue'), ['stringvalue']);
25 assert.propEqual(x.asArray({}), [{}]);
26 assert.propEqual(x.asArray(''), ['']);
27  
28 // Except some things, which are turned into empty arrays just because.
29 assert.propEqual(x.asArray(null), []);
30 assert.propEqual(x.asArray(undefined), []);
31 });
32 });