Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>reveal.js - Test Async Dependencies</title>
  6. <link rel="stylesheet" href="../dist/reveal.css">
  7. <link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
  8. <script src="../node_modules/qunit/qunit/qunit.js"></script>
  9. </head>
  10. <body style="overflow: auto;">
  11. <div id="qunit"></div>
  12. <div id="qunit-fixture"></div>
  13. <div class="reveal" style="display: none;">
  14. <div class="slides">
  15. <section>Slide content</section>
  16. </div>
  17. </div>
  18. <script src="../dist/reveal.js"></script>
  19. <script>
  20. var externalScriptSequence = '';
  21. var scriptCount = 0;
  22. QUnit.config.testTimeout = 30000;
  23. QUnit.config.autostart = false;
  24. QUnit.module( 'Async Dependencies' );
  25. QUnit.test( 'Async scripts are loaded', function( assert ) {
  26. assert.expect( 5 );
  27. var done = assert.async( 5 );
  28. function callback( event ) {
  29. if( externalScriptSequence.length === 1 ) {
  30. assert.ok( externalScriptSequence === 'A', 'first callback was sync script' );
  31. done();
  32. }
  33. else {
  34. assert.ok( true, 'async script loaded' );
  35. done();
  36. }
  37. if( externalScriptSequence.length === 4 ) {
  38. assert.ok( externalScriptSequence.indexOf( 'A' ) !== -1 &&
  39. externalScriptSequence.indexOf( 'B' ) !== -1 &&
  40. externalScriptSequence.indexOf( 'C' ) !== -1 &&
  41. externalScriptSequence.indexOf( 'D' ) !== -1, 'four unique scripts were loaded' );
  42. done();
  43. }
  44. scriptCount ++;
  45. }
  46. Reveal.initialize({
  47. dependencies: [
  48. { src: 'assets/external-script-a.js', async: false, callback: callback },
  49. { src: 'assets/external-script-b.js', async: true, callback: callback },
  50. { src: 'assets/external-script-c.js', async: true, callback: callback },
  51. { src: 'assets/external-script-d.js', async: true, callback: callback }
  52. ]
  53. });
  54. });
  55. QUnit.start();
  56. </script>
  57. </body>
  58. </html>