From bd7ad531955d98bf920712090db41f6290e13eab Mon Sep 17 00:00:00 2001 From: Shefali Date: Thu, 19 Oct 2023 16:24:12 -0700 Subject: [PATCH] Adds test for sort order --- src/plugins/timelist/pluginSpec.js | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/plugins/timelist/pluginSpec.js b/src/plugins/timelist/pluginSpec.js index 62cdc77e94..eca035e019 100644 --- a/src/plugins/timelist/pluginSpec.js +++ b/src/plugins/timelist/pluginSpec.js @@ -46,6 +46,7 @@ describe('the plugin', function () { let twoHoursPast = now - 1000 * 60 * 60 * 2; let oneHourPast = now - 1000 * 60 * 60; let twoHoursFuture = now + 1000 * 60 * 60 * 2; + let threeHoursFuture = now + 1000 * 60 * 60 * 3; let planObject = { identifier: { key: 'test-plan-object', @@ -71,6 +72,14 @@ describe('the plugin', function () { type: 'TEST-GROUP', color: 'fuchsia', textColor: 'black' + }, + { + name: 'Sed ut perspiciatis two', + start: now, + end: threeHoursFuture, + type: 'TEST-GROUP', + color: 'fuchsia', + textColor: 'black' } ] }) @@ -295,7 +304,7 @@ describe('the plugin', function () { return nextTick(() => { const items = element.querySelectorAll(LIST_ITEM_CLASS); - expect(items.length).toEqual(2); + expect(items.length).toEqual(3); }); }); }); @@ -313,7 +322,7 @@ describe('the plugin', function () { type: TIMELIST_TYPE, id: 'test-object', configuration: { - sortOrderIndex: 0, + sortOrderIndex: 2, futureEventsIndex: 1, futureEventsDurationIndex: 0, futureEventsDuration: 0, @@ -350,7 +359,17 @@ describe('the plugin', function () { return nextTick(() => { const items = element.querySelectorAll(LIST_ITEM_CLASS); - expect(items.length).toEqual(1); + expect(items.length).toEqual(2); + }); + }); + + it('activities and sorts them correctly', () => { + mockComposition.emit('add', planObject); + + return nextTick(() => { + const items = element.querySelectorAll(LIST_ITEM_CLASS); + expect(items[0].end).toEqual(threeHoursFuture); + expect(items[1].end).toEqual(twoHoursFuture); }); }); }); @@ -405,7 +424,7 @@ describe('the plugin', function () { return nextTick(() => { const items = element.querySelectorAll(LIST_ITEM_CLASS); - expect(items.length).toEqual(1); + expect(items.length).toEqual(2); }); }); });