@@ -54,6 +54,35 @@ function _test_platform_css_class(rootView: View, shouldSetClassName: boolean) {
5454 }
5555}
5656
57+ function _test_platform_sdk_css_class ( rootView : View , shouldSetClassName : boolean ) {
58+ if ( shouldSetClassName ) {
59+ rootView . className = CLASS_NAME ;
60+ }
61+
62+ const cssClasses = rootView . cssClasses ;
63+ const deviceType = Device . os . toLowerCase ( ) ;
64+ const majorVersion = Math . floor ( Utils . SDK_VERSION ) ;
65+ const sdkClass = `ns-${ deviceType } -${ majorVersion } ` ;
66+
67+ if ( isAndroid ) {
68+ const iosSdkClass = `ns-ios-${ majorVersion } ` ;
69+ const visionosSdkClass = `ns-visionos-${ majorVersion } ` ;
70+
71+ TKUnit . assertTrue ( cssClasses . has ( sdkClass ) , `${ sdkClass } CSS class is missing` ) ;
72+ TKUnit . assertFalse ( cssClasses . has ( iosSdkClass ) , `${ iosSdkClass } CSS class is present` ) ;
73+ TKUnit . assertFalse ( cssClasses . has ( visionosSdkClass ) , `${ visionosSdkClass } CSS class is present` ) ;
74+ } else {
75+ const androidSdkClass = `ns-android-${ majorVersion } ` ;
76+
77+ TKUnit . assertTrue ( cssClasses . has ( sdkClass ) , `${ sdkClass } CSS class is missing` ) ;
78+ TKUnit . assertFalse ( cssClasses . has ( androidSdkClass ) , `${ androidSdkClass } CSS class is present` ) ;
79+ }
80+
81+ if ( shouldSetClassName ) {
82+ TKUnit . assertTrue ( cssClasses . has ( CLASS_NAME ) , `${ CLASS_NAME } CSS class is missing` ) ;
83+ }
84+ }
85+
5786function _test_device_type_css_class ( rootView : View , shouldSetClassName : boolean ) {
5887 if ( shouldSetClassName ) {
5988 rootView . className = CLASS_NAME ;
@@ -188,6 +217,16 @@ export function test_root_view_class_name_preserve_platform_css_class() {
188217 _test_platform_css_class ( rootView , true ) ;
189218}
190219
220+ export function test_root_view_platform_sdk_css_class ( ) {
221+ const rootView = Application . getRootView ( ) ;
222+ _test_platform_sdk_css_class ( rootView , false ) ;
223+ }
224+
225+ export function test_root_view_class_name_preserve_platform_sdk_css_class ( ) {
226+ const rootView = Application . getRootView ( ) ;
227+ _test_platform_sdk_css_class ( rootView , true ) ;
228+ }
229+
191230export function test_root_view_device_type_css_class ( ) {
192231 const rootView = Application . getRootView ( ) ;
193232 _test_device_type_css_class ( rootView , false ) ;
@@ -218,6 +257,16 @@ export function test_root_view_class_name_preserve_system_appearance_css_class()
218257 _test_system_appearance_css_class ( rootView , true ) ;
219258}
220259
260+ export function test_root_view_layout_direction_css_class ( ) {
261+ const rootView = Application . getRootView ( ) ;
262+ _test_layout_direction_css_class ( rootView , false ) ;
263+ }
264+
265+ export function test_root_view_class_name_preserve_layout_direction_css_class ( ) {
266+ const rootView = Application . getRootView ( ) ;
267+ _test_layout_direction_css_class ( rootView , true ) ;
268+ }
269+
221270// Modal root view
222271function _test_modal_root_view_modal_css_class ( shouldSetClassName : boolean ) {
223272 let modalClosed = false ;
0 commit comments