Adds test for sort order

This commit is contained in:
Shefali 2023-10-19 16:24:12 -07:00
parent bc1ab42b7b
commit bd7ad53195

View File

@ -46,6 +46,7 @@ describe('the plugin', function () {
let twoHoursPast = now - 1000 * 60 * 60 * 2; let twoHoursPast = now - 1000 * 60 * 60 * 2;
let oneHourPast = now - 1000 * 60 * 60; let oneHourPast = now - 1000 * 60 * 60;
let twoHoursFuture = now + 1000 * 60 * 60 * 2; let twoHoursFuture = now + 1000 * 60 * 60 * 2;
let threeHoursFuture = now + 1000 * 60 * 60 * 3;
let planObject = { let planObject = {
identifier: { identifier: {
key: 'test-plan-object', key: 'test-plan-object',
@ -71,6 +72,14 @@ describe('the plugin', function () {
type: 'TEST-GROUP', type: 'TEST-GROUP',
color: 'fuchsia', color: 'fuchsia',
textColor: 'black' 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(() => { return nextTick(() => {
const items = element.querySelectorAll(LIST_ITEM_CLASS); 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, type: TIMELIST_TYPE,
id: 'test-object', id: 'test-object',
configuration: { configuration: {
sortOrderIndex: 0, sortOrderIndex: 2,
futureEventsIndex: 1, futureEventsIndex: 1,
futureEventsDurationIndex: 0, futureEventsDurationIndex: 0,
futureEventsDuration: 0, futureEventsDuration: 0,
@ -350,7 +359,17 @@ describe('the plugin', function () {
return nextTick(() => { return nextTick(() => {
const items = element.querySelectorAll(LIST_ITEM_CLASS); 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(() => { return nextTick(() => {
const items = element.querySelectorAll(LIST_ITEM_CLASS); const items = element.querySelectorAll(LIST_ITEM_CLASS);
expect(items.length).toEqual(1); expect(items.length).toEqual(2);
}); });
}); });
}); });