*/
@PageHelper.restrictTo(pages.index.url)
editMirror(name: string, option: string) {
- // Clicks the pool in the table
+ // Select the pool in the table
this.getFirstTableCell(name).click();
// Clicks the Edit Mode button
cy.contains('.modal-dialog', 'Edit pool mirror mode').should('not.exist');
const val = option.toLowerCase(); // used since entries in table are lower case
this.getFirstTableCell(val).should('be.visible');
+
+ // unselect the pool in the table
+ this.getFirstTableCell(name).click();
}
}
@PageHelper.restrictTo(pages.index.url)
maintenance(hostname: string, exit = false, force = false) {
this.clearTableSearchInput();
+ this.getTableCell(this.columnIndex.hostname, hostname).click();
if (force) {
- this.getTableCell(this.columnIndex.hostname, hostname).click();
this.clickActionButton('enter-maintenance');
cy.get('cd-modal').within(() => {
}
if (exit) {
this.getTableCell(this.columnIndex.hostname, hostname)
- .click()
.parent()
.find(`datatable-body-cell:nth-child(${this.columnIndex.status})`)
.then(($ele) => {
expect(status).to.not.include('maintenance');
});
} else {
- this.getTableCell(this.columnIndex.hostname, hostname).click();
this.clickActionButton('enter-maintenance');
this.getTableCell(this.columnIndex.hostname, hostname)
cy.wait(20000);
this.expectTableCount('total', 0);
});
+
+ // unselect it to avoid colliding with any other selection
+ // in different steps
+ this.getTableCell(this.columnIndex.hostname, hostname).click();
}
}
cy.get('cd-service-daemon-list').within(() => {
this.getTableRow(daemon).click();
this.clickActionButton(action);
+
+ // unselect it to avoid colliding with any other selection
+ // in different steps
+ this.getTableRow(daemon).click();
});
}
}
expect(executingElement.nativeElement.textContent.trim()).toBe(`(${state})`);
};
- it.only('should display executing template', () => {
+ it('should display executing template', () => {
testExecutingTemplate();
});
- it.only('should display executing template with custom classes', () => {
+ it('should display executing template with custom classes', () => {
testExecutingTemplate({ valueClass: 'a b', executingClass: 'c d' });
});
});
+ describe('test unselect functionality of rows', () => {
+ beforeEach(() => {
+ component.autoReload = -1;
+ component.selectionType = 'single';
+ fixture.detectChanges();
+ });
+
+ it('should unselect row on clicking on it again', () => {
+ const rowCellDebugElement = fixture.debugElement.query(By.css('datatable-body-cell'));
+
+ rowCellDebugElement.triggerEventHandler('click', null);
+ expect(component.selection.selected.length).toEqual(1);
+
+ rowCellDebugElement.triggerEventHandler('click', null);
+ expect(component.selection.selected.length).toEqual(0);
+ });
+ });
+
describe('reload data', () => {
beforeEach(() => {
component.ngOnInit();
} else {
this.useData();
}
+
+ if (this.selectionType === 'single') {
+ this.table.selectCheck = this.singleSelectCheck.bind(this);
+ }
}
initUserConfig() {
this.updateSelection.emit(_.clone(this.selection));
}
+ private singleSelectCheck(row: any) {
+ return this.selection.selected.indexOf(row) === -1;
+ }
+
toggleColumn(column: CdTableColumn) {
const prop: TableColumnProp = column.prop;
const hide = !column.isHidden;