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