From 8c33971e2b9fc1caee69129f8793e7fa995bcddb Mon Sep 17 00:00:00 2001
From: rhenck <richard.henck@iqb.hu-berlin.de>
Date: Wed, 17 Aug 2022 16:54:11 +0200
Subject: [PATCH] [player] Fix element model mapping unit test after Label
 redesign

DragAndDropValueObjects are now a sub-interface of TextImageLabel, which
requires a set imgSrc and imgPosition property. (The reason is that the
editor needs a way of generating Labels therefore needs the imgSrc set
to something else but undefined.)
---
 ...model-element-code-mapping.service.spec.ts | 112 ++++++++++++------
 1 file changed, 73 insertions(+), 39 deletions(-)

diff --git a/projects/player/src/app/services/element-model-element-code-mapping.service.spec.ts b/projects/player/src/app/services/element-model-element-code-mapping.service.spec.ts
index a11c1a25d..c7b549725 100644
--- a/projects/player/src/app/services/element-model-element-code-mapping.service.spec.ts
+++ b/projects/player/src/app/services/element-model-element-code-mapping.service.spec.ts
@@ -200,33 +200,45 @@ describe('ElementModelElementCodeMappingService', () => {
   // mapToElementValue
 
   it('should map an elementCode value to drop-list elementModel value', () => {
-    service.dragNDropValueObjects =  [
+    service.dragNDropValueObjects = [
       {
-        'text': 'a',
-        'id': 'value_1'
+        text: 'a',
+        id: 'value_1',
+        imgSrc: null,
+        imgPosition: 'above'
       },
       {
-        'text': 'b',
-        'id': 'value_2'
+        text: 'b',
+        id: 'value_2',
+        imgSrc: null,
+        imgPosition: 'above'
       },
       {
-        'text': 'c',
-        'id': 'value_3'
+        text: 'c',
+        id: 'value_3',
+        imgSrc: null,
+        imgPosition: 'above'
       },
       {
-        'text': 'd',
-        'id': 'value_4'
+        text: 'd',
+        id: 'value_4',
+        imgSrc: null,
+        imgPosition: 'above'
       },
       {
-        'text': 'e',
-        'id': 'value_5'
+        text: 'e',
+        id: 'value_5',
+        imgSrc: null,
+        imgPosition: 'above'
       }
     ];
     const elementModel: DropListElement = JSON.parse(JSON.stringify(dropList_130));
-    const expectedValue = [
+    const expectedValue: DragNDropValueObject[] = [
       {
-        'stringValue': 'e',
-        'id': 'value_5'
+        text: 'e',
+        id: 'value_5',
+        imgSrc: null,
+        imgPosition: 'above'
       }
     ];
     expect(service.mapToElementModelValue(['value_5'], elementModel))
@@ -234,33 +246,45 @@ describe('ElementModelElementCodeMappingService', () => {
   });
 
   it('should map an elementCode value to drop-list elementModel value', () => {
-    service.dragNDropValueObjects =  [
+    service.dragNDropValueObjects = [
       {
-        'text': 'a',
-        'id': 'value_1'
+        text: 'a',
+        id: 'value_1',
+        imgSrc: null,
+        imgPosition: 'above'
       },
       {
-        'text': 'b',
-        'id': 'value_2'
+        text: 'b',
+        id: 'value_2',
+        imgSrc: null,
+        imgPosition: 'above'
       },
       {
-        'text': 'c',
-        'id': 'value_3'
+        text: 'c',
+        id: 'value_3',
+        imgSrc: null,
+        imgPosition: 'above'
       },
       {
-        'text': 'd',
-        'id': 'value_4'
+        text: 'd',
+        id: 'value_4',
+        imgSrc: null,
+        imgPosition: 'above'
       },
       {
-        'text': 'e',
-        'id': 'value_5'
+        text: 'e',
+        id: 'value_5',
+        imgSrc: null,
+        imgPosition: 'above'
       }
     ];
     const elementModel: DropListElement = JSON.parse(JSON.stringify(dropList_130));
-    const expectedValue = [
+    const expectedValue: DragNDropValueObject[] = [
       {
-        'stringValue': 'e',
-        'id': 'value_5'
+        text: 'e',
+        id: 'value_5',
+        imgSrc: null,
+        imgPosition: 'above'
       }
     ];
     expect(service.mapToElementModelValue(['value_5'], elementModel))
@@ -268,26 +292,36 @@ describe('ElementModelElementCodeMappingService', () => {
   });
 
   it('should not map but return the drop-list-simple elementModel value', () => {
-    service.dragNDropValueObjects =  [
+    service.dragNDropValueObjects = [
       {
-        'text': 'a',
-        'id': 'value_1'
+        text: 'a',
+        id: 'value_1',
+        imgSrc: null,
+        imgPosition: 'above'
       },
       {
-        'text': 'b',
-        'id': 'value_2'
+        text: 'b',
+        id: 'value_2',
+        imgSrc: null,
+        imgPosition: 'above'
       },
       {
-        'text': 'c',
-        'id': 'value_3'
+        text: 'c',
+        id: 'value_3',
+        imgSrc: null,
+        imgPosition: 'above'
       },
       {
-        'text': 'd',
-        'id': 'value_4'
+        text: 'd',
+        id: 'value_4',
+        imgSrc: null,
+        imgPosition: 'above'
       },
       {
-        'text': 'e',
-        'id': 'value_5'
+        text: 'e',
+        id: 'value_5',
+        imgSrc: null,
+        imgPosition: 'above'
       }
     ];
     const elementModel: DropListSimpleElement = JSON.parse(JSON.stringify(dropListSimple_131));
-- 
GitLab