Skip to content
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

rename test-setup-config.js to test-setup-config.jsx #6133

Merged
merged 5 commits into from
Jun 28, 2024
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
2 changes: 1 addition & 1 deletion apps/plone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
},
"setupFiles": [
"@plone/volto/test-setup-globals.js",
"@plone/volto/test-setup-config.js"
"@plone/volto/test-setup-config.jsx"
],
"globals": {
"__DEV__": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
},
"setupFiles": [
"@plone/volto/test-setup-globals.js",
"@plone/volto/test-setup-config.js"
"@plone/volto/test-setup-config.jsx"
],
"globals": {
"__DEV__": true
Expand Down
1 change: 1 addition & 0 deletions packages/generator-volto/news/6133.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Rename test-setup-config.js to test-setup-config.jsx, otherwise jest tests will eventually fail @tomschall
1 change: 1 addition & 0 deletions packages/volto/news/6133.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Whitelist some dynamic imports to suppress vite warnings in storybook @tomschall
4 changes: 3 additions & 1 deletion packages/volto/src/components/manage/Add/Add.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,9 @@ class Add extends Component {
if (this.props.location?.state?.translationOf) {
const language = this.props.location.state.languageFrom;
const langFileName = toGettextLang(language);
import('@root/../locales/' + langFileName + '.json').then((locale) => {
import(
/* @vite-ignore */ '@root/../locales/' + langFileName + '.json'
).then((locale) => {
this.props.changeLanguage(language, locale.default);
});
this.props.history.push(this.props.location?.state?.translationOf);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ const CreateTranslation = (props) => {
// We change the interface language
if (config.settings.supportedLanguages.includes(language)) {
const langFileName = toGettextLang(language);
import('@root/../locales/' + langFileName + '.json').then((locale) => {
import(
/* @vite-ignore */ '@root/../locales/' + langFileName + '.json'
).then((locale) => {
dispatch(changeLanguage(language, locale.default));
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ const TranslationObject = ({
let lang =
config.settings.supportedLanguages[Object.keys(locales).length];
const langFileName = toGettextLang(lang);
import('@root/../locales/' + langFileName + '.json').then((locale) => {
import(
/* @vite-ignore */ '@root/../locales/' + langFileName + '.json'
).then((locale) => {
setLocales({ ...locales, [toReactIntlLang(lang)]: locale.default });
setLoadingLocale(false);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ class PersonalPreferences extends Component {
let language = data.language || 'en';
if (config.settings.supportedLanguages.includes(language)) {
const langFileName = toGettextLang(language);
import('@root/../locales/' + langFileName + '.json').then((locale) => {
import(
/* @vite-ignore */ '@root/../locales/' + langFileName + '.json'
).then((locale) => {
this.props.changeLanguage(language, locale.default);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ const MultilingualRedirector = (props) => {
let mounted = true;
if (settings.isMultilingual && pathname === '/') {
const langFileName = toGettextLang(redirectToLanguage);
import('@root/../locales/' + langFileName + '.json').then((locale) => {
import(
/* @vite-ignore */ '@root/../locales/' + langFileName + '.json'
).then((locale) => {
if (mounted) {
dispatch(changeLanguage(redirectToLanguage, locale.default));
}
Expand Down
10 changes: 5 additions & 5 deletions packages/volto/src/middleware/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,11 @@ const apiMiddlewareFactory =
config.settings.supportedLanguages.includes(lang)
) {
const langFileName = toGettextLang(lang);
import('@root/../locales/' + langFileName + '.json').then(
(locale) => {
dispatch(changeLanguage(lang, locale.default));
},
);
import(
/* @vite-ignore */ '@root/../locales/' + langFileName + '.json'
).then((locale) => {
dispatch(changeLanguage(lang, locale.default));
});
}
}
if (type === LOGIN && settings.websockets) {
Expand Down
4 changes: 3 additions & 1 deletion packages/volto/src/server.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ let locales = {};
if (config.settings) {
config.settings.supportedLanguages.forEach((lang) => {
const langFileName = toGettextLang(lang);
import('@root/../locales/' + langFileName + '.json').then((locale) => {
import(
/* @vite-ignore */ '@root/../locales/' + langFileName + '.json'
).then((locale) => {
locales = { ...locales, [toReactIntlLang(lang)]: locale.default };
});
});
Expand Down
Loading