mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
[no-issue] fix share dialog test for scenario of last day of the month (#3937)
* fix share dialog test for scenario of last day of the month * fix today and tomorrow * remove fit * fix spec share file * use moment to calculate tomorrow
This commit is contained in:
parent
c10f2dc276
commit
ee068db496
@ -17,6 +17,7 @@
|
||||
|
||||
import { element, by } from 'protractor';
|
||||
import Util = require('../../../util/util');
|
||||
import moment = require('moment');
|
||||
import { FormControllersPage } from '../material/formControllersPage';
|
||||
|
||||
export class ShareDialog {
|
||||
@ -110,16 +111,16 @@ export class ShareDialog {
|
||||
this.timeDatePickerButton.click();
|
||||
}
|
||||
|
||||
async calendarTodayDayIsDisabled() {
|
||||
const today = await this.dayPicker.element(by.css('.mat-datetimepicker-calendar-body-today')).getText();
|
||||
calendarTodayDayIsDisabled() {
|
||||
const today = this.dayPicker.element(by.css('.mat-datetimepicker-calendar-body-today')).getText();
|
||||
Util.waitUntilElementIsPresent(element(by.cssContainingText('.mat-datetimepicker-calendar-body-disabled', today)));
|
||||
}
|
||||
|
||||
async setDefaultDay() {
|
||||
setDefaultDay() {
|
||||
const selector = '.mat-datetimepicker-calendar-body-active .mat-datetimepicker-calendar-body-cell-content';
|
||||
Util.waitUntilElementIsVisible(this.dayPicker);
|
||||
const today = await this.dayPicker.element(by.css('.mat-datetimepicker-calendar-body-today')).getText();
|
||||
const tomorrow = (parseInt(today, 10) + 1).toString();
|
||||
const tomorrow = moment().add(1, 'day').date();
|
||||
let tomorrow = new Date(new Date().getTime() + 24 * 60 * 60 * 1000).getDate().toString();
|
||||
this.dayPicker.element(by.cssContainingText(selector, tomorrow)).click();
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ describe('ShareDialogComponent', () => {
|
||||
});
|
||||
}));
|
||||
|
||||
it(`should copy shared link and notify on button event`, async(() => {
|
||||
it(`should copy shared link and notify on button event`, (done) => {
|
||||
node.entry.properties['qshare:sharedId'] = 'sharedId';
|
||||
spyOn(document, 'execCommand').and.callThrough();
|
||||
|
||||
@ -139,8 +139,9 @@ describe('ShareDialogComponent', () => {
|
||||
|
||||
expect(document.execCommand).toHaveBeenCalledWith('copy');
|
||||
expect(notificationServiceMock.openSnackMessage).toHaveBeenCalledWith('SHARE.CLIPBOARD-MESSAGE');
|
||||
done();
|
||||
});
|
||||
});
|
||||
}));
|
||||
|
||||
it('should open a confirmation dialog when unshare button is triggered', () => {
|
||||
spyOn(matDialog, 'open').and.returnValue({ beforeClose: () => of(false) });
|
||||
|
Loading…
x
Reference in New Issue
Block a user