File tree Expand file tree Collapse file tree
AndroidSwiftUICore/Tests/AndroidSwiftUICoreTests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -226,6 +226,34 @@ struct NavigationTests {
226226 #expect( host. callbacks. callback ( for: tap) != nil )
227227 }
228228
229+ @Test ( " A sheet carries its detents, and none by default " )
230+ func sheetDetents( ) {
231+ struct Screen : View {
232+ @State var shown = true
233+ var body : some View {
234+ Button ( " Show " ) { shown = true }
235+ . sheet ( isPresented: $shown) {
236+ Text ( " body " ) . presentationDetents ( [ . medium] )
237+ }
238+ }
239+ }
240+ let node = ViewHost ( Screen ( ) ) . evaluate ( )
241+ let sheet = node. children. first { $0. type == " Sheet " }
242+ #expect( sheet? . props [ " detents " ] == . array( [ . string( " medium " ) ] ) )
243+
244+ // no detents declared: the interpreter reads that as a full-height sheet
245+ struct Plain : View {
246+ @State var shown = true
247+ var body : some View {
248+ Button ( " Show " ) { shown = true }
249+ . sheet ( isPresented: $shown) { Text ( " body " ) }
250+ }
251+ }
252+ let plain = ViewHost ( Plain ( ) ) . evaluate ( )
253+ let plainSheet = plain. children. first { $0. type == " Sheet " }
254+ #expect( plainSheet? . props [ " detents " ] == . array( [ ] ) )
255+ }
256+
229257 @Test ( " TabView emits tabs with their item labels and selection " )
230258 func tabs( ) {
231259 struct Screen : View {
You can’t perform that action at this time.
0 commit comments