Skip to content

Commit

Permalink
Merge pull request #783 from SlateFoundation/develop
Browse files Browse the repository at this point in the history
Release: v3.9.3
  • Loading branch information
themightychris authored Feb 21, 2023
2 parents d085e6e + 86e5254 commit 716c06d
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 66 deletions.
91 changes: 41 additions & 50 deletions cypress/integration/cbl/admin/tasks-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,31 +323,27 @@ describe('CBL / Admin / Tasks Manager', () => {
.within(() => {

// click cloned task selector
cy.extGet('slate-cbl-taskselector[name=ClonedTaskID]')
.should('exist')
.within(() => {

cy.root()
.get('.x-form-arrow-trigger')
cy.get('input[name="ClonedTaskID"]')
.should('have.length', 1)
.parents('.x-form-trigger-wrap')
.should('have.length', 1)
.find('.x-form-arrow-trigger')
.click()
});

});

// wait for options to load
cy.wait('@tasksData');
// wait for options to load
cy.wait('@tasksData');

// verify shared task exists in picker dropdown
cy.extGet('slate-cbl-taskselector[name=ClonedTaskID]', { component: true })
.then(selector => selector.getPicker().el.dom)
.contains('.x-boundlist-item', 'A Shared Task')
.should('exist');
cy.extGet('slate-cbl-taskselector[name=ClonedTaskID]', { component: true })
.then(selector => selector.getPicker().el.dom)
.contains('.x-boundlist-item', 'A Shared Task')
.should('exist');

// verify unshared task does not exist in picker dropdown
cy.extGet('slate-cbl-taskselector[name=ClonedTaskID]', { component: true })
.then(selector => selector.getPicker().el.dom)
.contains('.x-boundlist-item', 'An UnShared Task')
.should('not.exist');
});
// verify unshared task does not exist in picker dropdown
cy.extGet('slate-cbl-taskselector[name=ClonedTaskID]', { component: true })
.then(selector => selector.getPicker().el.dom)
.contains('.x-boundlist-item', 'An UnShared Task')
.should('not.exist');
});

it('Verify sorting by column', () => {
Expand Down Expand Up @@ -380,11 +376,10 @@ describe('CBL / Admin / Tasks Manager', () => {
// verify the sort order icon in column header
cy.get('.x-grid-header-ct', { log: false })
.contains('.x-column-header', 'Title')
.should('have.class', 'x-column-header-sort-ASC')
.should('have.class', 'x-column-header-sort-ASC');

// verify column is sorted in alphabetical order
items = _getColumnValues(0);
cy.expect(items, 'Title column: items are sorted in alphabetical order.').to.deep.equal(items.slice().sort());
assertColumnOrder(0);

// click title column header to reverse sort
cy.get('.x-grid-header-ct', { log: false })
Expand All @@ -397,11 +392,10 @@ describe('CBL / Admin / Tasks Manager', () => {
// verify the sort order icon in column header
cy.get('.x-grid-header-ct', { log: false })
.contains('.x-column-header', 'Title')
.should('have.class', 'x-column-header-sort-DESC')
.should('have.class', 'x-column-header-sort-DESC');

// verify column is sorted in reverse alphabetical order
items = _getColumnValues(0);
cy.expect(items, 'Title column: items are sorted in reverse alphabetical order.').to.deep.equal(items.slice().sort().reverse());
assertColumnOrder(0, true);


/** Parent Task column */
Expand All @@ -414,8 +408,7 @@ describe('CBL / Admin / Tasks Manager', () => {
cy.wait('@tasksData');

// verify column is sorted in alphabetical order
items = _getColumnValues(1);
cy.expect(items, 'Parent Task column: items are sorted in alphabetical order.').to.deep.equal(items.slice().sort());
assertColumnOrder(1);

// click Parent Task column header to reverse sort
cy.get('.x-grid-header-ct', { log: false })
Expand All @@ -426,8 +419,7 @@ describe('CBL / Admin / Tasks Manager', () => {
cy.wait('@tasksData');

// verify column is sorted in reverse alphabetical order
items = _getColumnValues(1);
cy.expect(items, 'Parent Task column: items are sorted in reverse alphabetical order.').to.deep.equal(items.slice().sort().reverse());
assertColumnOrder(1, true);


/** Experience Type column */
Expand All @@ -440,8 +432,7 @@ describe('CBL / Admin / Tasks Manager', () => {
cy.wait('@tasksData');

// verify column is sorted in alphabetical order
items = _getColumnValues(2);
cy.expect(items, 'Experience Type column: items are sorted in alphabetical order.').to.deep.equal(items.slice().sort());
assertColumnOrder(2);

// click Experience Type column header to reverse sort
cy.get('.x-grid-header-ct', { log: false })
Expand All @@ -452,8 +443,7 @@ describe('CBL / Admin / Tasks Manager', () => {
cy.wait('@tasksData');

// verify column is sorted in reverse alphabetical order
items = _getColumnValues(2);
cy.expect(items, 'Experience Type column: items are sorted in reverse alphabetical order.').to.deep.equal(items.slice().sort().reverse());
assertColumnOrder(2, true);


/** Skills column */
Expand All @@ -466,8 +456,7 @@ describe('CBL / Admin / Tasks Manager', () => {
cy.wait('@tasksData');

// verify column is sorted in alphabetical order
items = _getColumnValues(3);
cy.expect(items, 'Skills column: items are sorted in alphabetical order.').to.deep.equal(items.slice().sort());
assertColumnOrder(3);

// click Skills column header to reverse sort
cy.get('.x-grid-header-ct', { log: false })
Expand All @@ -478,8 +467,7 @@ describe('CBL / Admin / Tasks Manager', () => {
cy.wait('@tasksData');

// verify column is sorted in reverse alphabetical order
items = _getColumnValues(3);
cy.expect(items, 'Skills column: items are sorted in reverse alphabetical order.').to.deep.equal(items.slice().sort().reverse());
assertColumnOrder(3, true);


/** Creator column */
Expand All @@ -492,8 +480,7 @@ describe('CBL / Admin / Tasks Manager', () => {
cy.wait('@tasksData');

// verify column is sorted in alphabetical order
items = _getColumnValues(4);
cy.expect(items, 'Creator column: items are sorted in alphabetical order.').to.deep.equal(items.slice().sort());
assertColumnOrder(4);

// click Creator column header to reverse sort
cy.get('.x-grid-header-ct', { log: false })
Expand All @@ -504,8 +491,7 @@ describe('CBL / Admin / Tasks Manager', () => {
cy.wait('@tasksData');

// verify column is sorted in reverse alphabetical order
items = _getColumnValues(4);
cy.expect(items, 'Creator column: items are sorted in reverse alphabetical order.').to.deep.equal(items.slice().sort().reverse());
assertColumnOrder(4, true);


/** Creation Date column */
Expand All @@ -522,8 +508,7 @@ describe('CBL / Admin / Tasks Manager', () => {
cy.wait('@tasksData');

// verify column is sorted in alphabetical order
items = _getColumnValues(5);
cy.expect(items, 'Creation Date column: items are sorted in alphabetical order.').to.deep.equal(items.slice().sort());
assertColumnOrder(5);

// click Creation Date column header to reverse sort
cy.get('.x-grid-header-ct', { log: false })
Expand All @@ -538,14 +523,14 @@ describe('CBL / Admin / Tasks Manager', () => {
cy.wait('@tasksData');

// verify column is sorted in reverse alphabetical order
items = _getColumnValues(5);
cy.expect(items, 'Creation Date column: items are sorted in reverse alphabetical order.').to.deep.equal(items.slice().sort().reverse());
assertColumnOrder(5, true);

});

function _getColumnValues(col) {
let items = [];
function assertColumnOrder(col, reverse = false) {
const items = [];
cy.get('.x-grid-row', { log: false })
.should('have.length', 20)
.each(($row) => {
cy.wrap($row, { log: false })
.find('.x-grid-cell-inner', { log: false })
Expand All @@ -554,6 +539,12 @@ describe('CBL / Admin / Tasks Manager', () => {
items.push($div.text().trim());
})
})
return items;
.then(() => {
if (reverse) {
cy.expect(items, `Column [index: ${col}]: items are sorted in reverse alphabetical order.`).to.deep.equal(items.slice().sort().reverse());
} else {
cy.expect(items, `Column [index: ${col}]: items are sorted in alphabetical order.`).to.deep.equal(items.slice().sort());
}
})
};
});
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
<div>
Demonstration ID: {{ demonstration.ID }}
</div>
<div>
DemonstrationSkill ID: {{ skillDemo.ID }}
</div>
<div>
Demonstration Date: {{ fullDate }}
</div>
Expand All @@ -69,17 +72,18 @@
Performance Type: {{ demonstration.PerformanceType }}
</div>
<div v-if="demonstration.ArtifactURL">
<a
:href="demonstration.ArtifactURL"
target="_blank"
>Link</a>
<!-- <a -->
<!-- :href="demonstration.ArtifactURL" -->
<!-- target="_blank" -->
<!-- >Link</a> -->
Artifact URL: {{ demonstration.ArtifactURL }}
</div>
<template v-else-if="demonstration.StudentTask">
<div>
TODO: StudentTask.Submitted (date, if applicable)
<div v-if="submittedDate">
Submitted: {{ submittedDate }}
</div>
<div>
TODO: Task.Title (with link to task)
<div v-if="demonstration.StudentTask.Task.Title">
Title: {{ demonstration.StudentTask.Task.Title }}
</div>
</template>
</v-tooltip>
Expand All @@ -98,6 +102,17 @@ import { mapStores } from 'pinia';
import useDemonstrationSkill from '@/store/useDemonstrationSkill';
import useUi from '@/store/useUi';
const shortDate = (value) => {
if (!value) {
return '';
}
const date = new Date(1000 * value);
if (date.getFullYear() !== new Date().getFullYear()) {
return format(date, 'MMM d, yyyy');
}
return format(date, 'MMM d');
};
export default {
props: {
visibleLevels: {
Expand Down Expand Up @@ -138,14 +153,10 @@ export default {
},
date() {
const { Modified, Created } = this.skillDemo;
if (!Modified && !Created) {
return '';
}
const date = new Date(1000 * (Modified || Created));
if (date.getFullYear() !== new Date().getFullYear()) {
return format(date, 'MMM d, yyyy');
}
return format(date, 'MMM d');
return shortDate(Modified || Created);
},
submittedDate() {
return shortDate(this.demonstration.StudentTask.Created);
},
createdBy() {
if (!this.demonstration.Created) {
Expand Down Expand Up @@ -179,6 +190,8 @@ export default {
return [
'align-items-baseline bg-white d-flex rounded shadow-sm skill-demo',
this.skillDemo.DemonstratedLevel === 0 && 'cbl-level-missing',
'elevation-1',
this.effective ? '-effective' : '-ineffective',
];
},
},
Expand Down

0 comments on commit 716c06d

Please sign in to comment.