diff --git a/package-lock.json b/package-lock.json index 3eeb8586..ceb7bb38 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 89e9ef30..f5e99383 100644 --- a/package.json +++ b/package.json @@ -36,8 +36,9 @@ "access": "public" }, "dependencies": { - "@rollup/plugin-node-resolve": "^15", + "@brightspace-ui/intl": "^3", "@open-wc/testing": "^3", + "@rollup/plugin-node-resolve": "^15", "@web/config-loader": "^0.2", "@web/dev-server": "^0.2", "@web/rollup-plugin-html": "^2", diff --git a/src/browser/reset.js b/src/browser/reset.js index 3798d103..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,7 +7,9 @@ const DEFAULT_LANG = 'en', DEFAULT_VIEWPORT_HEIGHT = 800, DEFAULT_VIEWPORT_WIDTH = 800; -let currentLang = undefined, +const documentLocaleSettings = getDocumentLocaleSettings(); + +let currentMathjaxRenderLatex = DEFAULT_MATHJAX_RENDER_LATEX, currentRtl = false, currentViewportHeight = 0, @@ -57,9 +60,9 @@ export async function reset(opts = {}) { currentRtl = opts.rtl; } - if (opts.lang !== currentLang) { - document.documentElement.setAttribute('lang', opts.lang); - currentLang = opts.lang; + opts.lang ??= ''; + if (documentLocaleSettings.lamguage !== opts.lang) { + document.documentElement.lang = opts.lang; awaitNextFrame = true; }