com.github.mvysny.kaributesting.v10.ListBox.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of karibu-testing-v10 Show documentation
Show all versions of karibu-testing-v10 Show documentation
Karibu Testing, support for browserless Vaadin testing in Kotlin
package com.github.mvysny.kaributesting.v10
import com.vaadin.flow.component.listbox.ListBoxBase
import com.vaadin.flow.data.provider.DataProvider
import java.lang.reflect.Method
/**
* Fetches renderings of items currently displayed in the list box component.
*/
public fun ListBoxBase<*, T, *>.getRenderedItems(): List {
val items: List = getItems()
return items.map { itemRenderer._getPresentationValue(it) }
}
/**
* Fetches all items currently displayed in the list box component.
*/
public fun ListBoxBase<*, T, *>.getItems(): List = dataProvider._findAll()
private val __ListBoxBase_getDataProvider: Method by lazy(LazyThreadSafetyMode.PUBLICATION) {
val m = ListBoxBase::class.java.getDeclaredMethod("getDataProvider")
m.isAccessible = true
m
}
/**
* `ListBoxBase.getDataProvider()` is private since Vaadin 24.0.0.beta1
*/
@Suppress("UNCHECKED_CAST")
public val ListBoxBase<*, T, *>.dataProvider: DataProvider
get() = __ListBoxBase_getDataProvider.invoke(this) as DataProvider