Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

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

23 changes: 12 additions & 11 deletions src/browser/reset.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { setViewport as cmdSetViewport, emulateMedia, sendMouse } from '@web/test-runner-commands';
import { getDocumentLocaleSettings } from '@brightspace-ui/intl/lib/common.js';
import { localeData } from '@brightspace-ui/intl/lib/locale-data/current.js';
import { nextFrame } from '@open-wc/testing';

const DEFAULT_PAGE_PADDING = true,
Expand Down Expand Up @@ -48,7 +49,6 @@ export async function reset(opts = {}) {
const defaultOpts = {
lang: DEFAULT_LANG,
mathjax: {},
rtl: !!opts.lang?.startsWith('ar'),

@bearfriend bearfriend Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*Urdu intensifies*

colorMode: DEFAULT_COLOR_MODE,
pagePadding: DEFAULT_PAGE_PADDING,
media: DEFAULT_MEDIA
Expand Down Expand Up @@ -82,16 +82,6 @@ export async function reset(opts = {}) {
awaitNextFrame = true;
}

if (opts.rtl !== currentRtl) {
if (!opts.rtl) {
document.documentElement.removeAttribute('dir');
} else {
document.documentElement.setAttribute('dir', 'rtl');
}
awaitNextFrame = true;
currentRtl = opts.rtl;
}

if (opts.colorMode !== currentColorMode) {
const colorMode = ['light', 'dark'].includes(opts.colorMode) ? opts.colorMode : DEFAULT_COLOR_MODE;
if (!colorMode) {
Expand All @@ -106,7 +96,18 @@ export async function reset(opts = {}) {
opts.lang ??= '';
if (documentLocaleSettings.language !== opts.lang) {
document.documentElement.lang = opts.lang;
await localeData;
}

opts.rtl ??= localeData.layout.orientation.characterOrder === 'right-to-left';
if (opts.rtl !== currentRtl) {
if (!opts.rtl) {
document.documentElement.removeAttribute('dir');
} else {
document.documentElement.setAttribute('dir', 'rtl');
}
awaitNextFrame = true;
currentRtl = opts.rtl;
}

if (await setViewport(opts.viewport)) {
Expand Down
2 changes: 1 addition & 1 deletion test/browser/ctor.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export default {
pattern: () => 'test/browser/**/*.ctor.js',
testRunnerHtml: testFramework =>
`<!DOCTYPE html>
<html>
<html lang="en">
<body>
<script>
window.addEventListener('error', (err) => {
Expand Down