cypress-ag-grid 1.2.0 → 1.3.0
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
|
@@ -33,11 +33,18 @@ export const getAgGridData = (agGridElement, options = {}) => {
|
|
|
33
33
|
const tableElement = agGridElement.get()[0].querySelectorAll(".ag-root")[0];
|
|
34
34
|
const agGridSelectors = agGridColumnSelectors.split("^");
|
|
35
35
|
const headers = [
|
|
36
|
-
...tableElement.querySelectorAll('.ag-header-row-column
|
|
36
|
+
...tableElement.querySelectorAll('.ag-header-row-column [aria-colindex]')]
|
|
37
37
|
.sort(sortElementsByAttributeValue('aria-colindex'))
|
|
38
38
|
.map((headerElement) => {
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
// Check if the elements returned are already .ag-header-cell-text elements
|
|
40
|
+
// If not, query for that element and return the text content
|
|
41
|
+
let headerCells = [...headerElement.querySelectorAll(".ag-header-cell-text")]
|
|
42
|
+
if (headerCells.length === 0) {
|
|
43
|
+
return [headerElement].map((e) => e.textContent.trim())
|
|
44
|
+
} else {
|
|
45
|
+
return [...headerElement.querySelectorAll(".ag-header-cell-text")]
|
|
46
|
+
.map((e) => e.textContent.trim())
|
|
47
|
+
}
|
|
41
48
|
}).flat()
|
|
42
49
|
|
|
43
50
|
let allRows = [];
|
|
@@ -49,9 +56,14 @@ export const getAgGridData = (agGridElement, options = {}) => {
|
|
|
49
56
|
.sort(sortElementsByAttributeValue("row-index"))
|
|
50
57
|
.map((row) => {
|
|
51
58
|
// Sort row cells by their aria-colindex attribute value
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
59
|
+
// First check if elements returned already contain the aria-colindex
|
|
60
|
+
// If not, just query for the .ag-cell
|
|
61
|
+
let rowCells = [...row.querySelectorAll(".ag-cell [aria-colindex]")]
|
|
62
|
+
if (rowCells.length === 0) {
|
|
63
|
+
rowCells = [...row.querySelectorAll(".ag-cell")]
|
|
64
|
+
}
|
|
65
|
+
return rowCells.sort(sortElementsByAttributeValue("aria-colindex"))
|
|
66
|
+
.map((e)=> e.textContent.trim())
|
|
55
67
|
});
|
|
56
68
|
allRows.push(_rows);
|
|
57
69
|
});
|