Search in sources :

Example 6 with UIConstants

use of org.activityinfo.client.i18n.UIConstants in project activityinfo by bedatadriven.

the class DesignTest method testDeleteEnabled.

@Test
public void testDeleteEnabled() {
    // Dummy Data
    SchemaDTO schema = DTOs.pear();
    // Collaborator
    DispatcherStub service = new DispatcherStub();
    service.setResult(GetSchema.class, schema);
    service.setResult(Delete.class, new VoidResult());
    // Collaborator
    DesignPresenter.View view = createNiceMock(DesignPresenter.View.class);
    view.setActionEnabled(UIActions.DELETE, false);
    replay(view);
    // Collaborator
    UIConstants constants = createNiceMock(UIConstants.class);
    replay(constants);
    DesignPresenter designer = new DesignPresenter(new MockEventBus(), service, new StateManagerStub(), view, constants);
    designer.go(schema.getDatabaseById(1));
    // Verify that the delete command is initially disabled
    verify(view);
    // Verify that the delete command is enabled when an activity is
    // selected
    resetToDefault(view);
    view.setActionEnabled(UIActions.DELETE, true);
    replay(view);
    designer.onSelectionChanged(schema.getActivityById(91));
    verify(view);
    // Verify that the delete command is disabled when a folder is selected
    reset(view);
    view.setActionEnabled(UIActions.DELETE, false);
    replay(view);
    designer.onSelectionChanged(new IndicatorFolder(null));
    verify(view);
}
Also used : VoidResult(org.activityinfo.shared.command.result.VoidResult) MockEventBus(org.activityinfo.client.MockEventBus) DispatcherStub(org.activityinfo.client.dispatch.DispatcherStub) UIConstants(org.activityinfo.client.i18n.UIConstants) StateManagerStub(org.activityinfo.client.mock.StateManagerStub) SchemaDTO(org.activityinfo.shared.dto.SchemaDTO) Test(org.junit.Test)

Aggregations

UIConstants (org.activityinfo.client.i18n.UIConstants)6 MockEventBus (org.activityinfo.client.MockEventBus)5 DispatcherStub (org.activityinfo.client.dispatch.DispatcherStub)5 StateManagerStub (org.activityinfo.client.mock.StateManagerStub)5 SchemaDTO (org.activityinfo.shared.dto.SchemaDTO)5 Test (org.junit.Test)5 VoidResult (org.activityinfo.shared.command.result.VoidResult)4 ActivityDTO (org.activityinfo.shared.dto.ActivityDTO)3 Record (com.extjs.gxt.ui.client.store.Record)2 TreeStore (com.extjs.gxt.ui.client.store.TreeStore)2 UpdateEntity (org.activityinfo.shared.command.UpdateEntity)2 JdbcDatabase (com.bedatadriven.rebar.sql.server.jdbc.JdbcDatabase)1 ModelData (com.extjs.gxt.ui.client.data.ModelData)1 UIMessages (org.activityinfo.client.i18n.UIMessages)1 NavigationCallback (org.activityinfo.client.page.NavigationCallback)1 ConfirmCallback (org.activityinfo.client.page.common.grid.ConfirmCallback)1 DataEntryPlace (org.activityinfo.client.page.entry.place.DataEntryPlace)1 Delete (org.activityinfo.shared.command.Delete)1 CreateResult (org.activityinfo.shared.command.result.CreateResult)1 Before (org.junit.Before)1