Fix ConfirmationInput template message
- Fix confirmation-input-default.stg to use correct style names in format. - Fixes #690
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
// message
|
||||
message(model) ::= <%
|
||||
<if(model.message && model.hasMessageLevelError)>
|
||||
<(">>>"); format="level-error"> <model.message; format="level-error">
|
||||
<({<figures.error>}); format="style-level-error"> <model.message; format="style-level-error">
|
||||
<elseif(model.message && model.hasMessageLevelWarn)>
|
||||
<(">>"); format="level-warn"> <model.message; format="level-warn">
|
||||
<({<figures.warning>}); format="style-level-warn"> <model.message; format="style-level-warn">
|
||||
<elseif(model.message && model.hasMessageLevelInfo)>
|
||||
<(">"); format="level-info"> <model.message; format="level-info">
|
||||
<({<figures.info>}); format="style-level-info"> <model.message; format="style-level-info">
|
||||
<endif>
|
||||
%>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2022 the original author or authors.
|
||||
* Copyright 2022-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -181,4 +181,30 @@ public class ConfirmationInputTests extends AbstractShellTests {
|
||||
assertThat(run1Context.getResultValue()).isNotNull();
|
||||
assertThat(run1Context.getResultValue()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResultUserInputInvalidInput() throws InterruptedException, IOException {
|
||||
ComponentContext<?> empty = ComponentContext.empty();
|
||||
ConfirmationInput component1 = new ConfirmationInput(getTerminal(), "component1");
|
||||
component1.setResourceLoader(new DefaultResourceLoader());
|
||||
component1.setTemplateExecutor(getTemplateExecutor());
|
||||
|
||||
service.execute(() -> {
|
||||
ConfirmationInputContext run1Context = component1.run(empty);
|
||||
result1.set(run1Context);
|
||||
latch1.countDown();
|
||||
});
|
||||
|
||||
TestBuffer testBuffer = new TestBuffer().append("x").cr();
|
||||
write(testBuffer.getBytes());
|
||||
|
||||
latch1.await(2, TimeUnit.SECONDS);
|
||||
|
||||
assertThat(consoleOut()).contains("input is invalid");
|
||||
|
||||
ConfirmationInputContext run1Context = result1.get();
|
||||
|
||||
assertThat(run1Context).isNotNull();
|
||||
assertThat(run1Context.getResultValue()).isNull();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user