mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 10:02:59 +08:00
test(ckeditor5): add check for translation override
This commit is contained in:
parent
93f544a221
commit
578310a1c0
@ -11,31 +11,12 @@ export default defineConfig( {
|
|||||||
svg()
|
svg()
|
||||||
],
|
],
|
||||||
test: {
|
test: {
|
||||||
browser: {
|
environment: "happy-dom",
|
||||||
enabled: true,
|
|
||||||
name: 'chrome',
|
|
||||||
provider: 'webdriverio',
|
|
||||||
providerOptions: {},
|
|
||||||
headless: true,
|
|
||||||
ui: false
|
|
||||||
},
|
|
||||||
include: [
|
include: [
|
||||||
'tests/**/*.[jt]s'
|
'tests/**/*.[jt]s'
|
||||||
],
|
],
|
||||||
globals: true,
|
globals: true,
|
||||||
watch: false,
|
watch: false,
|
||||||
passWithNoTests: true,
|
passWithNoTests: true
|
||||||
coverage: {
|
|
||||||
thresholds: {
|
|
||||||
lines: 100,
|
|
||||||
functions: 100,
|
|
||||||
branches: 100,
|
|
||||||
statements: 100
|
|
||||||
},
|
|
||||||
provider: 'istanbul',
|
|
||||||
include: [
|
|
||||||
'src'
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
37
packages/ckeditor5/tests/templates.ts
Normal file
37
packages/ckeditor5/tests/templates.ts
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
import { it } from "vitest";
|
||||||
|
import { describe } from "vitest";
|
||||||
|
import { ClassicEditor } from "../src/index.js";
|
||||||
|
import { type BalloonEditor, type ButtonView, type Editor } from "ckeditor5";
|
||||||
|
import { beforeEach } from "vitest";
|
||||||
|
import { expect } from "vitest";
|
||||||
|
|
||||||
|
describe("Text snippets", () => {
|
||||||
|
let editorElement: HTMLDivElement;
|
||||||
|
let editor: Editor;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
editorElement = document.createElement( 'div' );
|
||||||
|
document.body.appendChild( editorElement );
|
||||||
|
|
||||||
|
console.log("Trigger each");
|
||||||
|
|
||||||
|
editor = await ClassicEditor.create(editorElement, {
|
||||||
|
licenseKey: "GPL",
|
||||||
|
toolbar: {
|
||||||
|
items: [
|
||||||
|
"insertTemplate"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("uses correct translations", () => {
|
||||||
|
const itemsWithButtonView = Array.from(editor.ui.view.toolbar?.items)
|
||||||
|
.filter(item => "buttonView" in item)
|
||||||
|
.map(item => (item.buttonView as ButtonView).label);
|
||||||
|
|
||||||
|
expect(itemsWithButtonView).not.toContain("Insert template");
|
||||||
|
expect(itemsWithButtonView).toContain("Insert text snippet");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user