@brightspace-ui/testing 1.49.0 → 1.50.1
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 +1 -1
- package/src/browser/reset.js +12 -11
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": "1.
|
|
5
|
+
"version": "1.50.1",
|
|
6
6
|
"repository": "https://github.com/BrightspaceUI/testing.git",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"lint": "npm run lint:eslint && npm run lint:style",
|
package/src/browser/reset.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { setViewport as cmdSetViewport, emulateMedia, sendMouse } from '@web/test-runner-commands';
|
|
2
2
|
import { getDocumentLocaleSettings } from '@brightspace-ui/intl/lib/common.js';
|
|
3
|
+
import { localeData } from '@brightspace-ui/intl/lib/locale-data/current.js';
|
|
3
4
|
import { nextFrame } from '@open-wc/testing';
|
|
4
5
|
|
|
5
6
|
const DEFAULT_PAGE_PADDING = true,
|
|
@@ -48,7 +49,6 @@ export async function reset(opts = {}) {
|
|
|
48
49
|
const defaultOpts = {
|
|
49
50
|
lang: DEFAULT_LANG,
|
|
50
51
|
mathjax: {},
|
|
51
|
-
rtl: !!opts.lang?.startsWith('ar'),
|
|
52
52
|
colorMode: DEFAULT_COLOR_MODE,
|
|
53
53
|
pagePadding: DEFAULT_PAGE_PADDING,
|
|
54
54
|
media: DEFAULT_MEDIA
|
|
@@ -82,16 +82,6 @@ export async function reset(opts = {}) {
|
|
|
82
82
|
awaitNextFrame = true;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
if (opts.rtl !== currentRtl) {
|
|
86
|
-
if (!opts.rtl) {
|
|
87
|
-
document.documentElement.removeAttribute('dir');
|
|
88
|
-
} else {
|
|
89
|
-
document.documentElement.setAttribute('dir', 'rtl');
|
|
90
|
-
}
|
|
91
|
-
awaitNextFrame = true;
|
|
92
|
-
currentRtl = opts.rtl;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
85
|
if (opts.colorMode !== currentColorMode) {
|
|
96
86
|
const colorMode = ['light', 'dark'].includes(opts.colorMode) ? opts.colorMode : DEFAULT_COLOR_MODE;
|
|
97
87
|
if (!colorMode) {
|
|
@@ -106,7 +96,18 @@ export async function reset(opts = {}) {
|
|
|
106
96
|
opts.lang ??= '';
|
|
107
97
|
if (documentLocaleSettings.language !== opts.lang) {
|
|
108
98
|
document.documentElement.lang = opts.lang;
|
|
99
|
+
await localeData;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
opts.rtl ??= localeData.layout.orientation.characterOrder === 'right-to-left';
|
|
103
|
+
if (opts.rtl !== currentRtl) {
|
|
104
|
+
if (!opts.rtl) {
|
|
105
|
+
document.documentElement.removeAttribute('dir');
|
|
106
|
+
} else {
|
|
107
|
+
document.documentElement.setAttribute('dir', 'rtl');
|
|
108
|
+
}
|
|
109
109
|
awaitNextFrame = true;
|
|
110
|
+
currentRtl = opts.rtl;
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
if (await setViewport(opts.viewport)) {
|