@sprucelabs/spruce-location-utils 9.4.1 → 9.4.3
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.
- package/build/esm/tests/locationListCardAssert.js +4 -0
- package/build/esm/viewControllers/LocationListCard.vc.d.ts +2 -1
- package/build/esm/viewControllers/LocationListCard.vc.js +4 -3
- package/build/tests/locationListCardAssert.js +4 -0
- package/build/viewControllers/LocationListCard.vc.d.ts +2 -1
- package/build/viewControllers/LocationListCard.vc.js +4 -3
- package/package.json +1 -1
|
@@ -10,9 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { eventFaker } from '@sprucelabs/spruce-test-fixtures';
|
|
11
11
|
import { assert } from '@sprucelabs/test-utils';
|
|
12
12
|
import LocationListCardViewController from '../viewControllers/LocationListCard.vc.js';
|
|
13
|
+
let wasBeforeEachCalled = false;
|
|
13
14
|
const locationListCardAssert = {
|
|
14
15
|
beforeEach(views) {
|
|
15
16
|
views.setController('locations.list-card', SpyLocationListCard);
|
|
17
|
+
wasBeforeEachCalled = true;
|
|
16
18
|
},
|
|
17
19
|
loadsWithTargetAndPayload(options) {
|
|
18
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -36,6 +38,8 @@ const locationListCardAssert = {
|
|
|
36
38
|
});
|
|
37
39
|
},
|
|
38
40
|
configurationEquals(vc, options) {
|
|
41
|
+
assert.isTrue(wasBeforeEachCalled, "You have to call locationListCardAssert.beforeEach() in your beforeEach(). Also, make sure you are not overridding the view controller for 'locations.list-card' by checking viewFactory.hasController() before setting it!");
|
|
42
|
+
assert.isTrue(vc instanceof SpyLocationListCard, "You have overridden the vc at 'locations.list-card'! Make sure you are checking viewFactory.hasController() before setting it!");
|
|
39
43
|
const spyVc = vc;
|
|
40
44
|
const keys = Object.keys(options);
|
|
41
45
|
for (const key of keys) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AbstractViewController, SpruceSchemas, ViewControllerOptions, ActiveRecordCardViewController, Button, Card } from '@sprucelabs/heartwood-view-controllers';
|
|
1
|
+
import { AbstractViewController, SpruceSchemas, ViewControllerOptions, ActiveRecordCardViewController, Button, Card, CardHeader } from '@sprucelabs/heartwood-view-controllers';
|
|
2
2
|
import { Location } from '@sprucelabs/spruce-core-schemas';
|
|
3
3
|
export default class LocationListCardViewController extends AbstractViewController<Card> {
|
|
4
4
|
static id: string;
|
|
@@ -30,6 +30,7 @@ export type LocationListCardViewControllerOptions = {
|
|
|
30
30
|
selectedLocationId?: string;
|
|
31
31
|
footerButtons?: Button[];
|
|
32
32
|
shouldRenderDeleteButtons?: boolean;
|
|
33
|
+
header?: CardHeader;
|
|
33
34
|
id?: string;
|
|
34
35
|
};
|
|
35
36
|
export type LocationListLoadOptions = SpruceSchemas.Mercury.v2020_12_25.ListLocationsEmitTargetAndPayload;
|
|
@@ -12,7 +12,7 @@ import { locationRenderer } from '@sprucelabs/spruce-skill-utils';
|
|
|
12
12
|
class LocationListCardViewController extends AbstractViewController {
|
|
13
13
|
constructor(options) {
|
|
14
14
|
super(options);
|
|
15
|
-
const { id, onDelete, selectedLocationId, footerButtons, currentOrganizationId, onClick, shouldRenderDeleteButtons, } = options;
|
|
15
|
+
const { id, onDelete, selectedLocationId, footerButtons, currentOrganizationId, onClick, shouldRenderDeleteButtons, header, } = options;
|
|
16
16
|
this.shouldRenderDeleteButtons = shouldRenderDeleteButtons !== null && shouldRenderDeleteButtons !== void 0 ? shouldRenderDeleteButtons : false;
|
|
17
17
|
this.onDeleteHandler = onDelete;
|
|
18
18
|
this.selectedLocationId = selectedLocationId;
|
|
@@ -21,14 +21,15 @@ class LocationListCardViewController extends AbstractViewController {
|
|
|
21
21
|
id,
|
|
22
22
|
currentOrganizationId,
|
|
23
23
|
footerButtons,
|
|
24
|
+
header,
|
|
24
25
|
});
|
|
25
26
|
}
|
|
26
27
|
ActiveRecordCardVc(options) {
|
|
27
|
-
const { currentOrganizationId, footerButtons, id } = options;
|
|
28
|
+
const { currentOrganizationId, footerButtons, id, header } = options;
|
|
28
29
|
return this.Controller('activeRecordCard', buildActiveRecordCard({
|
|
29
30
|
id,
|
|
30
31
|
columnWidths: this.onClickHandler ? ['fill'] : ['content', 'fill'],
|
|
31
|
-
header: {
|
|
32
|
+
header: header !== null && header !== void 0 ? header : {
|
|
32
33
|
title: 'Your locations',
|
|
33
34
|
},
|
|
34
35
|
eventName: 'list-locations::v2020_12_25',
|
|
@@ -7,9 +7,11 @@ exports.SpyLocationListCard = void 0;
|
|
|
7
7
|
const spruce_test_fixtures_1 = require("@sprucelabs/spruce-test-fixtures");
|
|
8
8
|
const test_utils_1 = require("@sprucelabs/test-utils");
|
|
9
9
|
const LocationListCard_vc_1 = __importDefault(require("../viewControllers/LocationListCard.vc"));
|
|
10
|
+
let wasBeforeEachCalled = false;
|
|
10
11
|
const locationListCardAssert = {
|
|
11
12
|
beforeEach(views) {
|
|
12
13
|
views.setController('locations.list-card', SpyLocationListCard);
|
|
14
|
+
wasBeforeEachCalled = true;
|
|
13
15
|
},
|
|
14
16
|
async loadsWithTargetAndPayload(options) {
|
|
15
17
|
const { action, target, payload } = options;
|
|
@@ -31,6 +33,8 @@ const locationListCardAssert = {
|
|
|
31
33
|
}
|
|
32
34
|
},
|
|
33
35
|
configurationEquals(vc, options) {
|
|
36
|
+
test_utils_1.assert.isTrue(wasBeforeEachCalled, "You have to call locationListCardAssert.beforeEach() in your beforeEach(). Also, make sure you are not overridding the view controller for 'locations.list-card' by checking viewFactory.hasController() before setting it!");
|
|
37
|
+
test_utils_1.assert.isTrue(vc instanceof SpyLocationListCard, "You have overridden the vc at 'locations.list-card'! Make sure you are checking viewFactory.hasController() before setting it!");
|
|
34
38
|
const spyVc = vc;
|
|
35
39
|
const keys = Object.keys(options);
|
|
36
40
|
for (const key of keys) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AbstractViewController, SpruceSchemas, ViewControllerOptions, ActiveRecordCardViewController, Button, Card } from '@sprucelabs/heartwood-view-controllers';
|
|
1
|
+
import { AbstractViewController, SpruceSchemas, ViewControllerOptions, ActiveRecordCardViewController, Button, Card, CardHeader } from '@sprucelabs/heartwood-view-controllers';
|
|
2
2
|
import { Location } from '@sprucelabs/spruce-core-schemas';
|
|
3
3
|
export default class LocationListCardViewController extends AbstractViewController<Card> {
|
|
4
4
|
static id: string;
|
|
@@ -30,6 +30,7 @@ export type LocationListCardViewControllerOptions = {
|
|
|
30
30
|
selectedLocationId?: string;
|
|
31
31
|
footerButtons?: Button[];
|
|
32
32
|
shouldRenderDeleteButtons?: boolean;
|
|
33
|
+
header?: CardHeader;
|
|
33
34
|
id?: string;
|
|
34
35
|
};
|
|
35
36
|
export type LocationListLoadOptions = SpruceSchemas.Mercury.v2020_12_25.ListLocationsEmitTargetAndPayload;
|
|
@@ -5,7 +5,7 @@ const spruce_skill_utils_1 = require("@sprucelabs/spruce-skill-utils");
|
|
|
5
5
|
class LocationListCardViewController extends heartwood_view_controllers_1.AbstractViewController {
|
|
6
6
|
constructor(options) {
|
|
7
7
|
super(options);
|
|
8
|
-
const { id, onDelete, selectedLocationId, footerButtons, currentOrganizationId, onClick, shouldRenderDeleteButtons, } = options;
|
|
8
|
+
const { id, onDelete, selectedLocationId, footerButtons, currentOrganizationId, onClick, shouldRenderDeleteButtons, header, } = options;
|
|
9
9
|
this.shouldRenderDeleteButtons = shouldRenderDeleteButtons !== null && shouldRenderDeleteButtons !== void 0 ? shouldRenderDeleteButtons : false;
|
|
10
10
|
this.onDeleteHandler = onDelete;
|
|
11
11
|
this.selectedLocationId = selectedLocationId;
|
|
@@ -14,14 +14,15 @@ class LocationListCardViewController extends heartwood_view_controllers_1.Abstra
|
|
|
14
14
|
id,
|
|
15
15
|
currentOrganizationId,
|
|
16
16
|
footerButtons,
|
|
17
|
+
header,
|
|
17
18
|
});
|
|
18
19
|
}
|
|
19
20
|
ActiveRecordCardVc(options) {
|
|
20
|
-
const { currentOrganizationId, footerButtons, id } = options;
|
|
21
|
+
const { currentOrganizationId, footerButtons, id, header } = options;
|
|
21
22
|
return this.Controller('activeRecordCard', (0, heartwood_view_controllers_1.buildActiveRecordCard)({
|
|
22
23
|
id,
|
|
23
24
|
columnWidths: this.onClickHandler ? ['fill'] : ['content', 'fill'],
|
|
24
|
-
header: {
|
|
25
|
+
header: header !== null && header !== void 0 ? header : {
|
|
25
26
|
title: 'Your locations',
|
|
26
27
|
},
|
|
27
28
|
eventName: 'list-locations::v2020_12_25',
|