@brightspace-ui/testing 0.30.1 → 0.31.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.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@brightspace-ui/testing",
3
3
  "description": "Utilities for testing front-end components and applications",
4
4
  "type": "module",
5
- "version": "0.30.1",
5
+ "version": "0.31.0",
6
6
  "repository": "https://github.com/BrightspaceUI/testing.git",
7
7
  "scripts": {
8
8
  "lint": "eslint . --ext .js",
@@ -17,16 +17,21 @@ export function requestMouseReset() {
17
17
  shouldResetMouse = true;
18
18
  }
19
19
 
20
- export async function reset(opts) {
20
+ export async function reset(opts = {}) {
21
21
 
22
- opts = opts || {};
23
- opts.lang = opts.lang || DEFAULT_LANG;
24
- opts.mathjax = opts.mathjax || {};
22
+ const defaultOpts = {
23
+ lang: DEFAULT_LANG,
24
+ mathjax: {},
25
+ rtl: !!opts.lang?.startsWith('ar'),
26
+ viewport: {
27
+ height: DEFAULT_VIEWPORT_HEIGHT,
28
+ width: DEFAULT_VIEWPORT_WIDTH
29
+ }
30
+ };
31
+
32
+ opts = { ...defaultOpts, ...opts };
33
+ opts.viewport = { ...defaultOpts.viewport, ...opts.viewport };
25
34
  opts.mathjax.renderLatex = (typeof opts.mathjax.renderLatex === 'boolean') ? opts.mathjax.renderLatex : DEFAULT_MATHJAX_RENDER_LATEX;
26
- opts.rtl = opts.lang.startsWith('ar') || !!opts.rtl;
27
- opts.viewport = opts.viewport || {};
28
- opts.viewport.height = opts.viewport.height || DEFAULT_VIEWPORT_HEIGHT;
29
- opts.viewport.width = opts.viewport.width || DEFAULT_VIEWPORT_WIDTH;
30
35
 
31
36
  let awaitNextFrame = false;
32
37