use of io.sunshower.zephyr.ui.navigation.NavigationBar in project aire-components by aire-ux.
the class ApplicationLayoutTest method ensureRegisteringSimpleComponentWorks.
@ViewTest
@DirtiesContext
void ensureRegisteringSimpleComponentWorks(@Autowired UserInterface ui, @Context TestContext $) {
val extension = new DefaultComponentExtension<>(":management-menu", (NavigationBar parent) -> {
val button = spy(new Button("Hello"));
parent.add(button);
});
var button = $.selectFirst("vaadin-button[text~=Hello]", Button.class);
assertFalse(button.isPresent());
val registration = ui.register(Selection.path(":main:navigation"), extension);
$.flush();
val menu = ui.selectFirst(Selection.path(":main:navigation:management-menu"));
assertNotNull(menu);
button = $.selectFirst("vaadin-button[text~=Hello]", Button.class);
assertTrue(button.isPresent());
registration.close();
$.flush(true);
assertEquals(0, ui.getExtensionRegistry().getExtensionCount());
button = $.selectFirst("vaadin-button[text~=Hello]", Button.class);
assertFalse(button.isPresent());
}
use of io.sunshower.zephyr.ui.navigation.NavigationBar in project aire-components by aire-ux.
the class ApplicationLayoutTest method ensureRegistrationWorksWithComponents.
@ViewTest
@DirtiesContext
void ensureRegistrationWorksWithComponents(@Context TestContext $, @Autowired UserInterface userInterface) {
val registration = userInterface.register(Selection.path(":main-2:navbar"), Extensions.create(":sup", (@NonNull NavigationBar b) -> {
b.add(new Button("hello"));
}));
assertTrue($.selectFirst("vaadin-button[text=hello]", Button.class).isEmpty());
val reg2 = userInterface.register(Mode.Global, MainNavigationComponent.class);
$.navigate(MainNavigationComponent.class);
assertTrue($.selectFirst("vaadin-button[text=hello]", Button.class).isPresent());
registration.close();
$.navigate(MainView.class);
assertTrue($.selectFirst("vaadin-button[text=hello]", Button.class).isEmpty());
$.navigate(MainNavigationComponent.class);
assertTrue($.selectFirst("vaadin-button[text=hello]", Button.class).isEmpty());
reg2.remove();
}
use of io.sunshower.zephyr.ui.navigation.NavigationBar in project aire-components by aire-ux.
the class ApplicationLayout method createNavigation.
protected HasComponents createNavigation() {
val navigation = new NavigationBar(Direction.Vertical);
navigation.setDrawer(new Drawer(Drawer.Direction.Vertical));
return navigation;
}
use of io.sunshower.zephyr.ui.navigation.NavigationBar in project aire-components by aire-ux.
the class AbstractModuleView method createNavigationBar.
/**
* protected members
*/
/**
* @return the navigation bar for this module view
*/
protected NavigationBar createNavigationBar() {
val navigationBar = new NavigationBar(NavigationBar.Direction.Vertical);
navigationBar.setDrawer(drawer);
return navigationBar;
}
use of io.sunshower.zephyr.ui.navigation.NavigationBar in project aire-components by aire-ux.
the class ApplicationLayoutTest method ensureActionManagerCanEnableAndDisableButtons.
@ViewTest
@DirtiesContext
void ensureActionManagerCanEnableAndDisableButtons(@Autowired UserInterface ui, @Context TestContext $) {
val action = spy(Actions.create("ui.module.stop", (self) -> {
}));
ui.register(Selection.path(":main:navigation"), Extensions.create(":management-menu", (NavigationBar p) -> {
val button = new Button("hello");
action.addActionEventListener(Type.ActionEnabled, (eventType, event) -> {
button.setEnabled(true);
});
action.addActionEventListener(Type.ActionDisabled, (eventType, event) -> {
button.setEnabled(true);
});
p.add(button);
}));
action.enable();
$.flush();
assertTrue($.selectFirst("vaadin-button[enabled]", Button.class).isPresent());
action.dispose();
}
Aggregations