diff --git a/apps/nativescript-demo-ng/src/tests/css-variables.spec.ts b/apps/nativescript-demo-ng/src/tests/css-variables.spec.ts new file mode 100644 index 0000000..5dffb7b --- /dev/null +++ b/apps/nativescript-demo-ng/src/tests/css-variables.spec.ts @@ -0,0 +1,67 @@ +import { + Component, + ElementRef, + inject, + NO_ERRORS_SCHEMA, + Renderer2, + ViewChild, + ViewEncapsulation, +} from '@angular/core'; +import { TestBed } from '@angular/core/testing'; +import { NativeScriptCommonModule } from '@nativescript/angular'; +import { Color, Label } from '@nativescript/core'; + +// Styles are written in the namespaced form Angular >= 22.1 compiles custom properties to, +// so these specs hold regardless of the compiler version the demo app builds with. + +@Component({ + template: ``, + styles: ['.css-var-emulated { --%NS%probe-emulated: #ff0000; background-color: var(--%NS%probe-emulated); }'], + imports: [NativeScriptCommonModule], + schemas: [NO_ERRORS_SCHEMA], +}) +class EmulatedCssVarComponent { + @ViewChild('label', { static: true }) label: ElementRef