Skip to content

Commit

Permalink
test(framework): Fix MyMainControllerTest
Browse files Browse the repository at this point in the history
  • Loading branch information
Clashsoft committed Mar 4, 2024
1 parent f2b39c9 commit 86ef036
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.fulib.fx.mocking;

import io.reactivex.rxjava3.core.Observable;
import javafx.application.Platform;
import org.fulib.fx.mocking.controller.MyMainController;
import org.fulib.fx.mocking.controller.MySubComponent;
import org.fulib.fx.mocking.service.MyService;
Expand Down Expand Up @@ -41,11 +42,12 @@ public void test() {
// We want to mock the subcomponent to override the onRender method
doNothing().when(mySubComponent).onRender();

MyApp.FX_SCHEDULER.scheduleDirect(() -> stage.requestFocus());
Platform.runLater(() -> {
stage.requestFocus();
app.show(myMainController); // Show the main controller
});
waitForFxEvents();

app.show(myMainController); // Show the main controller

assertNotNull(lookup("This is a test string."));
assertEquals(List.of(), mySubComponent.getChildren());
}
Expand Down

0 comments on commit 86ef036

Please sign in to comment.