Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/app/examples/grid-formatter.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ export class GridFormatterComponent implements OnInit {
{
id: 'completed', name: 'Completed', field: 'completed', type: FieldType.number, sortable: true, minWidth: 100,
formatter: customEnableButtonFormatter,
onCellClick: (e, args) => {
this.toggleCompletedProperty(args && args.dataContext);
onCellClick: (_e, args) => {
this.toggleCompletedProperty(args?.dataContext);
}
}
];
Expand Down
22 changes: 22 additions & 0 deletions test/cypress/e2e/example02.cy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { removeExtraSpaces } from '../plugins/utilities';

describe('Example 2 - Grid with Formatters', () => {
const GRID_ROW_HEIGHT = 35;

it('should display Example title', () => {
cy.visit(`${Cypress.config('baseUrl')}/formatter`);
cy.get('h2').should('contain', 'Example 2: Grid with Formatters');
Expand All @@ -22,4 +24,24 @@ describe('Example 2 - Grid with Formatters', () => {
expect(text).to.eq('500 items');
});
});

it('should expect "Effort Driven" 1st cell to include fire icon', () => {
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 0}px;"] > .slick-cell:nth(7)`).find('.mdi.mdi-fire.red').should('have.length', 1);
});

it('should expect "Effort Driven" 2nd cell to include a snowflake icon', () => {
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 1}px;"] > .slick-cell:nth(7)`).find('.mdi.mdi-snowflake').should('have.length', 1);
});

it('should click on a "Completed" cell and expect it to toggle to checked', () => {
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 0}px;"] > .slick-cell:nth(8)`).find('.mdi.mdi-circle').should('have.length', 1);
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 0}px;"] > .slick-cell:nth(8)`).click();
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 0}px;"] > .slick-cell:nth(8)`).find('.mdi.mdi-circle').should('have.length', 0);
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 0}px;"] > .slick-cell:nth(8)`).find('.mdi.mdi-check-circle').should('have.length', 1);

cy.get(`[style="top: ${GRID_ROW_HEIGHT * 1}px;"] > .slick-cell:nth(8)`).find('.mdi.mdi-circle').should('have.length', 1);
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 1}px;"] > .slick-cell:nth(8)`).click();
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 1}px;"] > .slick-cell:nth(8)`).find('.mdi.mdi-circle').should('have.length', 0);
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 1}px;"] > .slick-cell:nth(8)`).find('.mdi.mdi-check-circle').should('have.length', 1);
});
});
Loading