Examples of HistoryToken


Examples of org.zanata.webtrans.client.history.HistoryToken

        verifyZeroInteractions(searchResultsPresenter);
    }

    @Test
    public void onProcessForProjectWideSearchWithoutReplacementTextChange() {
        HistoryToken token = new HistoryToken();
        token.setProjectSearchCaseSensitive(true);
        token.setProjectSearchInSource(false);
        token.setProjectSearchInTarget(true);
        token.setProjectSearchText("something");

        service.processForProjectWideSearch(token);

        verify(searchResultsPresenter).updateViewAndRun("something",
                token.getProjectSearchCaseSensitive(),
                token.isProjectSearchInSource(),
                token.isProjectSearchInTarget());
        verifyNoMoreInteractions(searchResultsPresenter);
    }
View Full Code Here

Examples of org.zanata.webtrans.client.history.HistoryToken

        verifyNoMoreInteractions(searchResultsPresenter);
    }

    @Test
    public void onProcessForProjectWideSearchWithReplacementTextChange() {
        HistoryToken token = new HistoryToken();
        token.setProjectSearchCaseSensitive(true);
        token.setProjectSearchInSource(false);
        token.setProjectSearchInTarget(true);
        token.setProjectSearchText("something");
        token.setProjectSearchReplacement("something else");

        service.processForProjectWideSearch(token);

        verify(searchResultsPresenter).updateViewAndRun("something",
                token.getProjectSearchCaseSensitive(),
                token.isProjectSearchInSource(),
                token.isProjectSearchInTarget());
        verify(searchResultsPresenter).updateReplacementText("something else");
    }
View Full Code Here

Examples of org.zanata.webtrans.client.history.HistoryToken

    public void onRequestSelectTableRowSamePage() {
        TransUnitId selectingId = new TransUnitId(1);

        DocumentInfo docInfo = TestFixture.documentInfo();

        HistoryToken mockHistoryToken = mock(HistoryToken.class);
        when(history.getHistoryToken()).thenReturn(mockHistoryToken);

        // When:
        service.onRequestSelectTableRow(new RequestSelectTableRowEvent(docInfo,
                selectingId));
View Full Code Here

Examples of org.zanata.webtrans.client.history.HistoryToken

        KeyShortcut editorKey = shortcuts.get(1);
        KeyShortcut searchKey = shortcuts.get(2);

        // testing handlers
        // doc key handler
        HistoryToken docToken = new HistoryToken();
        when(history.getHistoryToken()).thenReturn(docToken);
        docListKey.getHandler().onKeyShortcut(null);
        assertThat(docToken.getView(), Matchers.is(MainView.Documents));
        verify(history).newItem(docToken.toTokenString());

        // editor key handler on selected doc is null
        when(messages.noDocumentSelected()).thenReturn("no doc selected");
        editorKey.getHandler().onKeyShortcut(null);
        verify(eventBus).fireEvent(isA(NotificationEvent.class));

        // editor key handler on selected doc is NOT null
        HistoryToken editorToken = new HistoryToken();
        when(history.getHistoryToken()).thenReturn(editorToken);
        DocumentInfo selectedDocument = mock(DocumentInfo.class);
        presenter.setStatesForTest(null, null, MainView.Documents,
                selectedDocument);
        editorKey.getHandler().onKeyShortcut(null);
        assertThat(editorToken.getView(), Matchers.is(MainView.Editor));
        verify(history).newItem(editorToken.toTokenString());

        // search key handler
        HistoryToken searchToken = new HistoryToken();
        when(history.getHistoryToken()).thenReturn(searchToken);
        searchKey.getHandler().onKeyShortcut(null);
        assertThat(searchToken.getView(), Matchers.is(MainView.Search));
        verify(history).newItem(searchToken.toTokenString());
    }
View Full Code Here

Examples of org.zanata.webtrans.client.history.HistoryToken

        documentListPresenter.fireFilterToken(filterText);
        documentListPresenter.fireExactSearchToken(false);

        verify(mockHistory).newItem(capturedHistoryTokenString.capture());

        HistoryToken capturedHistoryToken =
                HistoryToken.fromTokenString(capturedHistoryTokenString
                        .getValue());
        assertThat(
                "generated history token filter text should match the filter textbox",
                capturedHistoryToken.getDocFilterText(), is(filterText));
        assertThat(
                "generated history token filter exact flag should match the exact match checkbox",
                capturedHistoryToken.getDocFilterExact(), is(false));
    }
View Full Code Here

Examples of org.zanata.webtrans.client.history.HistoryToken

        // simulate checking 'exact search' checkbox
        documentListPresenter.fireExactSearchToken(true);

        verify(mockHistory).newItem(capturedHistoryTokenString.capture());

        HistoryToken exactSearchToken = new HistoryToken();
        exactSearchToken.setDocFilterExact(true);
        assertThat(
                "checking the 'exact search' checkbox should be reflected in a new history token",
                capturedHistoryTokenString.getValue(),
                is(exactSearchToken.toTokenString()));
    }
View Full Code Here

Examples of org.zanata.webtrans.client.history.HistoryToken

    }

    @Test
    public void uncheckExactSearchCheckboxGeneratesHistoryToken() {
        // history reflects checkbox already checked
        HistoryToken exactSearchToken = new HistoryToken();
        exactSearchToken.setDocFilterExact(true);

        when(mockHistory.getToken()).thenReturn(
                exactSearchToken.toTokenString());

        documentListPresenter.bind();
        documentListPresenter.fireExactSearchToken(false);

        verify(mockHistory).newItem(capturedHistoryTokenString.capture());

        HistoryToken inexactSearchToken = new HistoryToken();
        inexactSearchToken.setDocFilterExact(false);
        assertThat(
                "unchecking the 'exact search' checkbox should be reflected in a new history token",
                capturedHistoryTokenString.getValue(),
                is(inexactSearchToken.toTokenString()));
    }
View Full Code Here

Examples of org.zanata.webtrans.client.history.HistoryToken

    // TODO tests for check and uncheck case sensitive check

    @Test
    public void documentSelectUpdatesHistoryToken() {
        HistoryToken documentPathToken = new HistoryToken();
        documentPathToken.setDocumentPath(null);
        when(mockHistory.getHistoryToken()).thenReturn(documentPathToken);

        documentListPresenter.bind();

        // simulate document click on second document
        DocumentInfo docInfo =
                new DocumentInfo(new DocumentId(2222L, ""), "doc122",
                        "second/path/", LocaleId.EN_US,
                        new ContainerTranslationStatistics(), new AuditInfo(
                                new Date(), "Translator"),
                        new HashMap<String, String>(), new AuditInfo(
                                new Date(), "last translator"));
        documentListPresenter.fireDocumentSelection(docInfo);

        verify(mockHistory).newItem(capturedHistoryToken.capture());
        verify(mockUserWorkspaceContext).setSelectedDoc(docInfo);

        HistoryToken newToken = capturedHistoryToken.getValue();
        assertThat("path of selected document should be set in history token",
                newToken.getDocumentPath(), is("second/path/doc122"));
        assertThat(
                "view in history token should change to individual document view when a new document is selected",
                newToken.getView(), is(MainView.Editor));
    }
View Full Code Here

Examples of org.zanata.webtrans.client.history.HistoryToken

        documentListPresenter.updateFilterAndRun(filterText, true, false);

        verify(mockDisplay).updateFilter(false, true, filterText);

        // simulate firing history change event
        HistoryToken historyTokenWithExactFilter = new HistoryToken();
        historyTokenWithExactFilter.setDocFilterText(filterText);
        historyTokenWithExactFilter.setDocFilterExact(true);

        ArrayList<DocumentInfo> expectedDocs = buildSampleDocumentArray();
        expectedDocs.remove(2); // third doc does not match the filter
        expectedDocs.remove(0); // first doc does not match the filter
        ArrayList<DocumentInfo> actualDocInfos = new ArrayList<DocumentInfo>();
View Full Code Here

Examples of org.zanata.webtrans.client.history.HistoryToken

        documentListPresenter.bind();
        documentListPresenter.updateFilterAndRun(filterText, false, false);
        documentListPresenter.setDocuments(buildSampleDocumentArray());

        // simulate firing history change event
        HistoryToken historyTokenWithFilter = new HistoryToken();
        historyTokenWithFilter.setDocFilterText(filterText);

        verify(mockDisplay).updateFilter(false, false, filterText);

        ArrayList<DocumentInfo> expectedDocs = buildSampleDocumentArray();
        expectedDocs.remove(1); // second doc does not match any of the filter
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.