fixed calendar front unit tests
gitea/salix/dev This commit has test failures
Details
gitea/salix/dev This commit has test failures
Details
This commit is contained in:
parent
d407fc7803
commit
f8035c9777
|
@ -1,4 +1,4 @@
|
|||
fdescribe('Component vnCalendar', () => {
|
||||
describe('Component vnCalendar', () => {
|
||||
let controller;
|
||||
let $element;
|
||||
|
||||
|
@ -14,12 +14,12 @@ fdescribe('Component vnCalendar', () => {
|
|||
$element.remove();
|
||||
});
|
||||
|
||||
describe('events() setter', () => {
|
||||
describe('data() setter', () => {
|
||||
it(`should set an array of events and convert string dates to string object, then call repaint() method`, () => {
|
||||
spyOn(controller, 'repaint');
|
||||
|
||||
let currentDate = new Date().toString();
|
||||
controller.events = [
|
||||
controller.data = [
|
||||
{dated: currentDate, title: 'Event 1'},
|
||||
{dated: currentDate, title: 'Event 2'},
|
||||
];
|
||||
|
@ -30,8 +30,7 @@ fdescribe('Component vnCalendar', () => {
|
|||
});
|
||||
|
||||
describe('addEvent()', () => {
|
||||
it(`should add an event to an array of events, then call repaint() method`, () => {
|
||||
spyOn(controller, 'repaint');
|
||||
it(`should add an event to an array of events`, () => {
|
||||
controller.events = [];
|
||||
controller.addEvent({
|
||||
dated: new Date(),
|
||||
|
@ -43,13 +42,13 @@ fdescribe('Component vnCalendar', () => {
|
|||
expect(firstEvent.title).toEqual('My event');
|
||||
expect(firstEvent.isRemovable).toBeDefined();
|
||||
expect(firstEvent.isRemovable).toBeTruthy();
|
||||
expect(controller.repaint).toHaveBeenCalledWith();
|
||||
});
|
||||
|
||||
it(`should not repeat an event for the same date, should not call repaint() method`, () => {
|
||||
spyOn(controller, 'repaint');
|
||||
it(`should not repeat an event for the same date`, () => {
|
||||
const curDate = new Date();
|
||||
controller._events = [{
|
||||
curDate.setHours(0, 0, 0, 0);
|
||||
|
||||
controller.events = [{
|
||||
dated: curDate,
|
||||
title: 'My event 1',
|
||||
className: 'color'
|
||||
|
@ -64,13 +63,11 @@ fdescribe('Component vnCalendar', () => {
|
|||
|
||||
expect(controller.events.length).toEqual(1);
|
||||
expect(firstEvent.title).toEqual('My event 1');
|
||||
expect(controller.repaint).not.toHaveBeenCalledWith();
|
||||
});
|
||||
});
|
||||
|
||||
describe('removeEvent()', () => {
|
||||
it(`should remove an event from an array of events, then call repaint() method`, () => {
|
||||
spyOn(controller, 'repaint');
|
||||
it(`should remove an event from an array of events`, () => {
|
||||
const curDate = new Date();
|
||||
controller._events = [{
|
||||
dated: curDate,
|
||||
|
@ -80,7 +77,6 @@ fdescribe('Component vnCalendar', () => {
|
|||
controller.removeEvent(curDate);
|
||||
|
||||
expect(controller.events.length).toEqual(0);
|
||||
expect(controller.repaint).toHaveBeenCalledWith();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -98,7 +98,6 @@ class Controller {
|
|||
now.setDate(1);
|
||||
|
||||
months[i] = now;
|
||||
console.log(now);
|
||||
}
|
||||
|
||||
return months;
|
||||
|
|
Loading…
Reference in New Issue