Dieses Repository beinhaltet HTML- und Javascript Code zur einer NotizenWebApp auf Basis von Web Storage. Zudem sind Mocha/Chai Tests im Browser enthalten. https://meinenotizen.netlify.app/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

context.js 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. 'use strict';
  2. /**
  3. * @module Context
  4. */
  5. /**
  6. * Expose `Context`.
  7. */
  8. module.exports = Context;
  9. /**
  10. * Initialize a new `Context`.
  11. *
  12. * @private
  13. */
  14. function Context() {}
  15. /**
  16. * Set or get the context `Runnable` to `runnable`.
  17. *
  18. * @private
  19. * @param {Runnable} runnable
  20. * @return {Context} context
  21. */
  22. Context.prototype.runnable = function(runnable) {
  23. if (!arguments.length) {
  24. return this._runnable;
  25. }
  26. this.test = this._runnable = runnable;
  27. return this;
  28. };
  29. /**
  30. * Set or get test timeout `ms`.
  31. *
  32. * @private
  33. * @param {number} ms
  34. * @return {Context} self
  35. */
  36. Context.prototype.timeout = function(ms) {
  37. if (!arguments.length) {
  38. return this.runnable().timeout();
  39. }
  40. this.runnable().timeout(ms);
  41. return this;
  42. };
  43. /**
  44. * Set test timeout `enabled`.
  45. *
  46. * @private
  47. * @param {boolean} enabled
  48. * @return {Context} self
  49. */
  50. Context.prototype.enableTimeouts = function(enabled) {
  51. if (!arguments.length) {
  52. return this.runnable().enableTimeouts();
  53. }
  54. this.runnable().enableTimeouts(enabled);
  55. return this;
  56. };
  57. /**
  58. * Set or get test slowness threshold `ms`.
  59. *
  60. * @private
  61. * @param {number} ms
  62. * @return {Context} self
  63. */
  64. Context.prototype.slow = function(ms) {
  65. if (!arguments.length) {
  66. return this.runnable().slow();
  67. }
  68. this.runnable().slow(ms);
  69. return this;
  70. };
  71. /**
  72. * Mark a test as skipped.
  73. *
  74. * @private
  75. * @throws Pending
  76. */
  77. Context.prototype.skip = function() {
  78. this.runnable().skip();
  79. };
  80. /**
  81. * Set or get a number of allowed retries on failed tests
  82. *
  83. * @private
  84. * @param {number} n
  85. * @return {Context} self
  86. */
  87. Context.prototype.retries = function(n) {
  88. if (!arguments.length) {
  89. return this.runnable().retries();
  90. }
  91. this.runnable().retries(n);
  92. return this;
  93. };