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 { element, by } from 'protractor';
|
||||||
import Util = require('../../../util/util');
|
import Util = require('../../../util/util');
|
||||||
|
import moment = require('moment');
|
||||||
import { FormControllersPage } from '../material/formControllersPage';
|
import { FormControllersPage } from '../material/formControllersPage';
|
||||||
|
|
||||||
export class ShareDialog {
|
export class ShareDialog {
|
||||||
@ -110,17 +111,17 @@ export class ShareDialog {
|
|||||||
this.timeDatePickerButton.click();
|
this.timeDatePickerButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
async calendarTodayDayIsDisabled() {
|
calendarTodayDayIsDisabled() {
|
||||||
const today = await this.dayPicker.element(by.css('.mat-datetimepicker-calendar-body-today')).getText();
|
const today = this.dayPicker.element(by.css('.mat-datetimepicker-calendar-body-today')).getText();
|
||||||
Util.waitUntilElementIsPresent(element(by.cssContainingText('.mat-datetimepicker-calendar-body-disabled', today)));
|
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';
|
const selector = '.mat-datetimepicker-calendar-body-active .mat-datetimepicker-calendar-body-cell-content';
|
||||||
Util.waitUntilElementIsVisible(this.dayPicker);
|
Util.waitUntilElementIsVisible(this.dayPicker);
|
||||||
const today = await this.dayPicker.element(by.css('.mat-datetimepicker-calendar-body-today')).getText();
|
const tomorrow = moment().add(1, 'day').date();
|
||||||
const tomorrow = (parseInt(today, 10) + 1).toString();
|
let tomorrow = new Date(new Date().getTime() + 24 * 60 * 60 * 1000).getDate().toString();
|
||||||
this.dayPicker.element(by.cssContainingText(selector, tomorrow )).click();
|
this.dayPicker.element(by.cssContainingText(selector, tomorrow)).click();
|
||||||
}
|
}
|
||||||
|
|
||||||
setDefaultHour() {
|
setDefaultHour() {
|
||||||
|
@ -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';
|
node.entry.properties['qshare:sharedId'] = 'sharedId';
|
||||||
spyOn(document, 'execCommand').and.callThrough();
|
spyOn(document, 'execCommand').and.callThrough();
|
||||||
|
|
||||||
@ -139,8 +139,9 @@ describe('ShareDialogComponent', () => {
|
|||||||
|
|
||||||
expect(document.execCommand).toHaveBeenCalledWith('copy');
|
expect(document.execCommand).toHaveBeenCalledWith('copy');
|
||||||
expect(notificationServiceMock.openSnackMessage).toHaveBeenCalledWith('SHARE.CLIPBOARD-MESSAGE');
|
expect(notificationServiceMock.openSnackMessage).toHaveBeenCalledWith('SHARE.CLIPBOARD-MESSAGE');
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}));
|
|
||||||
|
|
||||||
it('should open a confirmation dialog when unshare button is triggered', () => {
|
it('should open a confirmation dialog when unshare button is triggered', () => {
|
||||||
spyOn(matDialog, 'open').and.returnValue({ beforeClose: () => of(false) });
|
spyOn(matDialog, 'open').and.returnValue({ beforeClose: () => of(false) });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user