@sprucelabs/spruce-calendar-components 26.0.5 → 26.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,7 +26,7 @@ class CalendarToolBeltStateMachineTestFactory {
26
26
  const toolBeltVc = views.Controller('toolBelt', {});
27
27
  const event = heartwood_view_controllers_1.calendarSeeder.generateEventValues();
28
28
  const calendarVc = passedCalendarVc !== null && passedCalendarVc !== void 0 ? passedCalendarVc : views.Controller('calendar.calendar', {
29
- onAddDraftEvent: () => { },
29
+ onAddDraftEvent: (event) => events.addDraftEvent(event),
30
30
  onEventSwapped(draft, saved) {
31
31
  return events.silentlySwapEvent(draft.id, saved);
32
32
  },
@@ -59,11 +59,11 @@ const calendarAssert = {
59
59
  }
60
60
  },
61
61
  eventEquals(actual, expected) {
62
- var _a, _b, _c;
62
+ var _a, _b, _c, _d;
63
63
  test_utils_1.assert.isTruthy(actual, 'Event is missing');
64
64
  test_utils_1.assert.isTruthy(expected, 'Event is missing');
65
65
  test_utils_1.assert.isEqual(actual.startDateTimeMs, expected.startDateTimeMs, 'startDateTimeMs does not match');
66
- test_utils_1.assert.isEqual((_a = actual.isBusy) !== null && _a !== void 0 ? _a : false, (_b = expected.isBusy) !== null && _b !== void 0 ? _b : false, `isBusy does not match, needs to be '${(_c = expected.isBusy) !== null && _c !== void 0 ? _c : false}'`);
66
+ test_utils_1.assert.isEqual((_a = actual.isBusy) !== null && _a !== void 0 ? _a : false, (_b = expected.isBusy) !== null && _b !== void 0 ? _b : false, `isBusy does not match, needs to be '${(_c = expected.isBusy) !== null && _c !== void 0 ? _c : false}' but got '${(_d = actual.isBusy) !== null && _d !== void 0 ? _d : false}'`);
67
67
  const cleanedActual = (0, just_clone_1.default)(actual);
68
68
  const cleanedExpected = (0, just_clone_1.default)(expected);
69
69
  cleanEvent(cleanedActual);
@@ -113,6 +113,9 @@ class CalendarEventManager {
113
113
  async addDraftEvent(event, shouldSelectEvent = true) {
114
114
  this.allEvents.push(event);
115
115
  if (shouldSelectEvent) {
116
+ if (!this.calendarVc.hasEvent(event.id)) {
117
+ this.calendarVc.addEvent(event);
118
+ }
116
119
  await this.calendarVc.selectEvent(event.id);
117
120
  await this.updateEventInContext(event);
118
121
  }
@@ -30,7 +30,7 @@ export default class CalendarToolBeltStateMachineTestFactory {
30
30
  const toolBeltVc = views.Controller('toolBelt', {});
31
31
  const event = calendarSeeder.generateEventValues();
32
32
  const calendarVc = passedCalendarVc !== null && passedCalendarVc !== void 0 ? passedCalendarVc : views.Controller('calendar.calendar', {
33
- onAddDraftEvent: () => { },
33
+ onAddDraftEvent: (event) => events.addDraftEvent(event),
34
34
  onEventSwapped(draft, saved) {
35
35
  return events.silentlySwapEvent(draft.id, saved);
36
36
  },
@@ -54,11 +54,11 @@ const calendarAssert = {
54
54
  }
55
55
  },
56
56
  eventEquals(actual, expected) {
57
- var _a, _b, _c;
57
+ var _a, _b, _c, _d;
58
58
  assert.isTruthy(actual, 'Event is missing');
59
59
  assert.isTruthy(expected, 'Event is missing');
60
60
  assert.isEqual(actual.startDateTimeMs, expected.startDateTimeMs, 'startDateTimeMs does not match');
61
- assert.isEqual((_a = actual.isBusy) !== null && _a !== void 0 ? _a : false, (_b = expected.isBusy) !== null && _b !== void 0 ? _b : false, `isBusy does not match, needs to be '${(_c = expected.isBusy) !== null && _c !== void 0 ? _c : false}'`);
61
+ assert.isEqual((_a = actual.isBusy) !== null && _a !== void 0 ? _a : false, (_b = expected.isBusy) !== null && _b !== void 0 ? _b : false, `isBusy does not match, needs to be '${(_c = expected.isBusy) !== null && _c !== void 0 ? _c : false}' but got '${(_d = actual.isBusy) !== null && _d !== void 0 ? _d : false}'`);
62
62
  const cleanedActual = clone(actual);
63
63
  const cleanedExpected = clone(expected);
64
64
  cleanEvent(cleanedActual);
@@ -120,6 +120,9 @@ export default class CalendarEventManager {
120
120
  return __awaiter(this, void 0, void 0, function* () {
121
121
  this.allEvents.push(event);
122
122
  if (shouldSelectEvent) {
123
+ if (!this.calendarVc.hasEvent(event.id)) {
124
+ this.calendarVc.addEvent(event);
125
+ }
123
126
  yield this.calendarVc.selectEvent(event.id);
124
127
  yield this.updateEventInContext(event);
125
128
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sprucelabs/spruce-calendar-components",
3
3
  "description": "Calendar components for working with calendars and Sprucebot.",
4
- "version": "26.0.5",
4
+ "version": "26.0.6",
5
5
  "skill": {
6
6
  "namespace": "calendar"
7
7
  },