From 9ecc8f2c03e952cf58ee873eeacb031bb02b5a48 Mon Sep 17 00:00:00 2001 From: Danny Gleckler Date: Thu, 31 Aug 2023 20:18:20 -0400 Subject: [PATCH] Just check against the current document lang --- package-lock.json | 6 ------ package.json | 1 - src/browser/reset.js | 8 ++------ test/browser/fixture.test.js | 6 ------ 4 files changed, 2 insertions(+), 19 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6fa7fa68..c36eb712 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,6 @@ "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", @@ -404,11 +403,6 @@ "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 f5e99383..d138cb4a 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,6 @@ "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 21148a0d..b1840fc3 100644 --- a/src/browser/reset.js +++ b/src/browser/reset.js @@ -1,5 +1,4 @@ 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', @@ -7,8 +6,6 @@ const DEFAULT_LANG = 'en', DEFAULT_VIEWPORT_HEIGHT = 800, DEFAULT_VIEWPORT_WIDTH = 800; -const documentLocaleSettings = getDocumentLocaleSettings(); - let currentMathjaxRenderLatex = DEFAULT_MATHJAX_RENDER_LATEX, currentRtl = false, @@ -60,9 +57,8 @@ export async function reset(opts = {}) { currentRtl = opts.rtl; } - if (opts.lang !== documentLocaleSettings.language) { - document.documentElement.setAttribute('lang', opts.lang); - documentLocaleSettings.language = opts.lang; + if (document.documentElement.lang !== opts.lang) { + document.documentElement.lang = opts.lang; awaitNextFrame = true; } diff --git a/test/browser/fixture.test.js b/test/browser/fixture.test.js index e0503bcb..7c981ad7 100644 --- a/test/browser/fixture.test.js +++ b/test/browser/fixture.test.js @@ -2,14 +2,11 @@ import { defineCE, expect, fixture, html, waitUntil } from '../../src/browser/index.js'; import { restore, stub } from 'sinon'; import { focusElem } from '../../src/browser/commands.js'; -import { getDocumentLocaleSettings } from '@brightspace-ui/intl/lib/common.js'; import { LitElement } from 'lit'; import { requestMouseReset } from '../../src/browser/reset.js'; import { sendMouse } from '@web/test-runner-commands'; import { unsafeHTML } from 'lit/directives/unsafe-html.js'; -const documentLocaleSettings = getDocumentLocaleSettings(); - const resolves = new Map(); const slowElem = defineCE( @@ -135,16 +132,13 @@ describe('fixture', () => { it('should default language to EN', async() => { await fixture(html`

hello

`); expect(document.documentElement.getAttribute('lang')).to.equal('en'); - expect(documentLocaleSettings.language).to.equal('en'); }); it('should reset language to EN', async() => { await fixture(html`

bonjour

`, { lang: 'fr' }); expect(document.documentElement.getAttribute('lang')).to.equal('fr'); - expect(documentLocaleSettings.language).to.equal('fr'); await fixture(html`

hello

`); expect(document.documentElement.getAttribute('lang')).to.equal('en'); - expect(documentLocaleSettings.language).to.equal('en'); }); it('should use specified mathjax latex config', async() => {