|
|
|
@ -12,7 +12,7 @@ context('Objects ordering feature', () => {
|
|
|
|
const createRectangleShape2Points = {
|
|
|
|
const createRectangleShape2Points = {
|
|
|
|
points: 'By 2 Points',
|
|
|
|
points: 'By 2 Points',
|
|
|
|
type: 'Shape',
|
|
|
|
type: 'Shape',
|
|
|
|
labelName: labelName,
|
|
|
|
labelName,
|
|
|
|
firstX: 250,
|
|
|
|
firstX: 250,
|
|
|
|
firstY: 350,
|
|
|
|
firstY: 350,
|
|
|
|
secondX: 350,
|
|
|
|
secondX: 350,
|
|
|
|
@ -22,7 +22,7 @@ context('Objects ordering feature', () => {
|
|
|
|
const createRectangleShape2PointsSecond = {
|
|
|
|
const createRectangleShape2PointsSecond = {
|
|
|
|
points: 'By 2 Points',
|
|
|
|
points: 'By 2 Points',
|
|
|
|
type: 'Shape',
|
|
|
|
type: 'Shape',
|
|
|
|
labelName: labelName,
|
|
|
|
labelName,
|
|
|
|
firstX: createRectangleShape2Points.firstX + 300,
|
|
|
|
firstX: createRectangleShape2Points.firstX + 300,
|
|
|
|
firstY: createRectangleShape2Points.firstY,
|
|
|
|
firstY: createRectangleShape2Points.firstY,
|
|
|
|
secondX: createRectangleShape2Points.secondX + 300,
|
|
|
|
secondX: createRectangleShape2Points.secondX + 300,
|
|
|
|
@ -30,18 +30,20 @@ context('Objects ordering feature', () => {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
function checkSideBarItemOrdering(ordering) {
|
|
|
|
function checkSideBarItemOrdering(ordering) {
|
|
|
|
let cvatObjectsSidebarStateItemIdList = [];
|
|
|
|
const cvatObjectsSidebarStateItemIdList1 = [];
|
|
|
|
cy.get('.cvat-objects-sidebar-state-item').then(($cvatObjectsSidebarStateItemId) => {
|
|
|
|
cy.get('.cvat-objects-sidebar-state-item').then(($cvatObjectsSidebarStateItemId) => {
|
|
|
|
for (let i = 0; i < $cvatObjectsSidebarStateItemId.length; i++) {
|
|
|
|
for (let i = 0; i < $cvatObjectsSidebarStateItemId.length; i++) {
|
|
|
|
cvatObjectsSidebarStateItemIdList.push(Number($cvatObjectsSidebarStateItemId[i].id.match(/\d+$/)));
|
|
|
|
cvatObjectsSidebarStateItemIdList1.push(Number($cvatObjectsSidebarStateItemId[i].id.match(/\d+$/)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const idAscent = cvatObjectsSidebarStateItemIdList.reduce((previousValue, currentValue) => {
|
|
|
|
const idAscent = cvatObjectsSidebarStateItemIdList1.reduce((previousValue, currentValue) => (
|
|
|
|
return previousValue > currentValue ? false : true;
|
|
|
|
!(previousValue > currentValue)
|
|
|
|
});
|
|
|
|
));
|
|
|
|
if (ordering === 'ascent') {
|
|
|
|
if (ordering === 'ascent') {
|
|
|
|
expect(idAscent).to.be.true; //expected true to be true (ascent)
|
|
|
|
/* eslint-disable-next-line */
|
|
|
|
|
|
|
|
expect(idAscent).to.be.true; // expected true to be true (ascent)
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
expect(idAscent).to.be.false; //expected false to be false (descent)
|
|
|
|
/* eslint-disable-next-line */
|
|
|
|
|
|
|
|
expect(idAscent).to.be.false; // expected false to be false (descent)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|