cypress-ag-grid 2.0.3 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cypress-ag-grid",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "Cypress plugin to interact with ag grid",
5
5
  "main": "src/index.js",
6
6
  "repository": {
@@ -151,20 +151,26 @@ function getColumnHeaderElement(agGridElement, columnName) {
151
151
  * @returns
152
152
  */
153
153
  export function sortColumnBy(agGridElement, columnName, sortDirection) {
154
+ if(sortDirection.toLowerCase() === "ascending"){
155
+ sortDirection = "asc"
156
+ }else if(sortDirection.toLowerCase() === "descending"){
157
+ sortDirection = "desc"
158
+ }
159
+
154
160
  if (sortDirection === sort.ascending || sortDirection === sort.descending) {
155
161
  return getColumnHeaderElement(agGridElement, columnName)
156
- .parents(".ag-header-cell")
157
- .invoke("attr", "aria-sort")
162
+ .parents(".ag-header-cell .ag-cell-label-container")
163
+ .invoke("attr", "class")
158
164
  .then((value) => {
159
165
  cy.log(`sort: ${sortDirection}`);
160
- if (value !== sortDirection) {
166
+ if(!value.includes(`ag-header-cell-sorted-${sortDirection}`)){
161
167
  getColumnHeaderElement(agGridElement, columnName).click().wait(250);
162
168
  sortColumnBy(agGridElement, columnName, sortDirection);
163
169
  }
164
170
  });
165
171
  } else {
166
172
  throw new Error(
167
- "sortDirection must be either 'ascending' or 'descending'."
173
+ "sortDirection must be either 'asc' or 'desc'."
168
174
  );
169
175
  }
170
176
  }
@@ -340,19 +346,9 @@ function populateSearchCriteria(
340
346
  selectAllLocaleText = 'Select All'
341
347
  ) {
342
348
  const options = {};
343
- //@ts-ignore
344
- options.searchCriteria = {};
345
- //@ts-ignore
346
- options.searchCriteria.columnName = searchCriteria.columnName;
347
- //@ts-ignore
348
- options.searchCriteria.filterValue = searchCriteria.filterValue;
349
- //@ts-ignore
350
- options.searchCriteria.isMultiFilter = searchCriteria.isMultiFilter;
351
- //@ts-ignore
349
+ options.searchCriteria = {...searchCriteria};
352
350
  options.selectAllLocaleText = selectAllLocaleText;
353
- //@ts-ignore
354
351
  options.hasApplyButton = hasApplyButton;
355
- //@ts-ignore
356
352
  options.noMenuTabs = noMenuTabs;
357
353
  return options;
358
354
  }
@@ -1,5 +1,5 @@
1
1
  export const sort = {
2
- ascending: "ascending",
3
- descending: "descending",
2
+ ascending: "asc",
3
+ descending: "desc",
4
4
  none: "none"
5
5
  }