chartjs-test-utils 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  /*!
2
- * chartjs-test-utils v0.3.1
2
+ * chartjs-test-utils v0.4.0
3
3
  * https://github.com/chartjs/chartjs-test-utils#readme
4
- * (c) 2021 chartjs-plugin-annotation Contributors
4
+ * (c) 2022 chartjs-plugin-annotation Contributors
5
5
  * Released under the MIT License
6
6
  */
7
7
  // Code from https://stackoverflow.com/questions/4406864/html-canvas-unit-testing
@@ -533,13 +533,13 @@ function readImageData(url, callback) {
533
533
  /**
534
534
  * Injects a new canvas (and div wrapper) and creates the associated Chart instance
535
535
  * using the given config. Additional options allow tweaking elements generation.
536
- * @param {object} config - Chart config.
537
- * @param {object} options - Chart acquisition options.
538
- * @param {object} options.canvas - Canvas attributes.
539
- * @param {object} options.wrapper - Canvas wrapper attributes.
540
- * @param {boolean} options.useOffscreenCanvas - use an OffscreenCanvas instead of the normal HTMLCanvasElement.
541
- * @param {boolean} options.useShadowDOM - use shadowDom
542
- * @param {boolean} options.persistent - If true, the chart will not be released after the spec.
536
+ * @param {object} [config] - Chart config.
537
+ * @param {object} [options] - Chart acquisition options.
538
+ * @param {object} [options.canvas] - Canvas attributes.
539
+ * @param {object} [options.wrapper] - Canvas wrapper attributes.
540
+ * @param {boolean} [options.useOffscreenCanvas] - use an OffscreenCanvas instead of the normal HTMLCanvasElement.
541
+ * @param {boolean} [options.useShadowDOM] - use shadowDom
542
+ * @param {boolean} [options.persistent] - If true, the chart will not be released after the spec.
543
543
  */
544
544
  function _acquireChart(config, options) {
545
545
  var wrapper = document.createElement('div');
@@ -687,6 +687,8 @@ async function triggerMouseEvent(chart, type, el) {
687
687
  node.dispatchEvent(event);
688
688
 
689
689
  await promise;
690
+
691
+ return event;
690
692
  }
691
693
 
692
694
  function isObject(value) {
@@ -1124,13 +1126,13 @@ var charts = {};
1124
1126
  /**
1125
1127
  * Injects a new canvas (and div wrapper) and creates the associated Chart instance
1126
1128
  * using the given config. Additional options allow tweaking elements generation.
1127
- * @param {object} config - Chart config.
1128
- * @param {object} options - Chart acquisition options.
1129
- * @param {object} options.canvas - Canvas attributes.
1130
- * @param {object} options.wrapper - Canvas wrapper attributes.
1131
- * @param {boolean} options.useOffscreenCanvas - use an OffscreenCanvas instead of the normal HTMLCanvasElement.
1132
- * @param {boolean} options.useShadowDOM - use shadowDom
1133
- * @param {boolean} options.persistent - If true, the chart will not be released after the spec.
1129
+ * @param {object} [config] - Chart config.
1130
+ * @param {object} [options] - Chart acquisition options.
1131
+ * @param {object} [options.canvas] - Canvas attributes.
1132
+ * @param {object} [options.wrapper] - Canvas wrapper attributes.
1133
+ * @param {boolean} [options.useOffscreenCanvas] - use an OffscreenCanvas instead of the normal HTMLCanvasElement.
1134
+ * @param {boolean} [options.useShadowDOM] - use shadowDom
1135
+ * @param {boolean} [options.persistent] - If true, the chart will not be released after the spec.
1134
1136
  */
1135
1137
  function acquireChart(config, options) {
1136
1138
  var chart = _acquireChart(config, options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chartjs-test-utils",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "Chart.js test utils",
5
5
  "main": "dist/chartjs-test-utils.js",
6
6
  "module": "dist/chartjs-test-utils.js",
@@ -40,9 +40,11 @@
40
40
  "rollup": "^2.39.0"
41
41
  },
42
42
  "dependencies": {
43
+ "pixelmatch": "^5.2.1"
44
+ },
45
+ "peerDependencies": {
43
46
  "jasmine": "^3.6.4",
44
47
  "karma": "^6.1.1",
45
- "karma-jasmine": "^4.0.1",
46
- "pixelmatch": "^5.2.1"
48
+ "karma-jasmine": "^4.0.1"
47
49
  }
48
50
  }