test.html 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>Mocha Tests</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  7. <link rel="stylesheet" href="../node_modules/mocha/mocha.css" />
  8. <style type="text/css">
  9. html * {
  10. box-sizing: border-box;
  11. }
  12. </style>
  13. <link rel="stylesheet" href="../dist/css/datepicker.css" />
  14. </head>
  15. <body>
  16. <div id="mocha"></div>
  17. <div id="test-container"></div>
  18. <script src="../node_modules/mocha/mocha.js"></script>
  19. <script src="../node_modules/unexpected/unexpected.js"></script>
  20. <script src="../node_modules/sinon/pkg/sinon.js"></script>
  21. <script src="../node_modules/simulant/dist/simulant.umd.js"></script>
  22. <script class="mocha-init">
  23. mocha.setup('bdd');
  24. mocha.checkLeaks();
  25. window.testContainer = document.getElementById('test-container');
  26. </script>
  27. <script src="./_utils/date.js"></script>
  28. <script src="./_utils/dom.js"></script>
  29. <script class="setup">
  30. /* eslint-disable no-undef, no-unused-vars */
  31. var expect = weknowhow.expect;
  32. var dateValue = dateUtils.dateValue;
  33. var parseHTML = domUtils.parseHTML;
  34. var isVisible = domUtils.isVisible;
  35. var lastItemOf = arr => arr[arr.length - 1];
  36. var createDP = (el, options) => {
  37. const dp = new Datepicker(el, options);
  38. return {dp, picker: document.querySelector('.datepicker')};
  39. };
  40. var createDRP = (el, options) => {
  41. const drp = new DateRangePicker(el, options);
  42. const [picker0, picker1] = document.querySelectorAll('.datepicker');
  43. return {drp, picker0, picker1};
  44. };
  45. var getParts = (picker, selectors) => selectors.map(sel => picker.querySelector(sel));
  46. var getViewSwitch = picker => picker.querySelector('.view-switch');
  47. var getCells = picker => Array.from(picker.querySelectorAll('.datepicker-cell'));
  48. var filterCells = (cells, criteria) => {
  49. const fn = typeof criteria === 'string' ? el => el.matches(criteria) : criteria;
  50. return cells.filter(fn);
  51. };
  52. var getCellIndices = (cells, criteria) => cells.reduce((indices, cell, idx) => {
  53. if (cell.matches(criteria)) {
  54. indices.push(idx);
  55. }
  56. return indices;
  57. }, []);
  58. </script>
  59. <script src="../dist/js/datepicker-full.js"></script>
  60. <script src="../dist/js/locales/fr.js"></script>
  61. <script src="../dist/js/locales/zh-CN.js"></script>
  62. <script src="./Datepicker/Datepicker-object.js"></script>
  63. <script src="./Datepicker/api-methods.js"></script>
  64. <script src="./mouse-operation.js"></script>
  65. <script src="./keyboard-operation/keyboard-operation.js"></script>
  66. <script src="./keyboard-operation/arrow-left.js"></script>
  67. <script src="./keyboard-operation/arrow-right.js"></script>
  68. <script src="./keyboard-operation/arrow-up.js"></script>
  69. <script src="./keyboard-operation/arrow-down.js"></script>
  70. <script src="./keyboard-operation/edit-mode.js"></script>
  71. <script src="./events.js"></script>
  72. <script src="./options/options.js"></script>
  73. <script src="./options/date-restrictions.js"></script>
  74. <script src="./options/buttons.js"></script>
  75. <script src="./options/format.js"></script>
  76. <script src="./options/multidate.js"></script>
  77. <script src="./options/pick-levle+view.js"></script>
  78. <script src="./options/orientation.js"></script>
  79. <script src="./options/before-show.js"></script>
  80. <script src="./inline-mode.js"></script>
  81. <script src="./DateRangePicker/DateRangePicker.js"></script>
  82. <script src="./DateRangePicker/api-methods.js"></script>
  83. <script src="./DateRangePicker/date-selection.js"></script>
  84. <script src="./DateRangePicker/options.js"></script>
  85. <script class="mocha-exec">
  86. mocha.run();
  87. </script>
  88. </body>
  89. </html>