diff --git a/package-lock.json b/package-lock.json index c36eb712..6fa7fa68 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "0.31.0", "license": "Apache-2.0", "dependencies": { + "@brightspace-ui/intl": "^3", "@open-wc/testing": "^3", "@rollup/plugin-node-resolve": "^15", "@web/config-loader": "^0.2", @@ -403,6 +404,11 @@ "node": ">=6.9.0" } }, + "node_modules/@brightspace-ui/intl": { + "version": "3.13.2", + "resolved": "https://registry.npmjs.org/@brightspace-ui/intl/-/intl-3.13.2.tgz", + "integrity": "sha512-TUb6SZqsi3P6CbREnnwhqGOWu7Svx9JQ1Rw4zRVLj4IozG7kIYu2SfgUrITLYY/moRtiAJTV0wlnYczfBHfG7A==" + }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", diff --git a/package.json b/package.json index d138cb4a..f5e99383 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "access": "public" }, "dependencies": { + "@brightspace-ui/intl": "^3", "@open-wc/testing": "^3", "@rollup/plugin-node-resolve": "^15", "@web/config-loader": "^0.2", diff --git a/src/browser/reset.js b/src/browser/reset.js index b1840fc3..1128da40 100644 --- a/src/browser/reset.js +++ b/src/browser/reset.js @@ -1,4 +1,5 @@ import { sendMouse, setViewport } from '@web/test-runner-commands'; +import { getDocumentLocaleSettings } from '@brightspace-ui/intl/lib/common.js'; import { nextFrame } from '@open-wc/testing'; const DEFAULT_LANG = 'en', @@ -6,6 +7,8 @@ const DEFAULT_LANG = 'en', DEFAULT_VIEWPORT_HEIGHT = 800, DEFAULT_VIEWPORT_WIDTH = 800; +const documentLocaleSettings = getDocumentLocaleSettings(); + let currentMathjaxRenderLatex = DEFAULT_MATHJAX_RENDER_LATEX, currentRtl = false, @@ -57,7 +60,8 @@ export async function reset(opts = {}) { currentRtl = opts.rtl; } - if (document.documentElement.lang !== opts.lang) { + opts.lang ??= ''; + if (documentLocaleSettings.lamguage !== opts.lang) { document.documentElement.lang = opts.lang; awaitNextFrame = true; }