├── .gitignore ├── riotjs.html ├── test.js ├── README.textile └── riot.js /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | -------------------------------------------------------------------------------- /riotjs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Riot 5 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /test.js: -------------------------------------------------------------------------------- 1 | var Riot; 2 | if (typeof load !== 'undefined') { 3 | load('riot.js'); 4 | } else if (typeof require !== 'undefined') { 5 | Riot = require('./riot').Riot; 6 | } 7 | 8 | Riot.run(function() { 9 | context('1. Basic riot functionality', function() { 10 | given('1.1 some simple equality tests', function() { 11 | setup(function() { 12 | return true; 13 | }); 14 | 15 | asserts('a simple truth test should return true', true).isTrue(); 16 | asserts('a false test returns false', false).isFalse(); 17 | asserts('isNull is null', null).isNull(); 18 | asserts('no chained test expected a value', true); 19 | }); 20 | 21 | given('1.1.2 some string tests', function() { 22 | should('compare strings with equals', 'test string').equals('test string'); 23 | should('match expressions with matches', 'test').matches(/test/); 24 | }); 25 | 26 | given('1.1.3 a context concerned with functions', function() { 27 | asserts('asserts() should allow functions to be compared', function() { 28 | return 'test string'; 29 | }).equals('test string'); 30 | }); 31 | 32 | given('1.1.4 an example that requires a variable', function() { 33 | var user = { name: 'Grumble' }; 34 | 35 | should('get evaluated before the assertions', user.name).equals('Grumble'); 36 | }); 37 | 38 | given('1.1.5 some objects that need type checks', function() { 39 | asserts('a string should be a String', 'String').kindOf('String'); 40 | asserts('an array should be an Array', [1, 2, 3]).kindOf('Array'); 41 | asserts('an array should be an Array', null).typeOf('null'); 42 | }); 43 | 44 | given('1.1.6 some exceptions', function() { 45 | asserts('this should raise ExampleError', function() { throw('ExampleError'); }).raises('ExampleError'); 46 | }); 47 | }); 48 | 49 | context('1.2. Equality', function() { 50 | given('1.2.1. isEqual()', function () { 51 | should('return falsy when an empty object is supplied as the first param', function() { 52 | return ! Riot.Assertion.prototype.isEqual({}, {a: 'a', b: 'b'}); 53 | }).isTrue(); 54 | }); 55 | }); 56 | 57 | context('1.3 Yet another context', function() { 58 | asserts('equals should compare strings as expected', 'test string').equals('test string'); 59 | }); 60 | 61 | context('1.4 End', function() { 62 | asserts('this test should appear at the end', true); 63 | }); 64 | }); 65 | -------------------------------------------------------------------------------- /README.textile: -------------------------------------------------------------------------------- 1 | This is a JavaScript implementation of "Riot":http://github.com/thumblemonks/riot/. 2 | 3 | It will run in a browser, Rhino, or Node. 4 | 5 | h3. Example 6 | 7 | Tests look like this: 8 | 9 |
 10 | Riot.run(function() {
 11 |   context('basic riot functionality', function() {
 12 |     given('some simple equality tests', function() {
 13 |       asserts('a simple truth test should return true', true).isTrue();
 14 |       asserts('isNull is null', null).isNull();
 15 |     });
 16 | 
 17 |     given('another context', function() {
 18 |       asserts('equals should compare strings as expected', 'test string').equals('test string');
 19 |     });
 20 | 
 21 |     given('a context concerned with functions', function() {
 22 |       asserts('asserts() should allow functions to be compared', function() {
 23 |         return 'test string';
 24 |       }).equals('test string');
 25 |     });
 26 |   });
 27 | 
 28 |   given('yet another context', function() {
 29 |     asserts('equals should compare strings as expected', 'test string').equals('test string');
 30 |   });
 31 | });
 32 | 
33 | 34 | There are a few aliases to make tests (and output) read more naturally: 35 | 36 | * context: given -- Given will add "Given..." to the title in the test output 37 | * asserts: should 38 | 39 | h3. Assertions 40 | 41 | * equals - for example, asserts('description').equals('value') 42 | * matches - matches a regex 43 | * typeOf - aliased to isTypeOf, kindOf 44 | * isNull 45 | * isTrue 46 | * raises 47 | 48 | h3. Riot.run 49 | 50 | Riot.run(function() { // your tests }); just adds your tests to window.onload. If there's already an onload handler it won't add itself. If there's no window it will just run the tests. 51 | 52 | Riot.load() can be used to load required scripts in a browser or interpreter. Riot.require() only loads files once by keeping a record of files that have already been loaded. 53 | 54 | It can also be called with no parameters to run tests defined with Riot.context. This can be used to create a set of files with tests inside a Riot.context for each file 55 | 56 | h3. Packaging 57 | 58 | Packaged as a RubyGem usable via "XPCOMCore-RubyGems":http://github.com/conflagrationjs/xpcomcore-rubygem -- "riotjs-xpcc":http://github.com/conflagrationjs/riotjs-xpcc. 59 | 60 | h3. Writing a test for a browser AND interpreter 61 | 62 | My current pattern looks like this: 63 | 64 |
 65 | var Riot;
 66 | if (typeof load !== 'undefined') {
 67 |   load('riot.js');
 68 | } else if (typeof require !== 'undefined') {
 69 |   Riot = require('./riot').Riot;
 70 | }
 71 | 
 72 | Riot.require('../turing.core.js');
 73 | Riot.require('../turing.oo.js');
 74 | Riot.require('fixtures/example_classes.js');  
 75 | 
 76 | Riot.context('turing.oo.js', function() {
 77 |   // Tests go here
 78 | });
 79 | 
 80 | Riot.run();
 81 | 
82 | 83 |
 84 | 
 85 | 
 86 |   
 87 |     Riot
 88 |     
 93 |     
 94 |     
 95 |     
 96 |   
 97 |   
 98 |     
99 | 100 | 101 |
102 | 103 | Note: 104 | 105 | * load() is no-op'd in browsers if it doesn't exist by Riot 106 | * Riot.run() will only run once, so you can include multiple Riot test files 107 | * Specifying Riot.run() at the end of each test file lets you run that file with js Riot.run() in the console 108 | 109 | h3. Contributors 110 | 111 | * ac94 (Aron Carroll) 112 | * bgerrissen (Ben Gerrissen) 113 | 114 | -------------------------------------------------------------------------------- /riot.js: -------------------------------------------------------------------------------- 1 | /*jslint white: false plusplus: false onevar: false browser: true evil: true*/ 2 | /*riotGlobal window: true*/ 3 | (function(riotGlobal) { 4 | var Riot = { 5 | results: [], 6 | contexts: [], 7 | 8 | run: function(tests) { 9 | switch (Riot.detectEnvironment()) { 10 | case 'xpcomcore': 11 | Riot.formatter = new Riot.Formatters.XPComCore(); 12 | Riot.runAndReport(tests); 13 | Sys.exit(Riot.exitCode); 14 | break; 15 | 16 | case 'rhino': 17 | Riot.formatter = new Riot.Formatters.Text(); 18 | Riot.runAndReport(tests); 19 | java.lang.System.exit(Riot.exitCode); 20 | break; 21 | 22 | case 'node': 23 | Riot.formatter = new Riot.Formatters.Text(); 24 | Riot.runAndReport(tests); 25 | // TODO: exit with exit code from riot 26 | break; 27 | 28 | case 'non-browser-interpreter': 29 | Riot.formatter = new Riot.Formatters.Text(); 30 | Riot.runAndReport(tests); 31 | if (typeof quit !== 'undefined') { 32 | quit(Riot.exitCode); 33 | } 34 | break; 35 | 36 | case 'browser': 37 | Riot.formatter = new Riot.Formatters.HTML(); 38 | if (typeof window.onload === 'undefined' || window.onload == null) { 39 | Riot.browserAutoLoad(tests); 40 | } 41 | break; 42 | } 43 | }, 44 | 45 | browserAutoLoad: function(tests) { 46 | var timer; 47 | function fireContentLoadedEvent() { 48 | if (document.loaded) return; 49 | if (timer) window.clearTimeout(timer); 50 | document.loaded = true; 51 | 52 | if (Riot.requiredFiles.length > 0) { 53 | Riot.loadBrowserScripts(Riot.requiredFiles, tests); 54 | } else { 55 | Riot.runAndReport(tests); 56 | } 57 | } 58 | 59 | function checkReadyState() { 60 | if (document.readyState === 'complete') { 61 | document.detachEvent('readystatechange', checkReadyState); 62 | fireContentLoadedEvent(); 63 | } 64 | } 65 | 66 | function pollDoScroll() { 67 | try { document.documentElement.doScroll('left'); } 68 | catch(e) { 69 | timer = setTimeout(pollDoScroll, 10); 70 | return; 71 | } 72 | fireContentLoadedEvent(); 73 | } 74 | 75 | if (document.addEventListener) { 76 | document.addEventListener('DOMContentLoaded', fireContentLoadedEvent, false); 77 | } else { 78 | document.attachEvent('readystatechange', checkReadyState); 79 | if (window == top) 80 | timer = setTimeout(pollDoScroll, 10); 81 | } 82 | 83 | window.onload = fireContentLoadedEvent; 84 | }, 85 | 86 | loadBrowserScripts: function(files, tests) { 87 | var i, file; 88 | 89 | function loadBrowserScript(src, callback) { 90 | var script = document.createElement('script'), 91 | head = document.getElementsByTagName('head')[0], 92 | readyState; 93 | script.setAttribute('type', 'text/javascript'); 94 | script.setAttribute('src', src); 95 | script.onload = script.onreadystatechange = function() { 96 | if (!(readyState = script.readyState) || /loaded|complete/.test(readyState)) { 97 | script.onload = script.onreadystatechange = null; 98 | head.removeChild(script); 99 | if (callback) { 100 | setTimeout(callback, 1); 101 | } 102 | } 103 | }; 104 | 105 | head.insertBefore(script, head.firstChild); 106 | } 107 | 108 | if (files.length > 1) { 109 | file = files[0]; 110 | loadBrowserScript(file, function() { Riot.loadBrowserScripts(files.slice(1), tests); }); 111 | } else { 112 | file = files[0]; 113 | loadBrowserScript(file, function() { Riot.runAndReport(tests); }); 114 | } 115 | }, 116 | 117 | load: function() { 118 | switch (Riot.detectEnvironment()) { 119 | case 'xpcomcore': 120 | case 'rhino': 121 | case 'non-browser-interpreter': 122 | load(arguments[0]); 123 | break; 124 | case 'node': 125 | // Evaluate the required code in the global context, like load() would 126 | global.eval.call(global, Riot.node.fs.readFileSync(arguments[0]).toString()); 127 | break; 128 | case 'browser': 129 | var script = document.createElement('script'), 130 | head = document.getElementsByTagName('head'); 131 | script.setAttribute('type', 'text/javascript'); 132 | script.setAttribute('src', arguments[0]); 133 | head[0].insertBefore(script, head.firstChild); 134 | break; 135 | } 136 | }, 137 | 138 | requiredFiles: [], 139 | 140 | indexOf: function(array, value) { 141 | for (var i = 0; i < array.length; i++) { 142 | if (array[i] === value) { 143 | return i; 144 | } 145 | } 146 | return -1; 147 | }, 148 | 149 | require: function() { 150 | if (this.indexOf(this.requiredFiles, arguments[0]) == -1) { 151 | this.requiredFiles.push(arguments[0]); 152 | if (Riot.detectEnvironment() !== 'browser') { 153 | this.load(arguments[0]); 154 | } 155 | } 156 | }, 157 | 158 | detectEnvironment: function() { 159 | if (typeof this.env !== 'undefined') { 160 | return this.env; 161 | } 162 | 163 | this.env = (function() { 164 | if (typeof XPCOMCore !== 'undefined') { 165 | Riot.puts = print; 166 | return 'xpcomcore'; 167 | } else if (typeof window === 'undefined' && typeof java !== 'undefined') { 168 | Riot.puts = print; 169 | return 'rhino'; 170 | } else if (typeof exports !== 'undefined') { 171 | // TODO: Node should be checked more thoroughly 172 | Riot.node = { 173 | fs: require('fs'), 174 | sys: require('sys') 175 | } 176 | 177 | Riot.puts = Riot.node.sys.puts; 178 | 179 | return 'node'; 180 | } else if (typeof window === 'undefined') { 181 | Riot.puts = print; 182 | return 'non-browser-interpreter'; 183 | } else { 184 | return 'browser'; 185 | } 186 | })(); 187 | 188 | return this.env; 189 | }, 190 | 191 | runAndReport: function(tests) { 192 | this.running = true; 193 | var benchmark = Riot.Benchmark.run(1, function() { Riot.runAllContexts(tests); }); 194 | Riot.formatter.separator(); 195 | Riot.summariseAllResults(); 196 | Riot.formatter.line(benchmark); 197 | this.running = false; 198 | }, 199 | 200 | runAllContexts: function(tests) { 201 | if (typeof tests !== 'undefined') { 202 | this.withDSL(tests)(); 203 | } 204 | 205 | for (var i = 0; i < this.contexts.length; i++) { 206 | this.contexts[i].run(); 207 | } 208 | }, 209 | 210 | functionBody: function(fn) { 211 | return '(' + fn.toString().replace(/\s+$/, '') + ')()'; 212 | }, 213 | 214 | withDSL: function(fn, context) { 215 | var body = this.functionBody(fn), 216 | f = new Function('context', 'given', 'asserts', 'should', 'setup', 'teardown', body), 217 | args = [ 218 | Riot.context, 219 | Riot.given, 220 | function() { return context.asserts.apply(context, arguments); }, 221 | function() { return context.should.apply(context, arguments); }, 222 | function() { return context.setup.apply(context, arguments); }, 223 | function() { return context.teardown.apply(context, arguments); } 224 | ]; 225 | 226 | return function() { f.apply(Riot, args); }; 227 | }, 228 | 229 | context: function(title, callback) { 230 | var context = new Riot.Context(title, callback); 231 | 232 | if (this.running) { 233 | context.run(); 234 | } else { 235 | Riot.contexts.push(context); 236 | } 237 | 238 | return context; 239 | }, 240 | 241 | given: function(title, callback) { 242 | title = 'Given ' + title; 243 | return Riot.context(title, callback); 244 | }, 245 | 246 | summariseAllResults: function() { return this.summarise(this.results); }, 247 | 248 | summarise: function(results) { 249 | var failures = 0; 250 | for (var i = 0; i < results.length; i++) { 251 | if (!results[i].pass) { failures++; } 252 | } 253 | this.formatter.line(results.length + ' assertions: ' + failures + ' failures'); 254 | this.exitCode = failures > 0 ? 1 : 0; 255 | }, 256 | 257 | addResult: function(context, assertion, pass) { 258 | var result = { 259 | assertion: assertion, 260 | pass: pass, 261 | context: context 262 | }; 263 | this.results.push(result); 264 | } 265 | }; 266 | 267 | Riot.Benchmark = { 268 | results: [], 269 | 270 | addResult: function(start, end) { 271 | this.results.push(end - start); 272 | }, 273 | 274 | displayResults: function() { 275 | var total = 0, 276 | seconds = 0, 277 | i = 0; 278 | for (i = 0; i < this.results.length; i++) { 279 | total += this.results[i]; 280 | } 281 | seconds = total / 1000; 282 | return 'Elapsed time: ' + total + 'ms (' + seconds + ' seconds)'; 283 | }, 284 | 285 | run: function(times, callback) { 286 | this.results = []; 287 | for (var i = 0; i < times; i++) { 288 | var start = new Date(), 289 | end = null; 290 | callback(); 291 | end = new Date(); 292 | this.addResult(start, end); 293 | } 294 | return this.displayResults(); 295 | } 296 | }; 297 | 298 | Riot.Formatters = { 299 | HTML: function() { 300 | function display(html) { 301 | var results = document.getElementById('test-results'); 302 | results.innerHTML += html; 303 | } 304 | 305 | this.line = function(text) { 306 | display('

' + text + '

'); 307 | }; 308 | 309 | this.pass = function(message) { 310 | display('

' + message + '

'); 311 | }; 312 | 313 | this.fail = function(message) { 314 | display('

' + message + '

'); 315 | }; 316 | 317 | this.error = function(message, exception) { 318 | this.fail(message); 319 | display('

Exception: ' + exception + '

'); 320 | }; 321 | 322 | this.context = function(name) { 323 | display('

' + name + '

'); 324 | }; 325 | 326 | this.given = function(name) { 327 | display('

' + name + '

'); 328 | }; 329 | 330 | this.separator = function() { 331 | display('
'); 332 | }; 333 | }, 334 | 335 | Text: function() { 336 | function display(text) { 337 | Riot.puts(text); 338 | } 339 | 340 | this.line = function(text) { 341 | display(text); 342 | }; 343 | 344 | this.pass = function(message) { 345 | this.line(' +\033[32m ' + message + '\033[0m'); 346 | }; 347 | 348 | this.fail = function(message) { 349 | this.line(' -\033[31m ' + message + '\033[0m'); 350 | }; 351 | 352 | this.error = function(message, exception) { 353 | this.fail(message); 354 | this.line(' Exception: ' + exception); 355 | }; 356 | 357 | this.context = function(name) { 358 | this.line(name); 359 | }; 360 | 361 | this.given = function(name) { 362 | this.line(name); 363 | }; 364 | 365 | this.separator = function() { 366 | this.line(''); 367 | }; 368 | }, 369 | 370 | XPComCore: function() { 371 | var formatter = new Riot.Formatters.Text(); 372 | formatter.line = function(text) { 373 | puts(text); 374 | }; 375 | return formatter; 376 | } 377 | }; 378 | 379 | Riot.Context = function(name, callback) { 380 | this.name = name; 381 | this.callback = callback; 382 | this.assertions = []; 383 | }; 384 | 385 | Riot.Context.prototype = { 386 | asserts: function(name, result) { 387 | var assertion = new Riot.Assertion(this.name, name, result); 388 | this.assertions.push(assertion); 389 | return assertion; 390 | }, 391 | 392 | should: function(name, result) { 393 | return this.asserts('should ' + name, result); 394 | }, 395 | 396 | setup: function(setupFunction) { 397 | this.setupFunction = setupFunction; 398 | }, 399 | 400 | teardown: function(teardownFunction) { 401 | this.teardownFunction = teardownFunction; 402 | }, 403 | 404 | runSetup: function() { 405 | if (typeof this.setupFunction !== 'undefined') { 406 | return this.setupFunction(); 407 | } 408 | }, 409 | 410 | runTeardown: function() { 411 | if (typeof this.teardownFunction !== 'undefined') { 412 | return this.teardownFunction(); 413 | } 414 | }, 415 | 416 | formatContextName: function() { 417 | if (this.name.match(/^Given/)) { 418 | Riot.formatter.given(this.name); 419 | } else { 420 | Riot.formatter.context(this.name); 421 | } 422 | }, 423 | 424 | run: function() { 425 | this.formatContextName(); 426 | Riot.withDSL(this.callback, this)(); 427 | this.runSetup(); 428 | for (var i = 0; i < this.assertions.length; i++) { 429 | var pass = false, 430 | assertion = this.assertions[i]; 431 | try { 432 | assertion.run(); 433 | pass = true; 434 | Riot.formatter.pass(assertion.name); 435 | } catch (e) { 436 | if (typeof e.name !== 'undefined' && e.name === 'Riot.AssertionFailure') { 437 | Riot.formatter.fail(e.message); 438 | } else { 439 | Riot.formatter.error(assertion.name, e); 440 | } 441 | } 442 | 443 | Riot.addResult(this.name, assertion.name, pass); 444 | } 445 | this.runTeardown(); 446 | } 447 | }; 448 | 449 | Riot.AssertionFailure = function(message) { 450 | var error = new Error(message); 451 | error.name = 'Riot.AssertionFailure'; 452 | return error; 453 | }; 454 | 455 | Riot.Assertion = function(contextName, name, expected) { 456 | this.name = name; 457 | this.expectedValue = expected; 458 | this.contextName = contextName; 459 | this.kindOf = this.typeOf; 460 | this.isTypeOf = this.typeOf; 461 | 462 | this.setAssertion(function(actual) { 463 | if ((actual() === null) || (actual() === undefined)) { 464 | throw(new Riot.AssertionFailure("Expected a value but got '" + actual() + "'")); 465 | } 466 | }); 467 | }; 468 | 469 | Riot.Assertion.prototype = { 470 | setAssertion: function(assertion) { 471 | this.assertion = assertion; 472 | }, 473 | 474 | run: function() { 475 | var that = this; 476 | this.assertion(function() { return that.expected(); }); 477 | }, 478 | 479 | fail: function(message) { 480 | throw(new Riot.AssertionFailure(this.name + ': ' + message)); 481 | }, 482 | 483 | expected: function() { 484 | if (typeof this.expectedMemo === 'undefined') { 485 | if (typeof this.expectedValue === 'function') { 486 | try { 487 | this.expectedMemo = this.expectedValue(); 488 | } catch (exception) { 489 | this.expectedValue = exception; 490 | } 491 | } else { 492 | this.expectedMemo = this.expectedValue; 493 | } 494 | } 495 | return this.expectedMemo; 496 | }, 497 | 498 | // Based on http://github.com/visionmedia/jspec/blob/master/lib/jspec.js 499 | // Short-circuits early, can compare arrays 500 | isEqual: function(a, b) { 501 | if (typeof a != typeof b) return; 502 | if (a === b) return true; 503 | if (a instanceof RegExp) { 504 | return a.toString() === b.toString(); 505 | } 506 | if (a instanceof Date) { 507 | return Number(a) === Number(b); 508 | } 509 | if (typeof a != 'object') return; 510 | if (a.length !== undefined) { 511 | if (a.length !== b.length) { 512 | return; 513 | } else { 514 | for (var i = 0, len = a.length; i < len; ++i) { 515 | if (!this.isEqual(a[i], b[i])) { 516 | return; 517 | } 518 | } 519 | } 520 | } 521 | for (var key in b) { 522 | if (!this.isEqual(a[key], b[key])) { 523 | return; 524 | } 525 | } 526 | return true; 527 | }, 528 | 529 | /* Assertions */ 530 | equals: function(expected) { 531 | this.setAssertion(function(actual) { 532 | if (!this.isEqual(actual(), expected)) { 533 | this.fail(expected + ' does not equal: ' + actual()); 534 | } 535 | }); 536 | }, 537 | 538 | matches: function(expected) { 539 | this.setAssertion(function(actual) { 540 | if (!expected.test(actual())) { 541 | this.fail("Expected '" + actual() + "' to match '" + expected + "'"); 542 | } 543 | }); 544 | }, 545 | 546 | raises: function(expected) { 547 | this.setAssertion(function(actual) { 548 | try { 549 | actual(); 550 | return; 551 | } catch (exception) { 552 | if (expected !== exception) { 553 | this.fail('raised ' + exception + ' instead of ' + expected); 554 | } 555 | } 556 | this.fail('did not raise ' + expected); 557 | }); 558 | }, 559 | 560 | typeOf: function(expected) { 561 | this.setAssertion(function(actual) { 562 | var t = typeof actual(); 563 | if (t === 'object') { 564 | if (actual()) { 565 | if (typeof actual().length === 'number' && 566 | !(actual.propertyIsEnumerable('length')) && 567 | typeof actual().splice === 'function') { 568 | t = 'array'; 569 | } 570 | } else { 571 | t = 'null'; 572 | } 573 | } 574 | 575 | if (t !== expected.toLowerCase()) { 576 | this.fail(expected + ' is not a type of ' + actual()); 577 | } 578 | }); 579 | }, 580 | 581 | isTrue: function() { 582 | this.setAssertion(function(actual) { 583 | if (actual() !== true) { 584 | this.fail(actual() + ' was not true'); 585 | } 586 | }); 587 | }, 588 | 589 | isFalse: function() { 590 | this.setAssertion(function(actual) { 591 | if (actual() !== false) { 592 | this.fail(actual() + ' was not false'); 593 | } 594 | }); 595 | }, 596 | 597 | isNull: function() { 598 | this.setAssertion(function(actual) { 599 | if (actual() !== null) { 600 | this.fail(actual() + ' was not null'); 601 | } 602 | }); 603 | }, 604 | 605 | isNotNull: function() { 606 | this.setAssertion(function(actual) { 607 | if (actual() === null) { 608 | this.fail(actual() + ' was null'); 609 | } 610 | }); 611 | } 612 | }; 613 | 614 | if (typeof exports !== 'undefined') { 615 | exports.Riot = Riot; 616 | } else if (typeof riotGlobal.Riot === 'undefined') { 617 | riotGlobal.Riot = Riot; 618 | 619 | if (typeof riotGlobal.load === 'undefined') { 620 | riotGlobal.load = function() { }; 621 | } 622 | } 623 | })(typeof window === 'undefined' ? this : window); 624 | --------------------------------------------------------------------------------