Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.

Commit 561b1f8

Browse files
authored
Merge pull request #1049 from ghiscoding/bugfix/draggable-on-group-changed-callback
fix(addons): onGroupChanged callback should be executed with Draggable
2 parents 7991e97 + f6ed853 commit 561b1f8

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

src/app/examples/grid-draggrouping.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ <h2>
6767
<div class="form-row">
6868
<div class="row form-group">
6969
<label for="field1" class="col-sm-3 mb-2">Group by field(s)</label>
70-
<div class="form-group col-md-3"
70+
<div class="form-group col-md-3 grouping-selects"
7171
*ngFor="let groupField of selectedGroupingFields; let i = index; trackBy: selectTrackByFn">
72-
<select class="form-select" name="groupField{{i}}" [(ngModel)]="selectedGroupingFields[i]"
72+
<select class="form-select" name="group-field-{{i}}" [(ngModel)]="selectedGroupingFields[i]"
7373
(ngModelChange)="groupByFieldName($event, i)">
7474
<option value=""></option>
7575
<option [ngValue]="field.id" *ngFor="let field of columnDefinitions">{{field.name}}</option>

test/cypress/e2e/example19.cy.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ describe('Example 19 - Draggable Grouping & Aggregators', { retries: 1 }, () =>
2222
cy.get('[data-test="group-duration-sort-value-btn"]').click();
2323
cy.get('[data-test="collapse-all-btn"]').click();
2424

25+
cy.get('.grouping-selects select:nth(0)').should('have.value', '2: duration');
26+
cy.get('.grouping-selects select:nth(1)').should('not.have.value');
27+
cy.get('.grouping-selects select:nth(2)').should('not.have.value');
2528
cy.get(`[style="top:${GRID_ROW_HEIGHT * 0}px"] > .slick-cell:nth(0) .slick-group-toggle.collapsed`).should('have.length', 1);
2629
cy.get(`[style="top:${GRID_ROW_HEIGHT * 0}px"] > .slick-cell:nth(0) .slick-group-title`).should('contain', 'Duration: 0');
2730

@@ -45,6 +48,9 @@ describe('Example 19 - Draggable Grouping & Aggregators', { retries: 1 }, () =>
4548

4649
it('should show 1 column title (Duration) shown in the pre-header section', () => {
4750
cy.get('.slick-dropped-grouping:nth(0) div').contains('Duration');
51+
cy.get('.grouping-selects select:nth(0)').should('have.value', '2: duration');
52+
cy.get('.grouping-selects select:nth(1)').should('not.have.value');
53+
cy.get('.grouping-selects select:nth(2)').should('not.have.value');
4854
});
4955

5056
it('should "Group by Duration then Effort-Driven" and expect 1st row to be expanded, 2nd row to be expanded and 3rd row to be a regular row', () => {
@@ -60,9 +66,12 @@ describe('Example 19 - Draggable Grouping & Aggregators', { retries: 1 }, () =>
6066
cy.get(`[style="top:${GRID_ROW_HEIGHT * 2}px"] > .slick-cell:nth(1)`).should('contain', '0');
6167
});
6268

63-
it('should show 2 column titles (Duration, Effort-Driven) shown in the pre-header section', () => {
69+
it('should show 2 column titles (Duration, Effort-Driven) shown in the pre-header section & same select dropdown', () => {
6470
cy.get('.slick-dropped-grouping:nth(0) div').contains('Duration');
6571
cy.get('.slick-dropped-grouping:nth(1) div').contains('Effort-Driven');
72+
cy.get('.grouping-selects select:nth(0)').should('have.value', '2: duration');
73+
cy.get('.grouping-selects select:nth(1)').should('have.value', '7: effortDriven');
74+
cy.get('.grouping-selects select:nth(2)').should('not.have.value');
6675
});
6776

6877
it('should be able to drag and swap grouped column titles inside the pre-header', () => {
@@ -72,6 +81,9 @@ describe('Example 19 - Draggable Grouping & Aggregators', { retries: 1 }, () =>
7281

7382
cy.get('.slick-dropped-grouping:nth(0) div').contains('Effort-Driven');
7483
cy.get('.slick-dropped-grouping:nth(1) div').contains('Duration');
84+
cy.get('.grouping-selects select:nth(0)').should('have.value', '7: effortDriven');
85+
cy.get('.grouping-selects select:nth(1)').should('have.value', '2: duration');
86+
cy.get('.grouping-selects select:nth(2)').should('not.have.value');
7587
});
7688

7789
it('should expect the grouping to be swapped as well in the grid', () => {
@@ -179,5 +191,12 @@ describe('Example 19 - Draggable Grouping & Aggregators', { retries: 1 }, () =>
179191
cy.get('.right-footer')
180192
.contains('500 of 500 items');
181193
});
194+
195+
it('should clear all grouping and expect all select dropdown to be cleared too', () => {
196+
cy.get('[data-test="clear-grouping-btn"]').click();
197+
cy.get('.grouping-selects select:nth(0)').should('not.have.value');
198+
cy.get('.grouping-selects select:nth(1)').should('not.have.value');
199+
cy.get('.grouping-selects select:nth(2)').should('not.have.value');
200+
});
182201
});
183202
});

0 commit comments

Comments
 (0)