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

fix(editor): Restrict [empty] in parameter input hint to zero-length string #6003

Merged
merged 19 commits into from
May 3, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
🧪 Set up e2e tests for parameter input hint
  • Loading branch information
ivov committed Apr 24, 2023
commit 462732179c7726d97ae30d9957e3c0e06af0a274
47 changes: 47 additions & 0 deletions cypress/e2e/26-parameter-input.hint.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { WorkflowPage, NDV } from '../pages';

const wf = new WorkflowPage();
const ndv = new NDV();

describe('Parameter input hint', () => {
before(() => {
cy.resetAll();
cy.skipSetup();
});

[
{
name: 'should display a regular string',
pinData: [{ regular_string: 'hello' }],
input: '{{ $json.regular_string',
output: 'hello',
},
{
name: 'should display `[empty]` for a zero-length string',
pinData: [{ empty_string: '' }],
input: '{{ $json.empty_string',
output: '[empty]',
},
{
name: 'should display ` ` for a single-whitespace string',
pinData: [{ single_whitespace_string: ' ' }],
input: '{{ $json.single_whitespace_string',
output: ' ',
},
].forEach(({ name, pinData, input, output }) => {
ivov marked this conversation as resolved.
Show resolved Hide resolved
it(name, () => {
wf.actions.visit();
wf.actions.addInitialNodeToCanvas('Schedule Trigger', { keepNdvOpen: true });
ndv.actions.setPinnedData(pinData);
ndv.actions.close();

wf.actions.addNodeToCanvas('Set', true, true);
ivov marked this conversation as resolved.
Show resolved Hide resolved
cy.get('input[placeholder="Add Value"]').click();
cy.get('span').contains('String').click();
ndv.getters.nthParam(3).contains('Expression').invoke('show').click();

ndv.getters.inlineExpressionEditorInput().clear().type(input);
cy.get('[data-test-id="parameter-input-hint"]').should('contain', output);
});
});
});
32 changes: 17 additions & 15 deletions packages/editor-ui/src/components/ParameterInputWrapper.vue
Original file line number Diff line number Diff line change
@@ -23,21 +23,23 @@
@textInput="onTextInput"
@valueChanged="onValueChanged"
/>
<input-hint
v-if="expressionOutput"
:class="$style.hint"
data-test-id="parameter-expression-preview"
class="ph-no-capture"
:highlight="!!(expressionOutput && targetItem) && isInputParentOfActiveNode"
:hint="expressionOutput"
:singleLine="true"
/>
<input-hint
v-else-if="parameterHint"
:class="$style.hint"
:renderHTML="true"
:hint="parameterHint"
/>
<div data-test-id="parameter-input-hint">
ivov marked this conversation as resolved.
Show resolved Hide resolved
<input-hint
v-if="expressionOutput"
:class="$style.hint"
data-test-id="parameter-expression-preview"
class="ph-no-capture"
:highlight="!!(expressionOutput && targetItem) && isInputParentOfActiveNode"
:hint="expressionOutput"
:singleLine="true"
/>
<input-hint
v-else-if="parameterHint"
:class="$style.hint"
:renderHTML="true"
:hint="parameterHint"
/>
</div>
</div>
</template>