@sprucelabs/heartwood-view-controllers 112.3.28 → 112.3.30

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.
@@ -15,7 +15,7 @@ import { getVcName } from './assertSupport.js';
15
15
  import { pluckButtons } from './buttonAssert.js';
16
16
  import calendarInteractor from './calendarInteractor.js';
17
17
  import formAssert from './formAssert.js';
18
- import navigationAssert from './navigationAssert.js';
18
+ import navigationAssert, { getButtonFromNav } from './navigationAssert.js';
19
19
  import pagerAssert from './pagerAssert.js';
20
20
  import vcAssert from './vcAssert.js';
21
21
  const interactor = {
@@ -396,9 +396,7 @@ const interactor = {
396
396
  const navVc = vc.load
397
397
  ? navigationAssert.skillViewRendersNavigation(vc)
398
398
  : vc;
399
- const { foundButtons } = pluckButtons(navVc, [buttonId]);
400
- const match = foundButtons[0];
401
- assert.isTruthy(match, `I could not find a button with the id '${buttonId}' in your nav!`);
399
+ const match = getButtonFromNav(navVc, buttonId);
402
400
  return this.click(match);
403
401
  });
404
402
  },
@@ -20,3 +20,4 @@ declare const navigationAssert: {
20
20
  hasAdditionalValidRoutes(vc: ViewController<Navigation>, routes: NavigationRoute[]): void;
21
21
  };
22
22
  export default navigationAssert;
23
+ export declare function getButtonFromNav(vc: ViewController<Navigation>, id: string): any;
@@ -59,18 +59,13 @@ const navigationAssert = {
59
59
  },
60
60
  };
61
61
  export default navigationAssert;
62
- function getButtonFromNav(vc, id) {
63
- var _a, _b, _c, _d;
62
+ export function getButtonFromNav(vc, id) {
63
+ var _a;
64
64
  const model = renderUtil.render(vc);
65
- if ((_a = model.buttons) === null || _a === void 0 ? void 0 : _a[0].dropdown) {
66
- const button = (_c = (_b = model.buttons[0].dropdown) === null || _b === void 0 ? void 0 : _b.items) === null || _c === void 0 ? void 0 : _c.find((b) => b.id === id);
67
- assert.isTruthy(button);
68
- return;
69
- }
70
- const buttons = (_d = model.buttons) === null || _d === void 0 ? void 0 : _d.reduce((acc, b) => {
65
+ const buttons = (_a = model.buttons) === null || _a === void 0 ? void 0 : _a.reduce((acc, b) => {
71
66
  var _a, _b;
72
67
  if (b.dropdown) {
73
- return [...acc, ...((_b = (_a = b === null || b === void 0 ? void 0 : b.dropdown) === null || _a === void 0 ? void 0 : _a.items) !== null && _b !== void 0 ? _b : [])];
68
+ return [...acc, b, ...((_b = (_a = b === null || b === void 0 ? void 0 : b.dropdown) === null || _a === void 0 ? void 0 : _a.items) !== null && _b !== void 0 ? _b : [])];
74
69
  }
75
70
  return [...acc, b];
76
71
  }, []);
@@ -1,4 +1,37 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
37
  };
@@ -11,7 +44,7 @@ const assertSupport_1 = require("./assertSupport");
11
44
  const buttonAssert_1 = require("./buttonAssert");
12
45
  const calendarInteractor_1 = __importDefault(require("./calendarInteractor"));
13
46
  const formAssert_1 = __importDefault(require("./formAssert"));
14
- const navigationAssert_1 = __importDefault(require("./navigationAssert"));
47
+ const navigationAssert_1 = __importStar(require("./navigationAssert"));
15
48
  const pagerAssert_1 = __importDefault(require("./pagerAssert"));
16
49
  const vcAssert_1 = __importDefault(require("./vcAssert"));
17
50
  const interactor = {
@@ -317,9 +350,7 @@ const interactor = {
317
350
  const navVc = vc.load
318
351
  ? navigationAssert_1.default.skillViewRendersNavigation(vc)
319
352
  : vc;
320
- const { foundButtons } = (0, buttonAssert_1.pluckButtons)(navVc, [buttonId]);
321
- const match = foundButtons[0];
322
- test_utils_1.assert.isTruthy(match, `I could not find a button with the id '${buttonId}' in your nav!`);
353
+ const match = (0, navigationAssert_1.getButtonFromNav)(navVc, buttonId);
323
354
  return this.click(match);
324
355
  },
325
356
  /**
@@ -20,3 +20,4 @@ declare const navigationAssert: {
20
20
  hasAdditionalValidRoutes(vc: ViewController<Navigation>, routes: NavigationRoute[]): void;
21
21
  };
22
22
  export default navigationAssert;
23
+ export declare function getButtonFromNav(vc: ViewController<Navigation>, id: string): any;
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getButtonFromNav = getButtonFromNav;
6
7
  const schema_1 = require("@sprucelabs/schema");
7
8
  const test_utils_1 = require("@sprucelabs/test-utils");
8
9
  const render_utility_1 = __importDefault(require("../../utilities/render.utility"));
@@ -62,14 +63,9 @@ const navigationAssert = {
62
63
  exports.default = navigationAssert;
63
64
  function getButtonFromNav(vc, id) {
64
65
  const model = render_utility_1.default.render(vc);
65
- if (model.buttons?.[0].dropdown) {
66
- const button = model.buttons[0].dropdown?.items?.find((b) => b.id === id);
67
- test_utils_1.assert.isTruthy(button);
68
- return;
69
- }
70
66
  const buttons = model.buttons?.reduce((acc, b) => {
71
67
  if (b.dropdown) {
72
- return [...acc, ...(b?.dropdown?.items ?? [])];
68
+ return [...acc, b, ...(b?.dropdown?.items ?? [])];
73
69
  }
74
70
  return [...acc, b];
75
71
  }, []);
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "sideEffects": false,
14
14
  "license": "MIT",
15
15
  "description": "All the power of Heartwood in one, convenient package.",
16
- "version": "112.3.28",
16
+ "version": "112.3.30",
17
17
  "skill": {
18
18
  "namespace": "HeartwoodViewControllers",
19
19
  "commandOverrides": {