Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hidden-answer appearance for string with external app #6572

Open
lognaturel opened this issue Jan 27, 2025 · 0 comments
Open

Add hidden-answer appearance for string with external app #6572

lognaturel opened this issue Jan 27, 2025 · 0 comments

Comments

@lognaturel
Copy link
Member

We recently added the hidden-answer appearance for barcode. We've also had a request for the same appearance for external apps that return strings because those external apps can return very long/ugly values that are intended to be processed in some way before being shown to users.

We typically start a forum thread to consider new feature ideas but this feels like a clear enough extension of existing work that I think we can just make it so.

For ExStringWidgetTest:

    @Test
    public void whenPromptHasHiddenAnswerAppearance_answerIsNotDisplayed() {
        String appearance = "ex:my.cool.app(a_param=1,another=3) " + Appearances.HIDDEN_ANSWER;
        FormEntryPrompt prompt = new MockFormEntryPromptBuilder(promptWithAppearance(appearance))
                .withAnswer(new StringData("original contents"))
                .build();
        WidgetTestActivity widgetTestActivity = QuestionWidgetHelpers.widgetTestActivity();
        ExStringWidget widget = new ExStringWidget(widgetTestActivity, new QuestionDetails(prompt),
                new FakeWaitingForDataRegistry(), stringRequester);
        // Check initial value is not shown
        assertThat(widget.binding.widgetAnswerText.getVisibility(), equalTo(View.GONE));
        assertThat(widget.getAnswer(), equalTo(new StringData("original contents")));
        // Check updates aren't shown
        widget.setData("updated contents");
        assertThat(widget.binding.widgetAnswerText.getVisibility(), equalTo(View.GONE));
        assertThat(widget.getAnswer(), equalTo(new StringData("updated contents")));
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ready
Development

No branches or pull requests

1 participant