index.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. BABYLONDEVTOOLS.Loader.require('../validation/validation.js')
  2. .load(function() {
  3. var needInit = false;
  4. document.getElementById("run").addEventListener("click", function() {
  5. // Loading tests
  6. var xhr = new XMLHttpRequest();
  7. xhr.open("GET", "../validation/config.json", true);
  8. xhr.addEventListener("load", function () {
  9. if (xhr.status === 200) {
  10. config = JSON.parse(xhr.responseText);
  11. // Run tests
  12. var index = 0;
  13. if (needInit) {
  14. init();
  15. }
  16. var title = document.getElementById("sceneName").value.toLowerCase();
  17. for (var index = 0; index < config.tests.length; index++) {
  18. if (config.tests[index].title.toLowerCase() === title) {
  19. break;
  20. }
  21. }
  22. runTest(index, function() {
  23. dispose();
  24. needInit = true;
  25. });
  26. }
  27. }, false);
  28. xhr.send();
  29. });
  30. });