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

BC-8628 - Remove html in language files #3486

Merged
merged 38 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
b878beb
add info banner for rooms
NFriedo Dec 20, 2024
778de8d
add links to banner, add language keys
NFriedo Jan 2, 2025
bfa0211
fix unit tests, remove wrapperVM
NFriedo Jan 2, 2025
185336d
fix unit tests, fix spelling mistake language keys
NFriedo Jan 2, 2025
87a0c59
AdminMigrationSection: remove html in description keys
NFriedo Jan 3, 2025
a9b9f8d
AdminMigrationSection - MigrationWarningCard: remove html in infoText…
NFriedo Jan 3, 2025
24a9153
AdminMigrationSection - remove html for migration-info-text, remove r…
NFriedo Jan 3, 2025
fdf0f7d
AdminMigrationSection - remove html for migration-finished-timestamp …
NFriedo Jan 3, 2025
a9c8e9e
MigrationPage: remove html in clearAutoMatchesDialog.description lang…
NFriedo Jan 3, 2025
889e0de
SchoolExternalToolConfigurator: replace html in tool-configuration-in…
NFriedo Jan 3, 2025
0b465d7
External Tools school settings: remove html in delete-dialog-content-…
NFriedo Jan 6, 2025
478973c
Merge branch 'main' into BC-8628-remove-html-languagekeys
NFriedo Jan 6, 2025
e92202b
fix sonarcloud security issue
NFriedo Jan 6, 2025
e027140
group selection dialog: remove html from language key for no-teacher-…
NFriedo Jan 6, 2025
0716fae
class members: remove html from infobox text language key
NFriedo Jan 6, 2025
bf85d8c
fix unit test
NFriedo Jan 6, 2025
6ab3e1c
ClassOverview page: remove html in delete a class laguage key
NFriedo Jan 7, 2025
a849628
LDAPActivate page: remove br tag from language key
NFriedo Jan 7, 2025
b33e7ab
Migration page: remove html in migration summary language keys
NFriedo Jan 7, 2025
9bf1377
CourseContextExternalToolConfigurator: remove html from tool descript…
NFriedo Jan 7, 2025
0e0f43e
UserLoginMigrationConsent page: remove html in language keys for desc…
NFriedo Jan 9, 2025
8bd33ea
add missing data-testid
NFriedo Jan 9, 2025
658c62e
UserLoginMigrationError page: remove html from error migration keys
NFriedo Jan 9, 2025
790dd20
UserLoginMigrationSuccess: remove html in success description
NFriedo Jan 9, 2025
d8162aa
RoomExternalToolsSection: remove '<i>' that has no effect for delete …
NFriedo Jan 10, 2025
70188b9
AutoLogoutWarning: remove span in language key
NFriedo Jan 10, 2025
dec0ed2
ContentEmptyState: remove html from language keys
NFriedo Jan 10, 2025
3898cbb
ContentInitialState: remove html from language keys
NFriedo Jan 10, 2025
2823414
administration rooms overview: remove html in language key
NFriedo Jan 10, 2025
26c0ecc
disallow HTML in translations
uidp Jan 10, 2025
cb7ffc2
Merge branch 'main' of github.com:hpi-schul-cloud/nuxt-client into BC…
uidp Jan 10, 2025
1b99bd2
ExternalToolSection, RoomExternalToolsErrorDialog: remove render html
NFriedo Jan 13, 2025
9292372
AdminMigrationSection: remove render html
NFriedo Jan 13, 2025
cd3cbf6
Merge branch 'main' into BC-8628-remove-html-languagekeys
NFriedo Jan 13, 2025
5152c98
change render html config
NFriedo Jan 13, 2025
5a0553d
change config
NFriedo Jan 13, 2025
9da2321
fix unit tests
NFriedo Jan 13, 2025
6ee6446
Merge branch 'main' into BC-8628-remove-html-languagekeys
uidp Jan 13, 2025
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
5 changes: 2 additions & 3 deletions config/webpack/vue-i18n-loader.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { generateJSON, generateJavaScript } = require("@intlify/bundle-utils");
const { generateJavaScript } = require("@intlify/bundle-utils");

const loader = function (source, sourceMap) {
// eslint-disable-next-line @typescript-eslint/no-this-alias
Expand All @@ -10,8 +10,7 @@ const loader = function (source, sourceMap) {
inSourceMap: sourceMap,
forceStringify: false,
useClassComponent: false,
strictMessage: false,
escapeHtml: false,
strictMessage: true, // DO NOT set this to false. We do not allow HTML in messages.
env: loaderContext.mode,
type: "plain",
isGlobal: false,
Expand Down
75 changes: 45 additions & 30 deletions src/components/administration/AdminMigrationSection.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
} from "@@/tests/test-utils/setup";
import { mount } from "@vue/test-utils";
import { nextTick } from "vue";
import vueDompurifyHTMLPlugin from "vue-dompurify-html";

describe("AdminMigrationSection", () => {
let schoolsModule: jest.Mocked<SchoolsModule>;
Expand Down Expand Up @@ -68,11 +67,7 @@ describe("AdminMigrationSection", () => {

const wrapper = mount(AdminMigrationSection, {
global: {
plugins: [
createTestingVuetify(),
createTestingI18n(),
vueDompurifyHTMLPlugin,
],
plugins: [createTestingVuetify(), createTestingI18n()],
provide: {
[SCHOOLS_MODULE_KEY.valueOf()]: schoolsModule,
[USER_LOGIN_MIGRATION_MODULE_KEY.valueOf()]: userLoginMigrationModule,
Expand Down Expand Up @@ -181,11 +176,20 @@ describe("AdminMigrationSection", () => {
}
);

const renderHtmls = wrapper.findAllComponents({ name: "RenderHTML" });

expect(renderHtmls[1].props("html")).toStrictEqual(
"components.administration.adminMigrationSection.infoText"
);
const infoText = wrapper.get('[data-testId="migration-info-text"]');
const expectedText = [
"firstParagraph",
"secondParagraph",
"thirdParagraph",
"fourthParagraph",
]
.map(
(text) =>
`components.administration.adminMigrationSection.infoText.${text}`
)
.join("");

expect(infoText.text()).toEqual(expectedText);
});

it("should display the info text activeMigration when the admin activated the migration", () => {
Expand All @@ -203,9 +207,9 @@ describe("AdminMigrationSection", () => {
}
);

const renderHtmls = wrapper.findAllComponents({ name: "RenderHTML" });
const infoText = wrapper.get('[data-testId="migration-active-status"]');

expect(renderHtmls[1].props("html")).toStrictEqual(
expect(infoText.text()).toStrictEqual(
"components.administration.adminMigrationSection.migrationActive"
);
});
Expand Down Expand Up @@ -368,7 +372,7 @@ describe("AdminMigrationSection", () => {

const buttonComponent = wrapper.findComponent({ name: "v-btn" });
const switchComponent = wrapper.findComponent({ name: "v-switch" });
await buttonComponent.vm.$emit("click");
await buttonComponent.trigger("click");

expect(buttonComponent.exists()).toBe(false);
expect(switchComponent.isVisible()).toBe(false);
Expand Down Expand Up @@ -440,7 +444,7 @@ describe("AdminMigrationSection", () => {

const buttonComponent = wrapper.findComponent({ name: "v-btn" });
const switchComponent = wrapper.findComponent({ name: "v-switch" });
await buttonComponent.vm.$emit("click");
await buttonComponent.trigger("click");

expect(buttonComponent.exists()).toBe(false);
expect(switchComponent.isVisible()).toBe(false);
Expand All @@ -460,7 +464,7 @@ describe("AdminMigrationSection", () => {
);

const buttonComponent = wrapper.findComponent({ name: "v-btn" });
await buttonComponent.vm.$emit("click");
await buttonComponent.trigger("click");

const cardComponent = wrapper.findComponent({ name: "v-card" });

Expand All @@ -478,7 +482,7 @@ describe("AdminMigrationSection", () => {
}
);
const buttonComponent = wrapper.findComponent({ name: "v-btn" });
await buttonComponent.vm.$emit("click");
await buttonComponent.trigger("click");

const cardComponent = wrapper.findComponent({ name: "v-card" });
const cardButtonAgree = cardComponent.find("[data-testId=agree-btn]");
Expand Down Expand Up @@ -506,7 +510,7 @@ describe("AdminMigrationSection", () => {
}
);
const buttonComponent = wrapper.findComponent({ name: "v-btn" });
await buttonComponent.vm.$emit("click");
await buttonComponent.trigger("click");

const cardComponent = wrapper.findComponent({ name: "v-card" });
const cardButtonDisagree = cardComponent.find(
Expand Down Expand Up @@ -540,7 +544,7 @@ describe("AdminMigrationSection", () => {
);

const buttonComponent = wrapper.findComponent({ name: "v-btn" });
await buttonComponent.vm.$emit("click");
await buttonComponent.trigger("click");

const cardComponent = wrapper.findComponent({ name: "v-card" });

Expand All @@ -567,7 +571,7 @@ describe("AdminMigrationSection", () => {
);

const buttonComponent = wrapper.findComponent({ name: "v-btn" });
await buttonComponent.vm.$emit("click");
await buttonComponent.trigger("click");

const warningCards = wrapper.findAllComponents({
name: "migration-warning-card",
Expand Down Expand Up @@ -602,7 +606,7 @@ describe("AdminMigrationSection", () => {
}
);
const buttonComponent = wrapper.findComponent({ name: "v-btn" });
await buttonComponent.vm.$emit("click");
await buttonComponent.trigger("click");

const cardComponent = wrapper.findComponent({ name: "v-card" });
const cardButtonDisagree = cardComponent.find(
Expand Down Expand Up @@ -643,11 +647,18 @@ describe("AdminMigrationSection", () => {
}
);

const renderHtmls = wrapper.findAllComponents({ name: "RenderHTML" });

expect(renderHtmls[2].props("html")).toContain(
"components.administration.adminMigrationSection.oauthMigrationFinished.text"
const dateParagraph = wrapper.get(
"[data-testid=migration-finished-timestamp]"
);

const expectedText = ["firstParagraph", "secondParagraph"]
.map(
(paragraph) =>
`components.administration.adminMigrationSection.oauthMigrationFinished.text.${paragraph}`
)
.join("");

expect(dateParagraph.text()).toBe(expectedText);
});

it("should show finalFinish text when migration grace period has expired", async () => {
Expand All @@ -669,12 +680,16 @@ describe("AdminMigrationSection", () => {
}
);

const renderHtml = wrapper.findComponent({ name: "RenderHTML" });

expect(renderHtml.props()).toHaveProperty("html");
expect(renderHtml.props("html")).toContain(
"components.administration.adminMigrationSection.oauthMigrationFinished.textComplete"
const paragraph = wrapper.get(
"[data-testid=migration-finished-timestamp]"
);

const expectedText = [
"components.administration.adminMigrationSection.oauthMigrationFinished.text.firstParagraph",
"components.administration.adminMigrationSection.oauthMigrationFinished.textComplete.secondParagraph",
].join("");

expect(paragraph.text()).toBe(expectedText);
});

it("should not exist when migration has not been completed", async () => {
Expand Down
Loading
Loading