Package org.zanata.webtrans.client.history

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


        configHolder.setFilterByUntranslated(true);
        configHolder.setFilterByApproved(true);
        configHolder.setFilterByRejected(true);
        configHolder.setFilterByHasError(true);

        HistoryToken historyToken = new HistoryToken();
        when(history.getHistoryToken()).thenReturn(historyToken);

        presenter
                .onUserConfigChanged(UserConfigChangeEvent.EDITOR_CONFIG_CHANGE_EVENT);

        verify(display).setTranslatedFilter(
                configHolder.getState().isFilterByTranslated());
        verify(display).setNeedReviewFilter(
                configHolder.getState().isFilterByFuzzy());
        verify(display).setUntranslatedFilter(
                configHolder.getState().isFilterByUntranslated());
        verify(display).setApprovedFilter(
                configHolder.getState().isFilterByApproved());
        verify(display).setRejectedFilter(
                configHolder.getState().isFilterByRejected());
        verify(display).setHasErrorFilter(
                configHolder.getState().isFilterByHasError());

        assertThat(
                historyToken.isFilterTranslated(),
                Matchers.equalTo(configHolder.getState().isFilterByTranslated()));
        assertThat(historyToken.isFilterFuzzy(),
                Matchers.equalTo(configHolder.getState().isFilterByFuzzy()));
        assertThat(historyToken.isFilterUntranslated(),
                Matchers.equalTo(configHolder.getState()
                        .isFilterByUntranslated()));
        assertThat(historyToken.isFilterApproved(),
                Matchers.equalTo(configHolder.getState().isFilterByApproved()));
        assertThat(historyToken.isFilterRejected(),
                Matchers.equalTo(configHolder.getState().isFilterByRejected()));
        assertThat(historyToken.isFilterHasError(),
                Matchers.equalTo(configHolder.getState().isFilterByHasError()));
    }
View Full Code Here


                Matchers.equalTo(configHolder.getState().isFilterByHasError()));
    }

    @Test
    public void onMessageFilterOptionChanged() {
        HistoryToken historyToken = new HistoryToken();
        when(history.getHistoryToken()).thenReturn(historyToken);

        presenter.messageFilterOptionChanged(true, false, true, true, false,
                false);

        UserConfigHolder configHolder = userOptionsService.getConfigHolder();
        assertThat(configHolder.getState().isFilterByTranslated(),
                Matchers.equalTo(true));
        assertThat(configHolder.getState().isFilterByFuzzy(),
                Matchers.equalTo(false));
        assertThat(configHolder.getState().isFilterByUntranslated(),
                Matchers.equalTo(true));
        assertThat(configHolder.getState().isFilterByApproved(),
                Matchers.equalTo(true));
        assertThat(configHolder.getState().isFilterByRejected(),
                Matchers.equalTo(false));
        assertThat(configHolder.getState().isFilterByHasError(),
                Matchers.equalTo(false));
        assertThat(historyToken.isFilterTranslated(), Matchers.equalTo(true));
        assertThat(historyToken.isFilterFuzzy(), Matchers.equalTo(false));
        assertThat(historyToken.isFilterUntranslated(), Matchers.equalTo(true));
        assertThat(historyToken.isFilterApproved(), Matchers.equalTo(true));
        assertThat(historyToken.isFilterRejected(), Matchers.equalTo(false));
        assertThat(historyToken.isFilterHasError(), Matchers.equalTo(false));
        verify(history).newItem(historyToken);
    }
View Full Code Here

        capturedSearchButtonClickHandler.getValue().onClick(clickEvent);

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

        HistoryToken newToken = capturedHistoryToken.getValue();
        assertThat(
                "new history token should be updated with current search phrase in search text box",
                newToken.getProjectSearchText(), is(TEST_SEARCH_PHRASE));
        assertThat(
                "new history token project search case sensitivity should match checkbox value",
                newToken.getProjectSearchCaseSensitive(),
                is(caseSensitiveFalseValue));
        assertThat(
                "new history token should reflect search in target when selected search field is target",
                newToken.isProjectSearchInTarget(), is(true));
        assertThat(
                "new history token should reflect not to search in source when selected search field is target",
                newToken.isProjectSearchInSource(), is(false));
    }
View Full Code Here

                capturedSearchButtonClickHandler.capture());

        capturedSearchButtonClickHandler.getValue().onClick(clickEvent);

        verify(mockHistory).newItem(capturedHistoryToken.capture());
        HistoryToken newToken = capturedHistoryToken.getValue();
        assertThat(
                "new history token project search case sensitivity should match checkbox value",
                newToken.getProjectSearchCaseSensitive(),
                is(caseSensitiveTrueValue));
    }
View Full Code Here

                capturedSearchButtonClickHandler.capture());
        capturedSearchButtonClickHandler.getValue().onClick(clickEvent);

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

        HistoryToken newToken = capturedHistoryToken.getValue();
        assertThat(
                "new history token should reflect search in source when selected search field is source",
                newToken.isProjectSearchInSource(), is(true));
        assertThat(
                "new history token should reflect not to search in target when selected search field is source",
                newToken.isProjectSearchInTarget(), is(false));
    }
View Full Code Here

        capturedSearchButtonClickHandler.getValue().onClick(clickEvent);

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

        HistoryToken newToken = capturedHistoryToken.getValue();
        assertThat(
                "new history token should reflect search in source when selected search field is both",
                newToken.isProjectSearchInSource(), is(true));
        assertThat(
                "new history token should reflect search in target when selected search field is both",
                newToken.isProjectSearchInTarget(), is(true));
    }
View Full Code Here

        capturedReplacementTextBoxValueChangeHandler.getValue().onValueChange(
                valueChangeEvent);

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

        HistoryToken newToken = capturedHistoryToken.getValue();
        assertThat(
                "new history token should be updated with current replacement phrase",
                newToken.getProjectSearchReplacement(), is(TEST_REPLACE_PHRASE));
    }
View Full Code Here

        mockDisplay.setSearching(false);
        mockSearchResponseLabel.setText(searchResponseInfoMessage);
    }

    private void simulateSearch() {
        HistoryToken token = searchPageHistoryToken();
        token.setProjectSearchText(TEST_SEARCH_PHRASE);
    }
View Full Code Here

    /**
     * @return a history token with defaults except current page is search page
     */
    private HistoryToken searchPageHistoryToken() {
        HistoryToken historyToken = new HistoryToken();
        historyToken.setView(MainView.Search);
        return historyToken;
    }
View Full Code Here

TOP

Related Classes of org.zanata.webtrans.client.history.HistoryToken

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.