足力健前端,vue版本

intersection-observer-test.html 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <!--
  2. Copyright 2016 Google Inc. All Rights Reserved.
  3. Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.
  4. https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
  5. -->
  6. <!DOCTYPE html>
  7. <html lang="en">
  8. <head>
  9. <meta charset="utf-8">
  10. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  11. <title>IntersectionObserver Tests</title>
  12. <!-- Dependencies -->
  13. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/mocha/2.5.3/mocha.min.css">
  14. <script src="https://cdnjs.cloudflare.com/ajax/libs/mocha/2.5.3/mocha.min.js"></script>
  15. <script src="https://cdnjs.cloudflare.com/ajax/libs/expect.js/0.2.0/expect.min.js"></script>
  16. <script src="https://cdnjs.cloudflare.com/ajax/libs/sinon.js/3.2.1/sinon.min.js"></script>
  17. <!-- Polyfills for IE7-8 -->
  18. <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=es5,getComputedStyle"></script>
  19. </head>
  20. <body>
  21. <div id="mocha"></div>
  22. <!-- Setup -->
  23. <script>mocha.setup({ui:'bdd'});</script>
  24. <!-- Script under test -->
  25. <script src="intersection-observer.js"></script>
  26. <!-- Tests -->
  27. <script src="intersection-observer-test.js"></script>
  28. <!-- Reporting -->
  29. <script>
  30. var runner = mocha.run();
  31. var failedTests = [];
  32. runner.on('end', function(){
  33. window.mochaResults = runner.stats;
  34. window.mochaResults.reports = failedTests;
  35. });
  36. runner.on('fail', function(test, err){
  37. var flattenTitles = function(test){
  38. var titles = [];
  39. while (test.parent.title){
  40. titles.push(test.parent.title);
  41. test = test.parent;
  42. }
  43. return titles.reverse();
  44. };
  45. failedTests.push({
  46. name: test.title,
  47. result: false,
  48. message: err.message,
  49. stack: err.stack,
  50. titles: flattenTitles(test)
  51. });
  52. });
  53. </script>
  54. </body>
  55. </html>