mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
fix(editor): Restrict [empty]
in parameter input hint to zero-length string (#6003)
* 🚧 Quick test * ⚡ Adjust to new requirements * ⚡ Account for 2x double quotes * 🔥 Remove excess single quote * ⏪ Revert per new requirements * ⏪ Undo more changes to minimize diff * ⏪ New requirement changes * 🐛 Prevent excess whitespace from HTML formatting * 🚚 Rename computed property * 🧪 Set up e2e tests for parameter input hint * 🚧 Experiments with unit tests Pinia stores setup process WIP. * 🔥 Remove e2e test * ⏪ Restore `test` command * 🔥 Remove unit test stub * 🔥 Remove logging * 🔥 Remove test ID * 🧪 Fix e2e test * 🧪 Tighten text check
This commit is contained in:
parent
8aedc03dda
commit
8862e1e7df
|
@ -205,7 +205,7 @@ describe('Data mapping', () => {
|
|||
'have.text',
|
||||
`{{ $node['${SCHEDULE_TRIGGER_NODE_NAME}'].json.input[0].count }} {{ $node['${SCHEDULE_TRIGGER_NODE_NAME}'].json.input }}`,
|
||||
);
|
||||
ndv.getters.parameterExpressionPreview('value').should('include.text', '[empty]');
|
||||
ndv.getters.parameterExpressionPreview('value').should('have.text', ' ');
|
||||
|
||||
ndv.actions.selectInputNode('Set');
|
||||
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
<template>
|
||||
<n8n-text size="small" color="text-base" tag="div" v-if="hint">
|
||||
<div
|
||||
v-if="!renderHTML"
|
||||
:class="{ [$style.singleline]: singleLine, [$style.highlight]: highlight }"
|
||||
>
|
||||
{{ hint }}
|
||||
</div>
|
||||
<div v-if="!renderHTML" :class="classes">{{ hint }}</div>
|
||||
<div
|
||||
v-else
|
||||
ref="hint"
|
||||
|
@ -39,6 +34,15 @@ export default defineComponent({
|
|||
methods: {
|
||||
sanitizeHtml,
|
||||
},
|
||||
computed: {
|
||||
classes() {
|
||||
return {
|
||||
[this.$style.singleline]: this.singleLine,
|
||||
[this.$style.highlight]: this.highlight,
|
||||
[this.$style['preserve-whitespace']]: true,
|
||||
};
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
if (this.$refs.hint) {
|
||||
(this.$refs.hint as Element).querySelectorAll('a').forEach((a) => (a.target = '_blank'));
|
||||
|
@ -56,4 +60,7 @@ export default defineComponent({
|
|||
.highlight {
|
||||
color: var(--color-secondary);
|
||||
}
|
||||
.preserve-whitespace {
|
||||
white-space: pre;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -181,8 +181,8 @@ export default mixins(showMessage, workflowHelpers).extend({
|
|||
return null;
|
||||
}
|
||||
|
||||
if (typeof computedValue === 'string' && computedValue.trim().length === 0) {
|
||||
computedValue = this.$locale.baseText('parameterInput.emptyString');
|
||||
if (typeof computedValue === 'string' && computedValue.length === 0) {
|
||||
return this.$locale.baseText('parameterInput.emptyString');
|
||||
}
|
||||
} catch (error) {
|
||||
computedValue = `[${this.$locale.baseText('parameterInput.error')}: ${error.message}]`;
|
||||
|
|
Loading…
Reference in a new issue