use of com.vaadin.testbench.unit.ComponentWrapTest.Span in project testbench by vaadin.
the class ComponentQueryTest method withThemeMultipleThemes_getsCorrectComponent.
@Test
void withThemeMultipleThemes_getsCorrectComponent() {
Span target = new Span();
target.getElement().getThemeList().add("my-theme");
target.getElement().getThemeList().add("custom-theme");
final Span first = new Span();
first.getElement().getThemeList().add("my-theme");
final Span last = new Span();
last.getElement().getThemeList().add("my-theme");
UI.getCurrent().getElement().appendChild(first.getElement(), target.getElement(), last.getElement());
Assertions.assertEquals(target, $(Span.class).withTheme("my-theme").withTheme("custom-theme").findComponent());
}
use of com.vaadin.testbench.unit.ComponentWrapTest.Span in project testbench by vaadin.
the class ComponentQueryTest method withTheme_getsCorrectComponent.
@Test
void withTheme_getsCorrectComponent() {
Span target = new Span();
target.getElement().getThemeList().add("my-theme");
UI.getCurrent().getElement().appendChild(new Span().getElement(), target.getElement(), new Span().getElement());
Assertions.assertEquals(target, $(Span.class).withTheme("my-theme").findComponent());
}
use of com.vaadin.testbench.unit.ComponentWrapTest.Span in project testbench by vaadin.
the class ComponentQueryTest method withoutAttribute_multipleAttributes_getsCorrectComponents.
@Test
void withoutAttribute_multipleAttributes_getsCorrectComponents() {
Span span1 = new Span();
span1.getElement().setAttribute("role", "tooltip");
Span span2 = new Span();
span2.getElement().setAttribute("role", "something");
span2.getElement().setAttribute("aria-label", "some other text");
Span target = new Span();
target.getElement().setAttribute("role", "something");
UI.getCurrent().getElement().appendChild(span1.getElement(), target.getElement(), span2.getElement());
Assertions.assertSame(target, $(Span.class).withoutAttribute("aria-label").withoutAttribute("role", "tooltip").findComponent());
}
use of com.vaadin.testbench.unit.ComponentWrapTest.Span in project testbench by vaadin.
the class ComponentQueryTest method withAttribute_present_getsCorrectComponents.
@Test
void withAttribute_present_getsCorrectComponents() {
Span target = new Span();
target.getElement().setAttribute("my-attr", "value");
Span other = new Span();
other.getElement().setAttribute("other-attr", "value");
UI.getCurrent().getElement().appendChild(new Span().getElement(), target.getElement(), new Span().getElement(), other.getElement());
Assertions.assertSame(target, $(Span.class).withAttribute("my-attr").findComponent());
Assertions.assertSame(other, $(Span.class).withAttribute("other-attr").findComponent());
Assertions.assertTrue($(Span.class).withAttribute("nope").allComponents().isEmpty());
}
use of com.vaadin.testbench.unit.ComponentWrapTest.Span in project testbench by vaadin.
the class ComponentQueryTest method withoutThemeMultipleThemes_getsCorrectComponent.
@Test
void withoutThemeMultipleThemes_getsCorrectComponent() {
Span target = new Span();
target.getElement().getThemeList().add("selection-theme");
final Span first = new Span();
first.getElement().getThemeList().add("selection-theme");
first.getElement().getThemeList().add("my-theme");
final Span last = new Span();
last.getElement().getThemeList().add("selection-theme");
last.getElement().getThemeList().add("custom-theme");
UI.getCurrent().getElement().appendChild(first.getElement(), target.getElement(), last.getElement());
Assertions.assertEquals(target, $(Span.class).withoutTheme("my-theme").withoutTheme("custom-theme").findComponent());
}