use of com.aire.ux.test.ViewTest in project aire-components by aire-ux.
the class ModuleGridTest method ensureModuleGridContainsDefaultPlugin.
@ViewTest
@SuppressWarnings({ "unchecked", "rawtypes" })
void ensureModuleGridContainsDefaultPlugin(@Context TestContext context, @Context Instantiator instantiator) {
val grid = instantiator.createComponent(ModuleGrid.class);
val $ = context.downTo(grid);
val g = $.selectFirst(Grid.class).get();
assertEquals(g.getDataProvider().size(new Query()), 1);
}
use of com.aire.ux.test.ViewTest in project aire-components by aire-ux.
the class CanvasTest method ensureAddingVertexListenerWorks.
@ViewTest
void ensureAddingVertexListenerWorks(@View Canvas canvas) {
assertEquals(0, canvas.getModel().getListenerCount());
val registration = canvas.addCellListener(EventType.Clicked, vertex -> {
}, vertex -> vertex.getProperties().containsKey("hello"));
canvas.onComponentEvent(mock(CanvasReadyEvent.class));
assertEquals(1, canvas.getModel().getListenerCount());
registration.remove();
assertEquals(0, canvas.getModel().getListenerCount());
}
use of com.aire.ux.test.ViewTest in project aire-components by aire-ux.
the class CanvasTest method ensureCanvasInvocationAPIMakesSense.
@ViewTest
void ensureCanvasInvocationAPIMakesSense(@View Canvas canvas, @Context(mode = Mode.Spy) UI ui) throws IOException {
val result = VertexTemplate.newBuilder("test").width(100f).height(100f).create();
val method = ClientMethods.withUiSupplier(() -> ui).get("addVertexTemplate", VertexTemplate.class);
val spiedElement = spy(canvas.getElement());
doReturn(spiedElement).when(canvas).getElement();
method.invoke(canvas, result);
verify(canvas, atLeast(2)).getElement();
verify(spiedElement).callJsFunction(eq("addVertexTemplate"), eq(writer.write(VertexTemplate.class, result)));
Mockito.reset(ui);
}
use of com.aire.ux.test.ViewTest in project aire-components by aire-ux.
the class TopLevelVaadinTestCaseTest method ensureTestMethodWithViewTestGeneratesFrameEntryWithMethod.
@ViewTest
@Navigate("test")
@Routes(scanPackage = "com.aire.ux.test.vaadin.scenarios.classroutes")
void ensureTestMethodWithViewTestGeneratesFrameEntryWithMethod() {
val method = Frames.resolveCurrentFrame().getContext().getTestMethod();
assertTrue(method.isPresent());
}
use of com.aire.ux.test.ViewTest in project aire-components by aire-ux.
the class ThemeTest method ensureThemeDecoratesButton.
@ViewTest
@Navigate("main")
void ensureThemeDecoratesButton(@Context TestContext context) {
val result = context.selectFirst("aire-button.test-theme", TestButton.class);
assertTrue(result.isPresent());
}
Aggregations