Файли
openidea/e2e/javaFieldStyle.spec.ts
T
l0ng-ai d55f116add feat(editor): style Java static, constant and final fields separately (#7930)
Java fields get their own colour scheme attributes under Java > Class Fields: instance field, instance final field, static field and constant (static final field), each falling back through the field kind it refines to Language Defaults > Identifiers > Static field / Instance field. Interface fields count as constants. The resolver and settings preview follow the whole inherit chain; .icls import maps the matching attributes.

Fixes #7643
2026-12-04 11:17:26 +08:00

26 рядки
1.3 KiB
TypeScript

import { expect, test } from "@playwright/test";
test("Java Class Fields styles apply per field kind and fall back to the Language Defaults (#7643)", async ({
page,
}) => {
await page.goto("/e2e/javaFieldStyle.html");
const instance = page.locator(".cm-sem-java-instance-field");
const instanceFinal = page.locator(".cm-sem-java-instance-final-field");
const staticField = page.locator(".cm-sem-java-static-field");
const constant = page.locator(".cm-sem-java-constant");
await expect(constant).toHaveText("MAX");
// Only the constant is bold; both static kinds keep the Language Defaults static field colour and italic.
await expect(constant).toHaveCSS("font-weight", "700");
await expect(constant).toHaveCSS("font-style", "italic");
await expect(constant).toHaveCSS("color", "rgb(152, 118, 170)");
await expect(staticField).toHaveCSS("font-weight", "400");
await expect(staticField).toHaveCSS("font-style", "italic");
await expect(staticField).toHaveCSS("color", "rgb(152, 118, 170)");
// Instance fields stay upright; the final one has its own colour.
await expect(instance).toHaveCSS("font-style", "normal");
await expect(instance).toHaveCSS("font-weight", "400");
await expect(instanceFinal).toHaveCSS("color", "rgb(204, 120, 50)");
await expect(instanceFinal).toHaveCSS("font-style", "normal");
});