Package org.zanata.webtrans.client.events

Examples of org.zanata.webtrans.client.events.WorkspaceContextUpdateEvent


            factories.put(WorkspaceContextUpdate.class,
                    new EventFactory<WorkspaceContextUpdateEvent>() {
                        @Override
                        public WorkspaceContextUpdateEvent create(
                                SessionEventData event) {
                            return new WorkspaceContextUpdateEvent(
                                    (HasWorkspaceContextUpdateData) event);
                        }
                    });

            factories.put(TransUnitEdit.class,
View Full Code Here


    }

    @Test
    public void onWorkspaceContextUpdateEventBecomeReadOnly() {
        // Given: event sets workspace to read only
        WorkspaceContextUpdateEvent event =
                mock(WorkspaceContextUpdateEvent.class);
        when(event.isProjectActive()).thenReturn(false);
        userWorkspaceContext.setHasEditTranslationAccess(false);

        // When:
        presenter.onWorkspaceContextUpdated(event);
View Full Code Here

    @Test
    public void onWorkspaceContextUpdateEventFromReadOnlyToWritable() {
        // Given: event sets workspace to writable and we first have workspace
        // as read only
        userWorkspaceContext.setProjectActive(false);
        WorkspaceContextUpdateEvent event =
                mock(WorkspaceContextUpdateEvent.class);
        when(event.isProjectActive()).thenReturn(true);

        // When:
        presenter.onWorkspaceContextUpdated(event);

        // Then:
View Full Code Here

        when(messages.notifyReadOnlyWorkspace()).thenReturn(
                "readonly workspace");
        ArgumentCaptor<NotificationEvent> eventCaptor =
                ArgumentCaptor.forClass(NotificationEvent.class);

        presenter.onWorkspaceContextUpdated(new WorkspaceContextUpdateEvent(
                contextUpdateData(false, ProjectType.Podir)));

        verify(eventBus).fireEvent(eventCaptor.capture());
        NotificationEvent event = eventCaptor.getValue();
        assertThat(event.getMessage(), Matchers.equalTo("readonly workspace"));
View Full Code Here

        when(messages.notifyEditableWorkspace()).thenReturn(
                "editable workspace");
        ArgumentCaptor<NotificationEvent> eventCaptor =
                ArgumentCaptor.forClass(NotificationEvent.class);

        presenter.onWorkspaceContextUpdated(new WorkspaceContextUpdateEvent(
                contextUpdateData(true, ProjectType.Podir)));

        verify(eventBus).fireEvent(eventCaptor.capture());
        NotificationEvent event = eventCaptor.getValue();
        assertThat(event.getMessage(), Matchers.equalTo("editable workspace"));
View Full Code Here

    }

    @Test
    public void canSetReadOnlyOnWorkspaceUpdate() {
        // Given: project become inactive
        WorkspaceContextUpdateEvent workspaceContextUpdateEvent =
                new WorkspaceContextUpdateEvent(workplaceContextData(false,
                        ProjectType.Podir));
        when(userWorkspaceContext.hasReadOnlyAccess()).thenReturn(true);
        when(userOptionsService.getConfigHolder()).thenReturn(configHolder);

        // When:
View Full Code Here

                ShortcutContext.Navigation, false);
    }

    @Test
    public void onWorkspaceContextUpdate() {
        WorkspaceContextUpdateEvent event =
                mock(WorkspaceContextUpdateEvent.class);
        when(event.isProjectActive()).thenReturn(false);

        presenter.onWorkspaceContextUpdated(event);
        assertThat(userWorkspaceContext.hasReadOnlyAccess(), Matchers.is(true));
        verify(transMemoryPresenter).unbind();
        verify(glossaryPresenter).unbind();
View Full Code Here

    }

    @Test
    public void canSetReadOnlyOnWorkspaceUpdate() {
        // Given: project become inactive
        WorkspaceContextUpdateEvent workspaceContextUpdateEvent =
                new WorkspaceContextUpdateEvent(workplaceContextData(false,
                        ProjectType.Podir));
        when(userWorkspaceContext.hasReadOnlyAccess()).thenReturn(true);

        // When:
        presenter.onBind();
View Full Code Here

        verifyZeroInteractions(mockDisplay);
    }

    @Test
    public void onWorkspaceContextUpdated() {
        WorkspaceContextUpdateEvent event =
                new WorkspaceContextUpdateEvent(workplaceContextData(true,
                        ProjectType.Gettext));
        documentListPresenter.onWorkspaceContextUpdated(event);

        verify(mockDisplay).setEnableDownloadZip(
                documentListPresenter.isZipFileDownloadAllowed(event
                        .getProjectType()));
        verify(mockDisplay).setDownloadZipButtonTitle(isA(String.class));
    }
View Full Code Here

    @Test
    public void onWorkspaceContextUpdated() {
        // Given: on workspace context update event: project active is true but
        // userWorkspaceContext has read only access
        WorkspaceContextUpdateEvent workspaceContextEvent =
                mock(WorkspaceContextUpdateEvent.class);
        when(workspaceContextEvent.isProjectActive()).thenReturn(true);
        when(userWorkspaceContext.hasReadOnlyAccess()).thenReturn(true);

        presenter.onWorkspaceContextUpdated(workspaceContextEvent);

        // Then:
        verify(userWorkspaceContext).setProjectActive(
                workspaceContextEvent.isProjectActive());
        verify(display).setChatTabVisible(false);
        verify(display, times(1)).setSelectedTab(
                SideMenuDisplay.NOTIFICATION_VIEW);
        verify(display).setValidationOptionsTabVisible(false);
    }
View Full Code Here

TOP

Related Classes of org.zanata.webtrans.client.events.WorkspaceContextUpdateEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.