mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 12:44:07 -08:00
fix(editor): Fix NDV output tabs resetting on any click (#8808)
This commit is contained in:
parent
cdec7c9334
commit
c7c17673cb
|
@ -149,9 +149,9 @@ export default defineComponent({
|
|||
|
||||
this.isFocused = false;
|
||||
|
||||
this.$emit('blur');
|
||||
|
||||
if (wasFocused) {
|
||||
this.$emit('blur');
|
||||
|
||||
const telemetryPayload = createExpressionTelemetryPayload(
|
||||
this.segments,
|
||||
this.modelValue,
|
||||
|
|
|
@ -595,7 +595,7 @@ import { useNDVStore } from '@/stores/ndv.store';
|
|||
import { useNodeTypesStore } from '@/stores/nodeTypes.store';
|
||||
import { useNodeHelpers } from '@/composables/useNodeHelpers';
|
||||
import { useToast } from '@/composables/useToast';
|
||||
import { isObject } from 'lodash-es';
|
||||
import { isEqual, isObject } from 'lodash-es';
|
||||
import { useExternalHooks } from '@/composables/useExternalHooks';
|
||||
import { useSourceControlStore } from '@/stores/sourceControl.store';
|
||||
import RunDataPinButton from '@/components/RunDataPinButton.vue';
|
||||
|
@ -1473,7 +1473,8 @@ export default defineComponent({
|
|||
},
|
||||
},
|
||||
watch: {
|
||||
node() {
|
||||
node(newNode: INodeUi, prevNode: INodeUi) {
|
||||
if (newNode.id === prevNode.id) return;
|
||||
this.init();
|
||||
},
|
||||
hasNodeRun() {
|
||||
|
@ -1491,9 +1492,10 @@ export default defineComponent({
|
|||
immediate: true,
|
||||
deep: true,
|
||||
},
|
||||
jsonData(value: IDataObject[]) {
|
||||
jsonData(data: IDataObject[], prevData: IDataObject[]) {
|
||||
if (isEqual(data, prevData)) return;
|
||||
this.refreshDataSize();
|
||||
this.showPinDataDiscoveryTooltip(value);
|
||||
this.showPinDataDiscoveryTooltip(data);
|
||||
},
|
||||
binaryData(newData: IBinaryKeyData[], prevData: IBinaryKeyData[]) {
|
||||
if (newData.length && !prevData.length && this.displayMode !== 'binary') {
|
||||
|
|
|
@ -33,4 +33,24 @@ describe('ExpressionParameterInput', () => {
|
|||
await userEvent.click(getByTestId('expander'));
|
||||
expect(emitted().modalOpenerClick).toEqual(expected);
|
||||
});
|
||||
|
||||
test('it should only emit blur when input had focus', async () => {
|
||||
const { getByTestId, emitted, baseElement } = renderComponent({
|
||||
props: {
|
||||
modelValue: '={{$json.foo}}',
|
||||
},
|
||||
});
|
||||
|
||||
// trigger click outside -> blur
|
||||
await userEvent.click(baseElement);
|
||||
expect(emitted('blur')).toBeUndefined();
|
||||
|
||||
// focus expression editor
|
||||
await userEvent.click(
|
||||
getByTestId('inline-expression-editor-input').querySelector('.cm-line') as Element,
|
||||
);
|
||||
// trigger click outside -> blur
|
||||
await userEvent.click(baseElement);
|
||||
expect(emitted('blur')).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue