fix(editor): Fix mapping with special characters (#5837)

* fix: Fix mapping with special characters

* refactor: rename var

* test: update more unit tests

* test: update mapping test

* test: update mapping test
This commit is contained in:
Mutasem Aldmour
2023-03-30 15:50:47 +02:00
committed by GitHub
parent ddc8f30e6d
commit f8f584c136
7 changed files with 53 additions and 23 deletions

View File

@@ -77,7 +77,9 @@ export default Vue.extend({
segment.kind === 'plaintext'
? segment.plaintext.length
: // eslint-disable-next-line @typescript-eslint/no-explicit-any
(segment.resolved as any).toString().length;
segment.resolved
? (segment.resolved as any).toString().length
: 0;
segment.to = cursor;

View File

@@ -68,7 +68,9 @@ export default Vue.extend({
segment.kind === 'plaintext'
? segment.plaintext.length
: // eslint-disable-next-line @typescript-eslint/no-explicit-any
(segment.resolved as any).toString().length;
segment.resolved
? (segment.resolved as any).toString().length
: 0;
segment.to = cursor;
return segment;
})

View File

@@ -301,9 +301,9 @@ exports[`RunDataJsonSchema.vue > renders schema with spaces and dots 1`] = `
class="label"
data-depth="1"
data-name="hello world"
data-path="[\\"hello world\\"]"
data-path="['hello world']"
data-target="mappable"
data-value="{{ $json[\\"hello world\\"] }}"
data-value="{{ $json['hello world'] }}"
>
<font-awesome-icon-stub
icon="list"
@@ -347,9 +347,9 @@ exports[`RunDataJsonSchema.vue > renders schema with spaces and dots 1`] = `
class="label"
data-depth="2"
data-name="object[0]"
data-path="[\\"hello world\\"][0]"
data-path="['hello world'][0]"
data-target="mappable"
data-value="{{ $json[\\"hello world\\"][0] }}"
data-value="{{ $json['hello world'][0] }}"
>
<font-awesome-icon-stub
icon="cube"
@@ -395,9 +395,9 @@ exports[`RunDataJsonSchema.vue > renders schema with spaces and dots 1`] = `
class="label"
data-depth="3"
data-name="test"
data-path="[\\"hello world\\"][0].test"
data-path="['hello world'][0].test"
data-target="mappable"
data-value="{{ $json[\\"hello world\\"][0].test }}"
data-value="{{ $json['hello world'][0].test }}"
>
<font-awesome-icon-stub
icon="cube"
@@ -441,9 +441,9 @@ exports[`RunDataJsonSchema.vue > renders schema with spaces and dots 1`] = `
class="label"
data-depth="4"
data-name="more to think about"
data-path="[\\"hello world\\"][0].test[\\"more to think about\\"]"
data-path="['hello world'][0].test['more to think about']"
data-target="mappable"
data-value="{{ $json[\\"hello world\\"][0].test[\\"more to think about\\"] }}"
data-value="{{ $json['hello world'][0].test['more to think about'] }}"
>
<font-awesome-icon-stub
icon="hashtag"
@@ -481,9 +481,9 @@ exports[`RunDataJsonSchema.vue > renders schema with spaces and dots 1`] = `
class="label"
data-depth="3"
data-name="test.how"
data-path="[\\"hello world\\"][0][\\"test.how\\"]"
data-path="['hello world'][0]['test.how']"
data-target="mappable"
data-value="{{ $json[\\"hello world\\"][0][\\"test.how\\"] }}"
data-value="{{ $json['hello world'][0]['test.how'] }}"
>
<font-awesome-icon-stub
icon="font"