We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch cypress-ag-grid@3.3.2 for the project I'm working on.
cypress-ag-grid@3.3.2
Here is the diff that solved my problem:
diff --git a/node_modules/cypress-ag-grid/src/agGrid/agGridInteractions.js b/node_modules/cypress-ag-grid/src/agGrid/agGridInteractions.js index cfdcb0c..8d53621 100644 --- a/node_modules/cypress-ag-grid/src/agGrid/agGridInteractions.js +++ b/node_modules/cypress-ag-grid/src/agGrid/agGridInteractions.js @@ -6,11 +6,12 @@ import { sort } from "./sort.enum"; function isRowNotDestroyed(rowElement) { const rect = rowElement.getBoundingClientRect(); const viewPortRect = rowElement.parentElement.getBoundingClientRect(); + const tolerance = rowElement.classList.contains('ag-row-pinned') ? 5 : 0; return ( - rect.top >= viewPortRect.top && + rect.top >= viewPortRect.top - tolerance && rect.left >= viewPortRect.left && - rect.bottom <= viewPortRect.bottom && + rect.bottom <= viewPortRect.bottom + tolerance && rect.right <= viewPortRect.right ); } @@ -46,8 +47,8 @@ export const agGridWaitForAnimation = async (agGridElement) => { */ function sortElementsByAttributeValue(attribute) { return (a, b) => { - const contentA = parseInt(a.attributes[attribute].nodeValue, 10).valueOf(); - const contentB = parseInt(b.attributes[attribute].nodeValue, 10).valueOf(); + const contentA = parseInt(a.attributes[attribute].nodeValue.replace(/^[tb]-/, ''), 10).valueOf(); + const contentB = parseInt(b.attributes[attribute].nodeValue.replace(/^[tb]-/, ''), 10).valueOf(); return contentA < contentB ? -1 : contentA > contentB ? 1 : 0; }; } @@ -72,14 +73,29 @@ export const getAgGridElements = async (agGridElement, options = {}) => { return _getAgGrid(agGridElement, options, true); }; +const agGridBodyColumnSelectors = + ".ag-pinned-left-cols-container^.ag-center-cols-clipper^.ag-center-cols-viewport^.ag-pinned-right-cols-container"; + +const agGridFloatingTopColumnSelectors = + ".ag-pinned-left-floating-top^.ag-center-cols-clipper-floating-top^.ag-floating-top-viewport^.ag-pinned-right-floating-top"; + +const agGridFloatingBottomColumnSelectors = + ".ag-pinned-left-floating-bottom^.ag-center-cols-clipper-floating-bottom^.ag-floating-bottom-viewport^.ag-pinned-right-floating-bottom"; + function _getAgGrid(agGridElement, options = {}, returnElements) { - const agGridColumnSelectors = - ".ag-pinned-left-cols-container^.ag-center-cols-clipper^.ag-center-cols-viewport^.ag-pinned-right-cols-container"; if (agGridElement.get().length > 1) throw new Error( `Selector "${agGridElement.selector}" returned more than 1 element.` ); + const agGridColumnSelectors = options.pinned === "top" + ? agGridFloatingTopColumnSelectors + : options.pinned === "bottom" + ? agGridFloatingBottomColumnSelectors + : agGridBodyColumnSelectors; + + const agRowSelector = options.pinned == null ? ".ag-row" : ".ag-row-pinned"; + const tableElement = agGridElement.get()[0].querySelectorAll(".ag-root")[0]; const agGridSelectors = agGridColumnSelectors.split("^"); const headers = [ @@ -108,7 +124,7 @@ function _getAgGrid(agGridElement, options = {}, returnElements) { agGridSelectors.forEach((selector) => { const _rows = [ ...tableElement.querySelectorAll( - `${selector}:not(.ag-hidden) .ag-row:not(.ag-opacity-zero)` + `${selector}:not(.ag-hidden) ${agRowSelector}:not(.ag-opacity-zero)` ), ] // When animation is enabled, ag-grid destroys rows in 2 phases, @@ -129,8 +145,9 @@ function _getAgGrid(agGridElement, options = {}, returnElements) { if (rowCells.length === 0) { rowCells = [...row.querySelectorAll(".ag-cell")]; } + const rowIndex = parseInt( - row.attributes["row-index"].nodeValue, + row.attributes["row-index"].nodeValue.replace(/^[tb]-/, ''), 10 ).valueOf(); diff --git a/node_modules/cypress-ag-grid/src/index.d.ts b/node_modules/cypress-ag-grid/src/index.d.ts index 9b39a1e..f3502de 100644 --- a/node_modules/cypress-ag-grid/src/index.d.ts +++ b/node_modules/cypress-ag-grid/src/index.d.ts @@ -104,7 +104,9 @@ interface getAgGridElementsOptions { /** Define columns to select from */ onlyColumns?: string[], /** If true, return headers & rows values as arrays instead of mapping as objects */ - valuesArray?: boolean + valuesArray?: boolean, + /** */ + pinned?: "top" | "bottom"; } interface agGridColumnFilterSearchCriteriaOptions {
This issue body was partially generated by patch-package.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch
cypress-ag-grid@3.3.2
for the project I'm working on.Here is the diff that solved my problem:
This issue body was partially generated by patch-package.
The text was updated successfully, but these errors were encountered: