Skip to content

Commit

Permalink
Re-add documentLocaleSettings, but read-only
Browse files Browse the repository at this point in the history
  • Loading branch information
bearfriend committed Sep 1, 2023
1 parent 9ecc8f2 commit c998c75
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 5 additions & 1 deletion src/browser/reset.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
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',
DEFAULT_MATHJAX_RENDER_LATEX = false,
DEFAULT_VIEWPORT_HEIGHT = 800,
DEFAULT_VIEWPORT_WIDTH = 800;

const documentLocaleSettings = getDocumentLocaleSettings();

let
currentMathjaxRenderLatex = DEFAULT_MATHJAX_RENDER_LATEX,
currentRtl = false,
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit c998c75

Please sign in to comment.