Skip to content

Commit

Permalink
Merge branch 'master' into ndskip-for-translating
Browse files Browse the repository at this point in the history
  • Loading branch information
gunnarvelle committed Dec 10, 2024
2 parents 4409e1c + 71a5cdc commit 7127d26
Show file tree
Hide file tree
Showing 483 changed files with 10,636 additions and 13,599 deletions.
7 changes: 0 additions & 7 deletions .eslintrc.cjs

This file was deleted.

11 changes: 6 additions & 5 deletions e2e/specs/grid.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,30 @@ test("can select multiple different sizes", async ({ page }) => {
expect(await page.getByTestId("slate-grid-cell").count()).toEqual(2);
await page.getByTestId("edit-grid-button").click();
await page.getByRole("radiogroup").getByText("4").click();
await page.getByRole("button", { name: "Lagre", exact: true }).click();
await page.getByTestId("grid-form-save-button").click();
expect(await page.getByTestId("slate-grid-cell").count()).toEqual(4);
await page.getByTestId("edit-grid-button").click();
await page.getByRole("radiogroup").getByText("2x2").click();
await page.getByRole("button", { name: "Lagre", exact: true }).click();
await page.getByTestId("grid-form-save-button").click();
expect(await page.getByTestId("slate-grid-cell").count()).toEqual(4);
await page.getByTestId("edit-grid-button").click();
await page.getByRole("radiogroup").getByText("2", { exact: true }).click();
await page.getByRole("button", { name: "Lagre", exact: true }).click();
await page.getByTestId("grid-form-save-button").click();
expect(await page.getByTestId("slate-grid-cell").count()).toEqual(2);
});

test("can change background color", async ({ page }) => {
await page.getByTestId("edit-grid-button").click();
await page.getByText("Hvit").click();
await page.getByRole("button", { name: "Lagre", exact: true }).click();
await page.getByTestId("grid-form-save-button").click();
});

test("can set border", async ({ page }) => {
await page.getByTestId("edit-grid-button").click();
let checkbox = page.locator('[data-scope="checkbox"][data-part="root"]');
await checkbox.click();
await page.getByRole("button", { name: "Lagre", exact: true }).click();
await page.getByTestId("grid-form-save-button").click();

await page.getByTestId("edit-grid-button").click();
checkbox = page.locator('[data-scope="checkbox"][data-part="root"][data-state="checked"]');
await expect(checkbox).toBeVisible();
Expand Down
10 changes: 6 additions & 4 deletions e2e/specs/search_audio.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,21 @@ test("Can use text input", async ({ page }) => {
});

test("Can use audiotype dropdown", async ({ page }) => {
await page.locator('select[name="audio-type"]').selectOption({ label: "Podkast" });
await page.getByTestId("audio-type-select").click();
await page.getByRole("option", { name: "Podkast", exact: true }).click();
await page.getByTestId("audio-search-result").first().waitFor();
expect(await page.getByTestId("searchTotalCount").innerText()).toEqual("114");
await page.locator('select[name="audio-type"]').selectOption({ label: "Velg lydfiltype" });
await page.getByTestId("remove-tag-button").click();
await page.getByTestId("audio-search-result").first().waitFor();
expect(await page.getByTestId("searchTotalCount").innerText()).toEqual(totalSearchCount);
});

test("Can use language dropdown", async ({ page }) => {
await page.locator('select[name="language"]').selectOption({ label: "Engelsk" });
await page.getByTestId("language-select").click();
await page.getByRole("option", { name: "Engelsk", exact: true }).click();
await page.getByTestId("audio-search-result").first().waitFor();
expect(await page.getByTestId("searchTotalCount").innerText()).toEqual("315");
await page.locator('select[name="language"]').selectOption({ label: "Velg språk" });
await page.getByTestId("remove-tag-button").click();
await page.getByTestId("audio-search-result").first().waitFor();
expect(await page.getByTestId("searchTotalCount").innerText()).toEqual(totalSearchCount);
});
30 changes: 18 additions & 12 deletions e2e/specs/search_content.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,55 +27,61 @@ test("Can use text input", async ({ page }) => {
});

test("Can use status dropdown", async ({ page }) => {
await page.locator('select[name="draft-status"]').selectOption({ label: "Publisert" });
await page.getByTestId("draft-status-select").click();
await page.getByRole("option", { name: "Publisert", exact: true }).click();
await page.getByTestId("content-search-result").first().waitFor();
expect(await page.getByTestId("searchTotalCount").innerText()).toEqual("17854");
await page.locator('select[name="draft-status"]').selectOption({ index: 0 });
await page.getByTestId("remove-tag-button").click();
await page.getByTestId("content-search-result").first().waitFor();
expect(await page.getByTestId("searchTotalCount").innerText()).toEqual(searchTotalCount);
});

test("Can use language dropdown", async ({ page }) => {
await page.locator('select[name="language"]').selectOption({ index: 1 });
await page.getByTestId("language-select").click();
await page.getByRole("option", { name: "Bokmål", exact: true }).click();
await page.getByTestId("content-search-result").first().waitFor();
expect(await page.getByTestId("searchTotalCount").innerText()).toEqual("24326");
await page.locator('select[name="language"]').selectOption({ index: 0 });
await page.getByTestId("remove-tag-button").click();
await page.getByTestId("content-search-result").first().waitFor();
expect(await page.getByTestId("searchTotalCount").innerText()).toEqual(searchTotalCount);
});

test("Can use subject dropdown", async ({ page }) => {
await page.locator('select[name="subjects"]').selectOption({ label: "Biologi 1" });
await page.getByTestId("subjects-select").click();
await page.getByRole("option", { name: "Biologi 1", exact: true }).click();
await page.getByTestId("content-search-result").first().waitFor();
expect(await page.getByTestId("searchTotalCount").innerText()).toEqual("620");
await page.locator('select[name="subjects"]').selectOption({ index: 0 });
await page.getByTestId("remove-tag-button").click();
await page.getByTestId("content-search-result").first().waitFor();
expect(await page.getByTestId("searchTotalCount").innerText()).toEqual(searchTotalCount);
});

test("Can use responsible dropdown", async ({ page }) => {
await page.locator('select[name="responsible-ids"]').selectOption({ label: "Ed Test" });
await page.getByTestId("responsible-ids-select").click();
await page.getByRole("option", { name: "Ed Test", exact: true }).click();
await page.getByTestId("content-search-result").first().waitFor();
expect(await page.getByTestId("searchTotalCount").innerText()).toEqual("33");
await page.locator('select[name="responsible-ids"]').selectOption({ index: 0 });
await page.getByTestId("remove-tag-button").click();
await page.getByTestId("content-search-result").first().waitFor();
expect(await page.getByTestId("searchTotalCount").innerText()).toEqual(searchTotalCount);
});

test("Can use user dropdown", async ({ page }) => {
await page.locator('select[name="users"]').selectOption({ label: "Ed Test" });
await page.getByTestId("users-select").click();
await page.getByRole("option", { name: "Ed Test", exact: true }).click();
await page.getByTestId("content-search-result").first().waitFor();
expect(await page.getByTestId("searchTotalCount").innerText()).toEqual("108");
await page.locator('select[name="users"]').selectOption({ index: 0 });
await page.getByTestId("remove-tag-button").click();
await page.getByTestId("content-search-result").first().waitFor();
expect(await page.getByTestId("searchTotalCount").innerText()).toEqual(searchTotalCount);
});

test("Can use content type dropdown", async ({ page }) => {
await page.locator('select[name="resource-types"]').selectOption({ label: "Arbeidsoppdrag" });
await page.getByTestId("resource-types-select").click();
await page.getByRole("option", { name: "Arbeidsoppdrag", exact: true }).click();
await page.getByTestId("content-search-result").first().waitFor();
expect(await page.getByTestId("searchTotalCount").innerText()).toEqual("551");
await page.locator('select[name="resource-types"]').selectOption({ index: 0 });
await page.getByTestId("remove-tag-button").click();
await page.getByTestId("content-search-result").first().waitFor();
expect(await page.getByTestId("searchTotalCount").innerText()).toEqual(searchTotalCount);
});
Expand Down
15 changes: 9 additions & 6 deletions e2e/specs/search_image.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,31 @@ test("Can use text input", async ({ page }) => {
});

test("Can use model released dropdown", async ({ page }) => {
await page.locator('select[name="model-released"]').selectOption({ index: 1 });
await page.getByTestId("model-released-select").click();
await page.getByRole("option", { name: "Modellklarert", exact: true }).click();
await page.getByTestId("image-search-result").first().waitFor();
expect(await page.getByTestId("searchTotalCount").innerText()).toEqual("2248");
await page.locator('select[name="model-released"]').selectOption({ index: 0 });
await page.getByTestId("remove-tag-button").click();
await page.getByTestId("image-search-result").first().waitFor();
expect(await page.getByTestId("searchTotalCount").innerText()).toEqual(totalSearchCount);
});

test("Can use language dropdown", async ({ page }) => {
await page.locator('select[name="language"]').selectOption({ index: 1 });
await page.getByTestId("language-select").click();
await page.getByRole("option", { name: "Bokmål", exact: true }).click();
await page.getByTestId("image-search-result").first().waitFor();
expect(await page.getByTestId("searchTotalCount").innerText()).toEqual("26966");
await page.locator('select[name="language"]').selectOption({ index: 0 });
await page.getByTestId("remove-tag-button").click();
await page.getByTestId("image-search-result").first().waitFor();
expect(await page.getByTestId("searchTotalCount").innerText()).toEqual(totalSearchCount);
});

test("Can use license dropdown", async ({ page }) => {
await page.locator('select[name="license"]').selectOption({ index: 1 });
await page.getByTestId("license-select").click();
await page.getByRole("option", { name: "CC0 Public domain dedication: Gitt til fellesskapet", exact: true }).click();
await page.getByTestId("image-search-result").first().waitFor();
expect(await page.getByTestId("searchTotalCount").innerText()).toEqual("906");
await page.locator('select[name="license"]').selectOption({ index: 0 });
await page.getByTestId("remove-tag-button").click();
await page.getByTestId("image-search-result").first().waitFor();
expect(await page.getByTestId("searchTotalCount").innerText()).toEqual(totalSearchCount);
});
6 changes: 3 additions & 3 deletions e2e/specs/taxonomy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ test.beforeEach(async ({ page }) => {
test("should have settingsMenu available after clicking button", async ({ page }) => {
await page.getByTestId("structure").getByRole("button", { name: "Engelsk 1" }).click();
await page.getByTestId("settings-button").click();
expect(await page.getByTestId("settings-menu-modal").count()).toEqual(1);
expect(await page.getByTestId("settings-menu-dialog").count()).toEqual(1);
});

test("should be able to change name of node", async ({ page }) => {
Expand All @@ -42,8 +42,8 @@ test("should be able to change visibility", async ({ page }) => {
await page.getByTestId("structure").getByRole("button", { name: "Engelsk 1" }).click();
await page.getByTestId("settings-button").click();
await page.getByTestId("toggleVisibilityButton").click();
expect(await page.getByLabel("Synlig").count()).toEqual(1);
expect(await page.getByLabel("Synlig").isChecked()).toBeTruthy();
expect(await page.getByLabel("Synlig", { exact: true }).count()).toEqual(1);
expect(await page.getByLabel("Synlig", { exact: true }).isChecked()).toBeTruthy();
});

test("can toggle favourites", async ({ page }) => {
Expand Down
16 changes: 16 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* Copyright (c) 2024-present, NDLA.
*
* This source code is licensed under the GPLv3 license found in the
* LICENSE file in the root directory of this source tree.
*
*/

// @ts-check

import config from "eslint-config-ndla";
import tseslint from "typescript-eslint";

export default tseslint.config(...config, {
ignores: ["**/h5pResizer.ts"],
});
86 changes: 41 additions & 45 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"clean": "node scripts/clean.mjs",
"check-all": "yarn lint && yarn tsc --noEmit && yarn test",
"lint": "yarn format-check && yarn lint-es",
"lint-es": "eslint --cache --cache-location '.eslintcache/' --ext .js,.jsx,.ts,.tsx --max-warnings=0 src",
"lint-es": "eslint --cache --cache-location '.eslintcache/' --max-warnings=0 src",
"format-check": "prettier '{src,scripts}/**/*(*.js|*.jsx|*.ts|*.tsx)' --check",
"format": "prettier '{src,scripts}/**/*(*.js|*.jsx|*.ts|*.tsx)' --write",
"start:tsc": "tsc -b -w --preserveWatchOutput",
Expand All @@ -31,80 +31,76 @@
"npm": ">=8.0.0"
},
"devDependencies": {
"@babel/core": "^7.24.5",
"@emotion/babel-plugin": "11.11.0",
"@emotion/eslint-plugin": "11.11.0",
"@emotion/jest": "11.11.0",
"@ndla/preset-panda": "^0.0.44",
"@ndla/scripts": "^2.1.2",
"@ndla/types-backend": "^0.2.96",
"@babel/core": "^7.26.0",
"@emotion/jest": "11.13.0",
"@ndla/preset-panda": "^0.0.48",
"@ndla/scripts": "^2.1.3",
"@ndla/types-backend": "^0.2.98",
"@ndla/types-embed": "^5.0.4-alpha.0",
"@ndla/types-taxonomy": "^1.0.30",
"@pandacss/dev": "^0.46.1",
"@pandacss/dev": "^0.48.0",
"@playwright/test": "^1.42.0",
"@tanstack/react-query-devtools": "^5.7.2",
"@tanstack/react-query-devtools": "^5.62.3",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.0.1",
"@testing-library/react": "^16.1.0",
"@testing-library/user-event": "^14.5.2",
"@types/auth0-js": "^9.13.2",
"@types/diff-match-patch": "^1.0.32",
"@types/express": "^5.0.0",
"@types/is-hotkey": "^0.1.10",
"@types/lodash": "^4.17.10",
"@types/node": "^20.12.12",
"@types/node-fetch": "^2.6.2",
"@types/prismjs": "^1.26.0",
"@types/react": "^18.3.2",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.1",
"concurrently": "^8.2.2",
"@vitejs/plugin-react": "^4.3.4",
"concurrently": "^9.1.0",
"cross-env": "^7.0.3",
"esbuild": "^0.20.2",
"eslint": "^8.57.0",
"eslint-config-ndla": "^5.0.3",
"esbuild": "^0.24.0",
"eslint": "^9.15.0",
"eslint-config-ndla": "^6.0.0-alpha.0",
"filter-console": "^0.1.1",
"jsdom": "^25.0.1",
"nock": "^13.5.4",
"postcss": "^8.4.39",
"postcss": "^8.4.49",
"postcss-import": "^16.1.0",
"postcss-preset-env": "^9.6.0",
"postcss-preset-env": "^10.1.1",
"postcss-reporter": "^7.1.0",
"sirv": "^2.0.4",
"tsx": "^4.7.2",
"typescript": "^5.6.3",
"vite": "^5.4.8",
"vitest": "^2.1.1"
"sirv": "^3.0.0",
"tsx": "^4.19.2",
"typescript": "^5.7.2",
"typescript-eslint": "^8.16.0",
"vite": "^6.0.1",
"vitest": "^2.1.6"
},
"dependencies": {
"@ark-ui/react": "^4.1.2",
"@dnd-kit/core": "^6.0.8",
"@dnd-kit/modifiers": "^6.0.1",
"@dnd-kit/sortable": "^7.0.2",
"@dnd-kit/utilities": "^3.2.1",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.0",
"@fontsource/source-code-pro": "^4.5.9",
"@fontsource/source-sans-pro": "^4.5.9",
"@fontsource/source-serif-pro": "^4.5.7",
"@ndla/article-converter": "^10.0.73-alpha.0",
"@ndla/audio-search": "^7.0.60-alpha.0",
"@ndla/button": "^15.0.44-alpha.0",
"@ndla/error-reporter": "^2.0.4",
"@ndla/hooks": "^2.1.9",
"@ndla/icons": "^8.0.43-alpha.0",
"@ndla/image-search": "^11.0.62-alpha.0",
"@ndla/licenses": "^8.0.3-alpha.0",
"@ndla/primitives": "^1.0.54-alpha.0",
"@ndla/safelink": "^7.0.55-alpha.0",
"@ndla/styled-system": "^0.0.27",
"@ndla/tracker": "^5.0.11-alpha.0",
"@ndla/ui": "^56.0.70-alpha.0",
"@ndla/util": "^5.0.0-alpha.0",
"@ndla/video-search": "^8.0.59-alpha.0",
"@radix-ui/react-popover": "^1.0.3",
"@radix-ui/react-portal": "^1.0.3",
"@radix-ui/react-toolbar": "^1.0.4",
"@tanstack/react-query": "5.7.2",
"@ndla/article-converter": "^10.0.81-alpha.0",
"@ndla/audio-search": "^7.0.68-alpha.0",
"@ndla/error-reporter": "^2.0.7",
"@ndla/hooks": "^2.1.11",
"@ndla/icons": "^8.0.48-alpha.0",
"@ndla/image-search": "^11.0.70-alpha.0",
"@ndla/licenses": "^8.0.5-alpha.0",
"@ndla/primitives": "^1.0.62-alpha.0",
"@ndla/safelink": "^7.0.63-alpha.0",
"@ndla/styled-system": "^0.0.29",
"@ndla/tracker": "^5.0.14-alpha.0",
"@ndla/ui": "^56.0.78-alpha.0",
"@ndla/util": "^5.0.3-alpha.0",
"@ndla/video-search": "^8.0.67-alpha.0",
"@tanstack/react-query": "5.62.3",
"auth0-js": "^9.22.1",
"cheerio": "^1.0.0-rc.12",
"compression": "^1.7.4",
Expand All @@ -121,7 +117,7 @@
"he": "^1.2.0",
"helmet": "^3.23.3",
"history": "^5.1.0",
"html-react-parser": "^5.1.8",
"html-react-parser": "^5.2.0",
"htmldiff-js": "^1.0.5",
"i18next": "^23.11.5",
"is-hotkey": "^0.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/components/Accordion/FormAccordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import { ReactNode, memo } from "react";
import { ArrowDownShortLine } from "@ndla/icons/common";
import { ArrowDownShortLine } from "@ndla/icons";
import {
AccordionItem,
AccordionItemContent,
Expand Down
Loading

0 comments on commit 7127d26

Please sign in to comment.