@@ -68,6 +68,11 @@ describe("FormData", () => {
6868 values : [ { id : "dce4" , src : "dce" , map_over_type : null } ] ,
6969 } ;
7070 const value_1 = {
71+ batch : false ,
72+ product : false ,
73+ values : [ { id : "hda1" , src : "hda" , map_over_type : null } ] ,
74+ } ;
75+ const value_2 = {
7176 batch : false ,
7277 product : false ,
7378 values : [ { id : "hda4" , src : "hda" , map_over_type : null } ] ,
@@ -88,7 +93,7 @@ describe("FormData", () => {
8893 await elements_0 . at ( 2 ) . find ( "span" ) . trigger ( "click" ) ;
8994 expect ( wrapper . emitted ( ) . input . length ) . toEqual ( 2 ) ;
9095 expect ( wrapper . emitted ( ) . input [ 1 ] [ 0 ] ) . toEqual ( value_1 ) ;
91- await wrapper . setProps ( { value : value_1 } ) ;
96+ await wrapper . setProps ( { value : value_2 } ) ;
9297 expect ( wrapper . find ( SELECTED_VALUE ) . text ( ) ) . toContain ( "4: hdaName4" ) ;
9398 } ) ;
9499
@@ -131,8 +136,8 @@ describe("FormData", () => {
131136 expect ( wrapper . emitted ( ) . input . length ) . toEqual ( 1 ) ;
132137 const selectedValues = wrapper . findAll ( SELECTED_VALUE ) ;
133138 expect ( selectedValues . length ) . toBe ( 2 ) ;
134- expect ( selectedValues . at ( 0 ) . text ( ) ) . toContain ( "3: hdaName3 " ) ;
135- expect ( selectedValues . at ( 1 ) . text ( ) ) . toContain ( "2: hdaName2 " ) ;
139+ expect ( selectedValues . at ( 0 ) . text ( ) ) . toContain ( "2: hdaName2 " ) ;
140+ expect ( selectedValues . at ( 1 ) . text ( ) ) . toContain ( "3: hdaName3 " ) ;
136141 const value_0 = {
137142 batch : false ,
138143 product : false ,
@@ -146,15 +151,15 @@ describe("FormData", () => {
146151 const value_1 = {
147152 batch : false ,
148153 product : false ,
149- values : [ { id : "hda2 " , map_over_type : null , src : "hda" } ] ,
154+ values : [ { id : "hda3 " , map_over_type : null , src : "hda" } ] ,
150155 } ;
151156 expect ( wrapper . emitted ( ) . input [ 1 ] [ 0 ] ) . toEqual ( value_1 ) ;
152157 await wrapper . setProps ( { value : value_1 } ) ;
153158 await selectedValues . at ( 1 ) . trigger ( "click" ) ;
154159 const value_2 = {
155160 batch : false ,
156161 product : false ,
157- values : [ { id : "hda2 " , map_over_type : null , src : "hda" } ] ,
162+ values : [ { id : "hda3 " , map_over_type : null , src : "hda" } ] ,
158163 } ;
159164 expect ( wrapper . emitted ( ) . input [ 1 ] [ 0 ] ) . toEqual ( value_2 ) ;
160165 await wrapper . setProps ( { value : value_2 } ) ;
@@ -165,7 +170,7 @@ describe("FormData", () => {
165170 it ( "properly sorts multiple datasets" , async ( ) => {
166171 const wrapper = createTarget ( {
167172 value : {
168- // the order of values does not matter here
173+ // the order of values does matter here
169174 values : [
170175 { id : "hda2" , src : "hda" } ,
171176 { id : "hda3" , src : "hda" } ,
@@ -178,18 +183,18 @@ describe("FormData", () => {
178183 } ) ;
179184 const selectedValues = wrapper . findAll ( SELECTED_VALUE ) ;
180185 expect ( selectedValues . length ) . toBe ( 3 ) ;
181- // the values in the multiselect are sorted by hid DESC
182- expect ( selectedValues . at ( 0 ) . text ( ) ) . toContain ( "3: hdaName3 " ) ;
186+ // the values in the multiselect are sorted by hid ASC
187+ expect ( selectedValues . at ( 0 ) . text ( ) ) . toContain ( "1: hdaName1 " ) ;
183188 expect ( selectedValues . at ( 1 ) . text ( ) ) . toContain ( "2: hdaName2" ) ;
184- expect ( selectedValues . at ( 2 ) . text ( ) ) . toContain ( "1: hdaName1 " ) ;
189+ expect ( selectedValues . at ( 2 ) . text ( ) ) . toContain ( "3: hdaName3 " ) ;
185190 await selectedValues . at ( 0 ) . trigger ( "click" ) ;
186191 const value_sorted = {
187192 batch : false ,
188193 product : false ,
189194 values : [
190195 // the values in the emitted input are sorted by hid ASC
191- { id : "hda1" , map_over_type : null , src : "hda" } ,
192196 { id : "hda2" , map_over_type : null , src : "hda" } ,
197+ { id : "hda3" , map_over_type : null , src : "hda" } ,
193198 ] ,
194199 } ;
195200 expect ( wrapper . emitted ( ) . input [ 1 ] [ 0 ] ) . toEqual ( value_sorted ) ;
@@ -227,24 +232,20 @@ describe("FormData", () => {
227232 } ) ;
228233 const selectedValues = wrapper . findAll ( SELECTED_VALUE ) ;
229234 expect ( selectedValues . length ) . toBe ( 5 ) ;
230- // when dces are mixed in their values are shown first and are
231- // ordered by id descending
232235 expect ( selectedValues . at ( 0 ) . text ( ) ) . toContain ( "dceName4 (as dataset)" ) ;
233236 expect ( selectedValues . at ( 1 ) . text ( ) ) . toContain ( "dceName3 (as dataset)" ) ;
234237 expect ( selectedValues . at ( 2 ) . text ( ) ) . toContain ( "dceName2 (as dataset)" ) ;
235- expect ( selectedValues . at ( 3 ) . text ( ) ) . toContain ( "2: hdaName2 " ) ;
236- expect ( selectedValues . at ( 4 ) . text ( ) ) . toContain ( "1: hdaName1 " ) ;
238+ expect ( selectedValues . at ( 3 ) . text ( ) ) . toContain ( "1: hdaName1 " ) ;
239+ expect ( selectedValues . at ( 4 ) . text ( ) ) . toContain ( "2: hdaName2 " ) ;
237240 await selectedValues . at ( 0 ) . trigger ( "click" ) ;
238241 const value_sorted = {
239242 batch : false ,
240243 product : false ,
241244 values : [
242- // when dces are mixed in, they are emitted first
243- // and are sorted by id descending
244- { id : "dce3" , map_over_type : null , src : "dce" } ,
245- { id : "dce2" , map_over_type : null , src : "dce" } ,
246245 { id : "hda1" , map_over_type : null , src : "hda" } ,
246+ { id : "dce2" , map_over_type : null , src : "dce" } ,
247247 { id : "hda2" , map_over_type : null , src : "hda" } ,
248+ { id : "dce3" , map_over_type : null , src : "dce" } ,
248249 ] ,
249250 } ;
250251 expect ( wrapper . emitted ( ) . input [ 1 ] [ 0 ] ) . toEqual ( value_sorted ) ;
@@ -446,7 +447,7 @@ describe("FormData", () => {
446447 const value_0 = {
447448 batch : true ,
448449 product : false ,
449- values : [ { id : "hda3 " , map_over_type : null , src : "hda" } ] ,
450+ values : [ { id : "hda2 " , map_over_type : null , src : "hda" } ] ,
450451 } ;
451452 expect ( wrapper . emitted ( ) . input [ 2 ] [ 0 ] ) . toEqual ( value_0 ) ;
452453 await wrapper . setProps ( { value : value_0 } ) ;
@@ -455,7 +456,7 @@ describe("FormData", () => {
455456 batch : true ,
456457 product : false ,
457458 values : [
458- { id : "hda3 " , map_over_type : null , src : "hda" } ,
459+ { id : "hda2 " , map_over_type : null , src : "hda" } ,
459460 { id : "dce4" , map_over_type : null , src : "dce" } ,
460461 ] ,
461462 } ;
@@ -474,7 +475,7 @@ describe("FormData", () => {
474475 batch : true ,
475476 product : true ,
476477 values : [
477- { id : "hda3 " , map_over_type : null , src : "hda" } ,
478+ { id : "hda2 " , map_over_type : null , src : "hda" } ,
478479 { id : "dce4" , map_over_type : null , src : "dce" } ,
479480 ] ,
480481 } ) ;
@@ -516,16 +517,16 @@ describe("FormData", () => {
516517 } ) ;
517518 const select_0 = wrapper_0 . findAll ( SELECT_OPTIONS ) ;
518519 expect ( select_0 . length ) . toBe ( 4 ) ;
519- expect ( select_0 . at ( 2 ) . text ( ) ) . toContain ( "2: hdaName2 " ) ;
520- expect ( select_0 . at ( 3 ) . text ( ) ) . toContain ( "1: hdaName1 " ) ;
520+ expect ( select_0 . at ( 2 ) . text ( ) ) . toContain ( "1: hdaName1 " ) ;
521+ expect ( select_0 . at ( 3 ) . text ( ) ) . toContain ( "2: hdaName2 " ) ;
521522 const wrapper_1 = createTarget ( {
522523 tag : "tag2" ,
523524 options : defaultOptions ,
524525 } ) ;
525526 const select_1 = wrapper_1 . findAll ( SELECT_OPTIONS ) ;
526527 expect ( select_1 . length ) . toBe ( 4 ) ;
527- expect ( select_1 . at ( 2 ) . text ( ) ) . toContain ( "3: hdaName3 " ) ;
528- expect ( select_1 . at ( 3 ) . text ( ) ) . toContain ( "2: hdaName2 " ) ;
528+ expect ( select_1 . at ( 2 ) . text ( ) ) . toContain ( "2: hdaName2 " ) ;
529+ expect ( select_1 . at ( 3 ) . text ( ) ) . toContain ( "3: hdaName3 " ) ;
529530 const wrapper_2 = createTarget ( {
530531 tag : "tag3" ,
531532 options : defaultOptions ,
0 commit comments