-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use documentLocaleSettings #156
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
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; | ||
|
||
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) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume this should be "language" and this is working right now because this is always true? |
||
document.documentElement.lang = opts.lang; | ||
Comment on lines
+63
to
+65
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
awaitNextFrame = true; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean we can't use
@brightspace-ui/testing
inintl
, or would that still work? 🤔 Looks like we use mocha directly anyways so maybe doesn't matterThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I think that's what it implies. I'm OK with that, since yeah keeping
intl
bare bones seems like a good call anyway given how low-level it is.