Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit 578310a

Browse files
committed
test(ckeditor5): add check for translation override
1 parent 93f544a commit 578310a

File tree

2 files changed

+39
-21
lines changed

2 files changed

+39
-21
lines changed

packages/ckeditor5-admonition/vitest.config.ts

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,12 @@ export default defineConfig( {
1111
svg()
1212
],
1313
test: {
14-
browser: {
15-
enabled: true,
16-
name: 'chrome',
17-
provider: 'webdriverio',
18-
providerOptions: {},
19-
headless: true,
20-
ui: false
21-
},
14+
environment: "happy-dom",
2215
include: [
2316
'tests/**/*.[jt]s'
2417
],
2518
globals: true,
2619
watch: false,
27-
passWithNoTests: true,
28-
coverage: {
29-
thresholds: {
30-
lines: 100,
31-
functions: 100,
32-
branches: 100,
33-
statements: 100
34-
},
35-
provider: 'istanbul',
36-
include: [
37-
'src'
38-
]
39-
}
20+
passWithNoTests: true
4021
}
4122
} );
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { it } from "vitest";
2+
import { describe } from "vitest";
3+
import { ClassicEditor } from "../src/index.js";
4+
import { type BalloonEditor, type ButtonView, type Editor } from "ckeditor5";
5+
import { beforeEach } from "vitest";
6+
import { expect } from "vitest";
7+
8+
describe("Text snippets", () => {
9+
let editorElement: HTMLDivElement;
10+
let editor: Editor;
11+
12+
beforeEach(async () => {
13+
editorElement = document.createElement( 'div' );
14+
document.body.appendChild( editorElement );
15+
16+
console.log("Trigger each");
17+
18+
editor = await ClassicEditor.create(editorElement, {
19+
licenseKey: "GPL",
20+
toolbar: {
21+
items: [
22+
"insertTemplate"
23+
]
24+
}
25+
});
26+
});
27+
28+
it("uses correct translations", () => {
29+
const itemsWithButtonView = Array.from(editor.ui.view.toolbar?.items)
30+
.filter(item => "buttonView" in item)
31+
.map(item => (item.buttonView as ButtonView).label);
32+
33+
expect(itemsWithButtonView).not.toContain("Insert template");
34+
expect(itemsWithButtonView).toContain("Insert text snippet");
35+
});
36+
});
37+

0 commit comments

Comments
 (0)