@sprucelabs/heartwood-view-controllers 129.5.6 → 129.5.7
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/README.md +721 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,24 +1,721 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
# @sprucelabs/heartwood-view-controllers
|
|
2
|
+
|
|
3
|
+
All the power of Heartwood in one, convenient package.
|
|
4
|
+
|
|
5
|
+
This module provides the controller layer for building UIs in the Spruce Platform. It includes abstract base classes, 30+ built-in view controllers, type-safe builders, and a comprehensive test utility suite.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
yarn add @sprucelabs/heartwood-view-controllers
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Class Hierarchy
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
AbstractController
|
|
17
|
+
├── AbstractViewController<ViewModel>
|
|
18
|
+
│ └── AbstractSkillViewController<Args, ViewModel>
|
|
19
|
+
└── AbstractAppController
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### AbstractController
|
|
23
|
+
|
|
24
|
+
The base class for all controllers. Provides:
|
|
25
|
+
|
|
26
|
+
| Method | Description |
|
|
27
|
+
|---|---|
|
|
28
|
+
| `Controller(name, options)` | Instantiate a child controller. |
|
|
29
|
+
| `renderInDialog(options)` | Render a `Dialog`. |
|
|
30
|
+
| `hideDialog()` | Hide the active `Dialog`. |
|
|
31
|
+
| `toast(options)` | Show a toast message. |
|
|
32
|
+
| `alert(options)` | Show an alert `Dialog` and wait for dismissal. |
|
|
33
|
+
| `confirm(options)` | Show a confirm `Dialog` and return `true`/`false`. |
|
|
34
|
+
| `askForAVote(options)` | Request a feature vote. |
|
|
35
|
+
| `mixinControllers(map)` | Register additional controllers at runtime. |
|
|
36
|
+
| `destroy()` | Destroy this controller and all children. |
|
|
37
|
+
|
|
38
|
+
Protected properties: `device`, `connectToApi`, `views` (ViewControllerFactory).
|
|
39
|
+
|
|
40
|
+
### AbstractViewController\<ViewModel\>
|
|
41
|
+
|
|
42
|
+
Extends `AbstractController`. Base class for all view controllers.
|
|
43
|
+
|
|
44
|
+
| Method | Description |
|
|
45
|
+
|---|---|
|
|
46
|
+
| `triggerRender()` | Notify the view layer to re-render. |
|
|
47
|
+
| `setTriggerRenderHandler(handler)` | Set the render handler. |
|
|
48
|
+
| `renderOnce(cb)` | Batch updates — suspends rendering until `cb` completes, then triggers one render. |
|
|
49
|
+
| `renderOnceSync(cb)` | Synchronous version of `renderOnce`. |
|
|
50
|
+
| `render()` | Abstract. Return the view model. |
|
|
51
|
+
|
|
52
|
+
Protected properties: `dates` (DateUtil), `maps` (MapUtil), `log` (Log), `plugins` (ViewControllerPlugins).
|
|
53
|
+
|
|
54
|
+
### AbstractSkillViewController\<Args\>
|
|
55
|
+
|
|
56
|
+
Extends `AbstractViewController`. Base class for skill-level controllers (full-page views).
|
|
57
|
+
|
|
58
|
+
| Method | Description |
|
|
59
|
+
|---|---|
|
|
60
|
+
| `load(options)` | Called after login and scope prerequisites are met. |
|
|
61
|
+
| `focus()` | Called when this view becomes active. |
|
|
62
|
+
| `blur()` | Called when this view loses focus. |
|
|
63
|
+
| `setTitle(title)` | Set the skill view title. |
|
|
64
|
+
| `getTitle()` | Get the title. |
|
|
65
|
+
| `setSubtitle(subtitle)` | Set the subtitle. |
|
|
66
|
+
| `getSubtitle()` | Get the subtitle. |
|
|
67
|
+
| `renderLockScreen(options)` | Render a lock screen overlay. |
|
|
68
|
+
|
|
69
|
+
### AbstractAppController
|
|
70
|
+
|
|
71
|
+
Extends `AbstractController`. Base class for app-level controllers.
|
|
72
|
+
|
|
73
|
+
| Method | Description |
|
|
74
|
+
|---|---|
|
|
75
|
+
| `load(options)` | Called when the app initializes. |
|
|
76
|
+
| `renderLockScreen(options)` | Render a lock screen overlay. |
|
|
77
|
+
|
|
78
|
+
## Built-in Controllers
|
|
79
|
+
|
|
80
|
+
Instantiate any of these with `this.Controller(id, options)`:
|
|
81
|
+
|
|
82
|
+
| ID | Class | Description |
|
|
83
|
+
|---|---|---|
|
|
84
|
+
| `'card'` | CardViewController | Renders a card with header, body sections, and footer. |
|
|
85
|
+
| `'dialog'` | DialogViewController | Modal dialog wrapping a card. |
|
|
86
|
+
| `'form'` | FormViewController | Schema-driven form with validation. |
|
|
87
|
+
| `'big-form'` | BigFormViewController | Multi-slide form (extends FormViewController). |
|
|
88
|
+
| `'list'` | ListViewController | Rows of data with inputs, buttons, and selection. |
|
|
89
|
+
| `'calendar'` | CalendarViewController | Day/month calendar with events, people, and shifts. |
|
|
90
|
+
| `'calendar-event'` | CalendarEventViewController | Individual calendar event. |
|
|
91
|
+
| `'swipe-card'` | SwipeCardViewController | Card with swipeable slides. |
|
|
92
|
+
| `'tool-belt'` | ToolBeltViewController | Side panel with focusable tools. |
|
|
93
|
+
| `'navigation'` | NavigationViewController | Navigation bar with buttons. |
|
|
94
|
+
| `'login-card'` | LoginCardViewController | Multi-step login flow (phone/email + PIN). |
|
|
95
|
+
| `'active-record-card'` | ActiveRecordCardViewController | Card backed by a remote data source. |
|
|
96
|
+
| `'active-record-list'` | ActiveRecordListViewController | List backed by a remote data source. |
|
|
97
|
+
| `'button-bar'` | ButtonBarViewController | Horizontal bar of selectable buttons. |
|
|
98
|
+
| `'button-group'` | ButtonGroupViewController | Group of selectable buttons (single or multi-select). |
|
|
99
|
+
| `'confirm'` | ConfirmViewController | Confirmation dialog with accept/decline. |
|
|
100
|
+
| `'feed'` | FeedViewController | Message feed with scrolling. |
|
|
101
|
+
| `'talking-sprucebot'` | TalkingSprucebotViewController | Animated Sprucebot with typed sentences. |
|
|
102
|
+
| `'countdown-timer'` | CountdownTimerViewController | Timer counting down to a target time. |
|
|
103
|
+
| `'progress-navigator'` | ProgressNavigatorViewController | Step-based progress indicator. |
|
|
104
|
+
| `'pager'` | PagerViewController | Page navigation controls. |
|
|
105
|
+
| `'stats'` | StatsViewController | Stat values display. |
|
|
106
|
+
| `'progress'` | ProgressViewController | Progress bar (0-1). |
|
|
107
|
+
| `'ratings'` | RatingsViewController | Star/radio rating input. |
|
|
108
|
+
| `'bar-chart'` | BarChartViewController | Bar chart visualization. |
|
|
109
|
+
| `'line-graph'` | LineGraphViewController | Line graph visualization. |
|
|
110
|
+
| `'polar-area'` | PolarAreaViewController | Polar area chart. |
|
|
111
|
+
| `'map'` | MapViewController | Map with pins. |
|
|
112
|
+
| `'autocomplete-input'` | AutocompleteInputViewController | Text input with suggestions. |
|
|
113
|
+
| `'lock-screen'` | LockScreenSkillViewController | Full-screen lock overlay. |
|
|
114
|
+
| `'web-rtc-player'` | WebRtcPlayerViewController | WebRTC video player with cropping. |
|
|
115
|
+
|
|
116
|
+
## Key Types
|
|
117
|
+
|
|
118
|
+
### ViewControllerOptions
|
|
119
|
+
|
|
120
|
+
Constructor options provided to all controllers:
|
|
121
|
+
|
|
122
|
+
| Property | Type | Description |
|
|
123
|
+
|---|---|---|
|
|
124
|
+
| `vcFactory` | `ViewControllerFactory` | Factory for instantiating controllers. |
|
|
125
|
+
| `connectToApi` | `() => Promise<MercuryClient>` | Connect to the Mercury API. |
|
|
126
|
+
| `device` | `Device` | Access native device capabilities. |
|
|
127
|
+
| `dates` | `DateUtil` | Date formatting and math. |
|
|
128
|
+
| `maps` | `MapUtil` | Map utilities. |
|
|
129
|
+
| `log` | `Log` | Logging. |
|
|
130
|
+
| `plugins` | `ViewControllerPlugins` | Registered plugins. |
|
|
131
|
+
| `renderInDialogHandler` | `RenderInDialogHandler` | Handler for rendering dialogs. |
|
|
132
|
+
| `confirmHandler` | `ConfirmHandler` | Handler for confirm dialogs. |
|
|
133
|
+
| `toastHandler` | `ToastHandler` | Handler for toast messages. |
|
|
134
|
+
| `voteHandler` | `VoteHandler` | Handler for vote requests. |
|
|
135
|
+
| `renderLockScreenHandler` | `RenderLockScreenHandler` | Handler for lock screens. |
|
|
136
|
+
|
|
137
|
+
### SkillViewControllerLoadOptions\<Args\>
|
|
138
|
+
|
|
139
|
+
Passed to `load()` when a skill view appears:
|
|
140
|
+
|
|
141
|
+
| Property | Type | Description |
|
|
142
|
+
|---|---|---|
|
|
143
|
+
| `router` | `Router` | Navigate between skill views. |
|
|
144
|
+
| `authenticator` | `Authenticator` | Access the logged-in person. |
|
|
145
|
+
| `authorizer` | `Authorizer` | Check permissions. |
|
|
146
|
+
| `scope` | `Scope` | Access the current organization or location. |
|
|
147
|
+
| `locale` | `Locale` | Locale and timezone information. |
|
|
148
|
+
| `themes` | `ThemeManager` | Manage the current theme. |
|
|
149
|
+
| `dependencyLoader` | `DependencyLoader` | Load trusted dependencies (e.g., `'@zoom/videosdk'`). |
|
|
150
|
+
| `args` | `Args` | Arguments passed via `router.redirect()`. |
|
|
151
|
+
|
|
152
|
+
### ScopeFlag
|
|
153
|
+
|
|
154
|
+
```ts
|
|
155
|
+
type ScopeFlag = 'location' | 'organization' | 'employed' | 'none'
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Router
|
|
159
|
+
|
|
160
|
+
| Method | Description |
|
|
161
|
+
|---|---|
|
|
162
|
+
| `redirect(id, args?, options?)` | Navigate to a skill view. |
|
|
163
|
+
| `back()` | Navigate to the previous skill view. |
|
|
164
|
+
| `getNamespace?()` | Get the current namespace (optional). |
|
|
165
|
+
|
|
166
|
+
### Authenticator
|
|
167
|
+
|
|
168
|
+
| Method | Description |
|
|
169
|
+
|---|---|
|
|
170
|
+
| `getPerson()` | Get the logged-in person (or `null`). |
|
|
171
|
+
| `isLoggedIn()` | Check if a person is logged in. |
|
|
172
|
+
| `getSessionToken()` | Get the current session token. |
|
|
173
|
+
| `setSessionToken(token, person)` | Set the session. |
|
|
174
|
+
| `clearSession()` | Log out. |
|
|
175
|
+
| `addEventListener(eventName, cb)` | Listen for login/logout events. |
|
|
176
|
+
|
|
177
|
+
### Scope
|
|
178
|
+
|
|
179
|
+
| Method | Description |
|
|
180
|
+
|---|---|
|
|
181
|
+
| `getCurrentOrganization()` | Get the current organization. |
|
|
182
|
+
| `setCurrentOrganization(id)` | Set the current organization. |
|
|
183
|
+
| `getCurrentLocation()` | Get the current location. |
|
|
184
|
+
| `setCurrentLocation(id)` | Set the current location. |
|
|
185
|
+
| `clearSession()` | Clear the current scope. |
|
|
186
|
+
|
|
187
|
+
### Device
|
|
188
|
+
|
|
189
|
+
| Method | Description |
|
|
190
|
+
|---|---|
|
|
191
|
+
| `openUrl(url)` | Open a URL. |
|
|
192
|
+
| `vibrate()` | Vibrate the device. |
|
|
193
|
+
| `call(phoneNumber)` | Initiate a phone call. |
|
|
194
|
+
| `setCachedValue(key, value)` | Store a cached value. |
|
|
195
|
+
| `getCachedValue(key)` | Retrieve a cached value. |
|
|
196
|
+
| `sendCommand(command, payload?)` | Send a command to the device. |
|
|
197
|
+
| `turnTorchOn(brightness?)` | Turn on the torch. |
|
|
198
|
+
| `turnTorchOff()` | Turn off the torch. |
|
|
199
|
+
| `submitFeedback(options)` | Submit user feedback. |
|
|
200
|
+
| `setTheatreSetting(name, value)` | Set a theatre setting. |
|
|
201
|
+
| `getTheatreSetting(name)` | Get a theatre setting. |
|
|
202
|
+
| `AudioController(url)` | Create an audio controller. |
|
|
203
|
+
| `setPowerBehavior(options)` | Configure power behavior (e.g., keep screen awake). |
|
|
204
|
+
|
|
205
|
+
## Layout Styles
|
|
206
|
+
|
|
207
|
+
Use `buildSkillViewLayout(style, cards)` to create typed layouts:
|
|
208
|
+
|
|
209
|
+
| Style | Required Cards | Optional Cards |
|
|
210
|
+
|---|---|---|
|
|
211
|
+
| `'one-col'` | `cards` | `headerCard` |
|
|
212
|
+
| `'two-col'` | `cards` | `headerCard` |
|
|
213
|
+
| `'three-col'` | `cards` | `headerCard` |
|
|
214
|
+
| `'big-left'` | `leftCards` | `rightCards`, `headerCard` |
|
|
215
|
+
| `'big-right'` | `rightCards` | `leftCards`, `headerCard` |
|
|
216
|
+
| `'big-top'` | `topCards` | `bottomCards`, `headerCard` |
|
|
217
|
+
| `'big-top-left'` | `leftCards` | `rightCards`, `bottomCards`, `headerCard` |
|
|
218
|
+
| `'grid'` | `cards` | `headerCard` |
|
|
219
|
+
|
|
220
|
+
## Builders
|
|
221
|
+
|
|
222
|
+
| Builder | Description |
|
|
223
|
+
|---|---|
|
|
224
|
+
| `buildForm(options)` | Type-safe form builder. |
|
|
225
|
+
| `buildBigForm(options)` | Type-safe multi-slide form builder. |
|
|
226
|
+
| `buildActiveRecordCard(options)` | Active record card builder. |
|
|
227
|
+
| `buildActiveRecordList(options)` | Active record list builder. |
|
|
228
|
+
| `buildSkillViewLayout(style, cards)` | Type-safe layout builder. |
|
|
229
|
+
|
|
230
|
+
## Test Utilities
|
|
231
|
+
|
|
232
|
+
### vcAssert
|
|
233
|
+
|
|
234
|
+
Primary assertion library for skill views, cards, dialogs, confirms, alerts, redirects, scope, login, and more.
|
|
235
|
+
|
|
236
|
+
| Method | Description |
|
|
237
|
+
|---|---|
|
|
238
|
+
| `attachTriggerRenderCounter(vc)` | Attach a counter to track `triggerRender()` calls on a controller. |
|
|
239
|
+
| `assertTriggerRenderCount(vc, expected)` | Assert `triggerRender()` was called exactly `expected` times. |
|
|
240
|
+
| `assertRendersConfirm(vc, action)` | Assert action triggers a confirm dialog. Returns confirm vc with `accept()` and `decline()`. |
|
|
241
|
+
| `assertDoesNotRenderConfirm(vc, action)` | Assert action does not trigger a confirm dialog. |
|
|
242
|
+
| `assertRendersDialog(vc, action, dialogHandler?)` | Assert action renders a dialog. Returns `DialogViewController`. |
|
|
243
|
+
| `assertDoesNotRenderDialog(vc, action)` | Assert action does not render a dialog. |
|
|
244
|
+
| `assertRendersAlert(vc, action, style?)` | Assert action renders an alert dialog. Default style is `'error'`. |
|
|
245
|
+
| `assertDoesNotRenderAlert(vc, action, style?)` | Assert action does not render an alert dialog. |
|
|
246
|
+
| `assertRendersSuccessAlert(vc, action)` | Assert action renders a success alert (shorthand for `assertRendersAlert` with `'success'`). |
|
|
247
|
+
| `assertAsksForAVote(vc, action)` | Assert action triggers `askForAVote()`. Returns vote vc with `castVote()`. |
|
|
248
|
+
| `assertCardRendersSection(vc, sectionIdOrIdx)` | Assert card renders a body section by id or index. |
|
|
249
|
+
| `assertCardDoesNotRenderSection(vc, sectionIdOrIdx)` | Assert card does not render a body section. |
|
|
250
|
+
| `assertCardDoesNotRenderList(vc, id?)` | Assert card does not render a list. |
|
|
251
|
+
| `assertDialogWasClosed(vc)` | Assert a dialog is no longer visible. |
|
|
252
|
+
| `assertRendersValidCard(vc)` | Validate a card's view model against the card schema. |
|
|
253
|
+
| `assertCardRendersHeader(cardVc)` | Assert card renders a header. |
|
|
254
|
+
| `assertCardRendersFooter(cardVc)` | Assert card renders a footer. |
|
|
255
|
+
| `assertCardDoesNotRenderFooter(cardVc)` | Assert card does not render a footer. |
|
|
256
|
+
| `assertSkillViewRendersCards(vc, expected?)` | Assert skill view renders cards. `expected` can be a number or `string[]` of ids. |
|
|
257
|
+
| `assertSkillViewDoesNotRenderCards(vc, expected?)` | Assert skill view does not render cards with the given ids. |
|
|
258
|
+
| `assertSkillViewRendersCard(vc, id?)` | Assert skill view renders a card, optionally by id. Returns `CardViewController`. |
|
|
259
|
+
| `assertSkillViewDoesNotRenderCard(vc, id)` | Assert skill view does not render a card with the given id. |
|
|
260
|
+
| `assertSkillViewRendersSwipeCard(vc)` | Assert skill view renders a swipe card. Returns `SwipeCardViewController`. |
|
|
261
|
+
| `assertIsSwipeCard(vc)` | Assert a card view controller is a swipe card. |
|
|
262
|
+
| `assertCardIsBusy(vc)` | Assert card body is busy (`isBusy: true`). |
|
|
263
|
+
| `assertCardIsNotBusy(vc)` | Assert card body is not busy. |
|
|
264
|
+
| `assertSkillViewRendersViewController(vc, VcClass)` | Assert skill view renders a controller that is an instance of `VcClass`. |
|
|
265
|
+
| `assertSkillViewDoesNotRenderViewController(vc, VcClass)` | Assert skill view does not render a controller of that class. |
|
|
266
|
+
| `assertSkillViewRendersCalendar(svc)` | Assert skill view renders a calendar. Returns `CalendarViewController`. |
|
|
267
|
+
| `assertSkillViewDoesNotRenderCalendar(svc)` | Assert skill view does not render a calendar. |
|
|
268
|
+
| `assertCardRendersCalendar(vc)` | Assert card renders a calendar. Returns `CalendarViewController`. |
|
|
269
|
+
| `assertCardDoesNotRenderCalendar(vc)` | Assert card does not render a calendar. |
|
|
270
|
+
| `assertCardRendersTalkingSprucebot(vc, id?)` | Assert card renders a talking Sprucebot. Returns `TalkingSprucebotViewController`. |
|
|
271
|
+
| `assertCardDoesNotRenderTalkingSprucebot(vc, id?)` | Assert card does not render a talking Sprucebot. |
|
|
272
|
+
| `assertIsFullScreen(vc)` | Assert skill view is rendered full screen. |
|
|
273
|
+
| `assertIsNotFullScreen(vc)` | Assert skill view is not rendered full screen. |
|
|
274
|
+
| `assertLoginIsRequired(vc)` | Assert skill view requires login (`getIsLoginRequired()` returns `true`). |
|
|
275
|
+
| `assertLoginIsNotRequired(vc)` | Assert skill view does not require login. |
|
|
276
|
+
| `assertActionRedirects(options)` | Assert action triggers a redirect. Options: `{ router, action, destination? }`. |
|
|
277
|
+
| `assertActionDoesNotRedirect(options)` | Assert action does not trigger a redirect. |
|
|
278
|
+
| `assertRendersAlertThenRedirects(options)` | Assert action renders an alert, then redirects after dismissal. |
|
|
279
|
+
| `patchAlertToThrow(vc)` | Patch a controller so error alerts cause test failures instead of rendering. |
|
|
280
|
+
| `assertCardRendersProgress(vc, percentComplete?, id?)` | Assert card renders a progress view. Returns `ProgressViewController`. |
|
|
281
|
+
| `assertCardDoesNotRenderProgress(vc, id?)` | Assert card does not render a progress view. |
|
|
282
|
+
| `assertCardRendersStats(vc)` | Assert card renders a stats view. Returns `StatsViewController`. |
|
|
283
|
+
| `assertStatsRendersValue(vc, idx, value)` | Assert a stat renders a specific value at a given index. |
|
|
284
|
+
| `assertCardRendersRatings(vc)` | Assert card renders a ratings view. Returns `RatingsViewController`. |
|
|
285
|
+
| `assertControllerInstanceOf(vc, Class)` | Assert a controller is an instance of `Class`. |
|
|
286
|
+
| `assertRendersAsInstanceOf(vc, Class, errorMessage?)` | Assert a vc renders a controller that is an instance of `Class`. |
|
|
287
|
+
| `assertSkillViewNotScoped(vc)` | Assert skill view has no scope (returns `['none']`). |
|
|
288
|
+
| `assertSkillViewScopedBy(vc, scopedBy)` | Assert skill view is scoped by specific flags (e.g., `'organization'`, `['employed', 'location']`). |
|
|
289
|
+
| `assertCardFooterIsDisabled(vc)` | Assert card footer is disabled. |
|
|
290
|
+
| `assertCardFooterIsEnabled(vc)` | Assert card footer is enabled. |
|
|
291
|
+
| `assertCardFooterIsBusy(vc)` | Assert card footer is busy. |
|
|
292
|
+
| `assertCardFooterIsNotBusy(vc)` | Assert card footer is not busy. |
|
|
293
|
+
| `assertCardRendersCriticalError(vc)` | Assert card renders a critical error. Returns the critical error model. |
|
|
294
|
+
| `assertCardDoesNotRenderCriticalError(vc)` | Assert card does not render a critical error. |
|
|
295
|
+
|
|
296
|
+
### buttonAssert
|
|
297
|
+
|
|
298
|
+
Assert button rendering, state, and selection in cards, sections, and footers.
|
|
299
|
+
|
|
300
|
+
| Method | Description |
|
|
301
|
+
|---|---|
|
|
302
|
+
| `buttonBarRendersButton(buttonBarVc, buttonId)` | Assert a button bar renders a button with the given id. |
|
|
303
|
+
| `lastButtonInCardFooterIsPrimaryIfThereAreAnyButtons(vc)` | Assert the primary button is last in the card footer. |
|
|
304
|
+
| `cardRendersButtonBar(cardVc)` | Assert card renders a button bar. Returns `ButtonBarViewController`. |
|
|
305
|
+
| `cardRendersButtonGroup(cardVc)` | Assert card renders a button group. Returns `ButtonGroupViewController`. |
|
|
306
|
+
| `buttonGroupIsMultiSelect(buttonGroupVc)` | Assert a button group allows multi-select. |
|
|
307
|
+
| `cardSectionRendersButton(vc, sectionIdOrIdx, buttonId?)` | Assert a card section renders a button, optionally by id. |
|
|
308
|
+
| `footerRendersButtonWithType(vc, type?)` | Assert footer renders a button with the given type (e.g., `'primary'`, `'secondary'`). |
|
|
309
|
+
| `cardDoesNotRenderButtons(vc, ids)` | Assert card does not render buttons with the given ids. |
|
|
310
|
+
| `cardDoesNotRenderButton(vc, id)` | Assert card does not render a button with the given id. |
|
|
311
|
+
| `cardRendersButtons(vc, ids)` | Assert card renders buttons with the given ids. Returns `ButtonViewController[]`. |
|
|
312
|
+
| `cardRendersButton(vc, id)` | Assert card renders a button with the given id. Returns `ButtonViewController`. |
|
|
313
|
+
| `buttonIsDisabled(vc, id)` | Assert a button is disabled (`isEnabled: false`). |
|
|
314
|
+
| `buttonIsEnabled(vc, id)` | Assert a button is enabled. |
|
|
315
|
+
| `buttonIsSelected(vc, id)` | Assert a button is selected (`isSelected: true`). |
|
|
316
|
+
|
|
317
|
+
### listAssert
|
|
318
|
+
|
|
319
|
+
Assert row rendering, inputs, toggles, selection, and content in lists.
|
|
320
|
+
|
|
321
|
+
| Method | Description |
|
|
322
|
+
|---|---|
|
|
323
|
+
| `listRendersRows(listVc, expectedRows?)` | Assert list renders rows. `expectedRows` can be a count or `string[]` of ids. |
|
|
324
|
+
| `listRendersRow(listVc, row)` | Assert list renders a row by id or index. Returns `ListRowViewController`. |
|
|
325
|
+
| `listDoesNotRenderRow(listVc, row)` | Assert list does not render a row. |
|
|
326
|
+
| `cardRendersList(vc, id?)` | Assert card renders a list. Returns `ListViewController`. |
|
|
327
|
+
| `cardDoesNotRenderList(vc, id?)` | Assert card does not render a list. |
|
|
328
|
+
| `skillViewRendersSwipeCard(vc)` | Assert skill view renders a swipe card. Returns `SwipeCardViewController`. |
|
|
329
|
+
| `rowRendersCheckBox(listVc, row, name?)` | Assert row renders a checkbox, optionally by name. |
|
|
330
|
+
| `rowDoesNotRenderCheckbox(listVc, row, name?)` | Assert row does not render a checkbox. |
|
|
331
|
+
| `rowRendersStatusIndicator(listVc, row, expectedStatus?)` | Assert row renders a status indicator, optionally checking status. |
|
|
332
|
+
| `rowRendersCalendar(listVc, row)` | Assert row renders a calendar (month view). |
|
|
333
|
+
| `rowRendersButtonBar(listVc, row)` | Assert row renders a button bar. Returns `ButtonBarViewController`. |
|
|
334
|
+
| `rowRendersCell(listVc, row, cell)` | Assert row renders a cell by id or index. |
|
|
335
|
+
| `rowDoesNotRenderCell(listVc, row, cell)` | Assert row does not render a cell. |
|
|
336
|
+
| `rowRendersButton(listVc, row, buttonId?)` | Assert row renders a button, optionally by id. |
|
|
337
|
+
| `rowDoesNotRenderButton(listVc, row, buttonId?)` | Assert row does not render a button. |
|
|
338
|
+
| `rowRendersButtonWithIcon(vc, icon)` | Assert a row renders a button with the given `lineIcon`. |
|
|
339
|
+
| `buttonInRowIsDisabled(listVc, row, buttonId)` | Assert a button in a row is disabled. |
|
|
340
|
+
| `buttonInRowIsEnabled(listVc, row, buttonId)` | Assert a button in a row is enabled. |
|
|
341
|
+
| `rowRendersInput(vc, row, inputName)` | Assert row renders an input by name. |
|
|
342
|
+
| `rowDoesNotRenderInput(vc, row, inputName)` | Assert row does not render an input. |
|
|
343
|
+
| `inputIsInteractive(vc, row, inputName)` | Assert an input in a row is interactive. |
|
|
344
|
+
| `inputIsNotInteractive(vc, row, inputName)` | Assert an input in a row is not interactive. |
|
|
345
|
+
| `rowRendersContent(vc, row, content)` | Assert row renders text content (searches text, subText, html, markdown, button labels). |
|
|
346
|
+
| `rowDoesNotRenderContent(vc, row, content)` | Assert row does not render text content. |
|
|
347
|
+
| `rowRendersToggle(listVc, row, toggleName?)` | Assert row renders a toggle input, optionally by name. |
|
|
348
|
+
| `rowDoesNotRenderToggle(listVc, row, toggleName?)` | Assert row does not render a toggle. |
|
|
349
|
+
| `rowRendersSelect(listVc, row, name?)` | Assert row renders a select input. Returns `SelectViewController`. |
|
|
350
|
+
| `rowRendersRatings(listVc, row)` | Assert row renders a ratings input. |
|
|
351
|
+
| `rowIsSelected(listVc, row)` | Assert a row is selected. |
|
|
352
|
+
| `rowIsNotSelected(listVc, row)` | Assert a row is not selected. |
|
|
353
|
+
| `rowsAreSelected(listVc, rows)` | Assert multiple rows are selected. |
|
|
354
|
+
| `rowIsEnabled(listVc, row)` | Assert a row is enabled. |
|
|
355
|
+
| `rowIsDisabled(listVc, row)` | Assert a row is disabled. |
|
|
356
|
+
| `checkboxTogglesRowEnabled(listVc, row)` | Assert clicking a checkbox toggles the row's enabled state. |
|
|
357
|
+
| `rowIsStyle(vc, row, style)` | Assert a row has a specific style (e.g., `'standard'`). |
|
|
358
|
+
| `valueEquals({ listVc, row, name, value })` | Assert an input value in a row equals expected. |
|
|
359
|
+
| `valueDoesNotEqual({ listVc, row, name, value })` | Assert an input value in a row does not equal expected. |
|
|
360
|
+
|
|
361
|
+
### formAssert
|
|
362
|
+
|
|
363
|
+
Assert form fields, sections, validation state, and rendering.
|
|
364
|
+
|
|
365
|
+
| Method | Description |
|
|
366
|
+
|---|---|
|
|
367
|
+
| `inputVcIsValid(inputVc)` | Validate a custom `FormInputViewController` implements `getValue`, `setValue`, `setHandlers`, `getRenderedValue`, and `setRenderedValue`. |
|
|
368
|
+
| `formRendersSection(formVc, sectionId)` | Assert form renders a section by id. |
|
|
369
|
+
| `formDoesNotRendersSection(formVc, sectionId)` | Assert form does not render a section. |
|
|
370
|
+
| `formRendersField(formVc, fieldName, fieldDefinition?)` | Assert form renders a field, optionally matching a partial field definition. |
|
|
371
|
+
| `formDoesNotRenderField(formVc, fieldName)` | Assert form does not render a field. |
|
|
372
|
+
| `formRendersFields(formVc, fields)` | Assert form renders multiple fields by name. |
|
|
373
|
+
| `formIsDisabled(vc)` | Assert form is disabled. |
|
|
374
|
+
| `formIsEnabled(vc)` | Assert form is enabled. |
|
|
375
|
+
| `formIsBusy(vc)` | Assert form is busy. |
|
|
376
|
+
| `formIsNotBusy(vc)` | Assert form is not busy. |
|
|
377
|
+
| `cardRendersForm(vc, id?, errorMessage?)` | Assert card renders a form (or big form). Returns `FormViewController` or `BigFormViewController`. |
|
|
378
|
+
| `cardRendersForms(vc, count)` | Assert card renders a specific number of forms. |
|
|
379
|
+
| `cardDoesNotRenderForm(vc, id)` | Assert card does not render a form with the given id. |
|
|
380
|
+
| `formFieldRendersUsingInputVc(vc, fieldName, inputVc)` | Assert a form field renders using a specific custom input vc instance. |
|
|
381
|
+
| `fieldRendersUsingInstanceOf(vc, fieldName, Class)` | Assert a form field renders using an instance of a given class. |
|
|
382
|
+
| `skillViewRendersFormBuilder(vc, id?)` | Assert skill view renders a form builder card. Returns `FormBuilderCardViewController`. |
|
|
383
|
+
| `formFieldRendersAs(vc, fieldName, expected)` | Assert a form field renders as a specific component type (e.g., `'textarea'`). |
|
|
384
|
+
| `fieldRendersInputButton(vc, fieldName, id?)` | Assert a form field renders a right-side input button. Returns the button model. |
|
|
385
|
+
|
|
386
|
+
### navigationAssert
|
|
387
|
+
|
|
388
|
+
Assert navigation buttons, redirects, permissions, and visibility.
|
|
389
|
+
|
|
390
|
+
| Method | Description |
|
|
391
|
+
|---|---|
|
|
392
|
+
| `rendersButton(vc, id)` | Assert navigation renders a button with the given id. |
|
|
393
|
+
| `rendersButtons(vc, ids)` | Assert navigation renders multiple buttons. |
|
|
394
|
+
| `doesNotRenderButton(vc, id)` | Assert navigation does not render a button. |
|
|
395
|
+
| `buttonRedirectsTo({ vc, button, destination })` | Assert a navigation button redirects to a destination (`{ id, args? }`). |
|
|
396
|
+
| `rendersButtonLabels(vc)` | Assert navigation renders button labels (`shouldRenderButtonLabels: true`). |
|
|
397
|
+
| `skillViewRendersNavigation(vc, msg?)` | Assert skill view renders a navigation. Returns the navigation controller. |
|
|
398
|
+
| `skillViewDoesNotRenderNavigation(vc)` | Assert skill view does not render a navigation. |
|
|
399
|
+
| `appRendersNavigation(vc)` | Assert app controller renders a navigation. Returns the navigation controller. |
|
|
400
|
+
| `appDoesNotRenderNavigation(vc)` | Assert app controller does not render a navigation. |
|
|
401
|
+
| `buttonRequiresViewPermissions(vc, button, permissionContractId)` | Assert a button requires a specific view permission contract. |
|
|
402
|
+
| `hasAdditionalValidRoutes(vc, routes)` | Assert navigation has specific additional valid routes. |
|
|
403
|
+
| `isHidden(vc)` | Assert navigation is hidden. |
|
|
404
|
+
| `isVisible(vc)` | Assert navigation is visible. |
|
|
405
|
+
| `assertActionRefreshesPermissions(vc, action)` | Assert an action triggers a permissions refresh. |
|
|
406
|
+
| `assertActionDoesNotRefreshPermissions(vc, action)` | Assert an action does not trigger a permissions refresh. |
|
|
407
|
+
|
|
408
|
+
### toolBeltAssert
|
|
409
|
+
|
|
410
|
+
Assert tool belt tools, focus, open/close, and sticky tools.
|
|
411
|
+
|
|
412
|
+
| Method | Description |
|
|
413
|
+
|---|---|
|
|
414
|
+
| `rendersToolBelt(svcOrToolBelt, assertHasAtLeast1Tool?)` | Assert vc renders a tool belt. Returns `ToolBeltViewController`. |
|
|
415
|
+
| `doesNotRenderToolBelt(svc)` | Assert vc does not render a tool belt with tools. |
|
|
416
|
+
| `hidesToolBelt(svc)` | Assert tool belt is hidden (`renderToolBelt()` returns `null`). |
|
|
417
|
+
| `toolBeltRendersTool(svcOrToolBelt, toolId)` | Assert tool belt renders a tool with the given id. Returns the tool's card vc. |
|
|
418
|
+
| `toolBeltDoesNotRenderTool(svc, toolId)` | Assert tool belt does not render a tool. |
|
|
419
|
+
| `toolInstanceOf(svcOrToolBelt, toolId, Class)` | Assert a tool is an instance of `Class`. Returns the tool vc. |
|
|
420
|
+
| `toolBeltStickyToolInstanceOf({ toolBeltVc, position, Class })` | Assert a sticky tool at a position (`'top'` or `'bottom'`) is an instance of `Class`. |
|
|
421
|
+
| `toolBeltDoesNotRenderStickyTools(svcOrToolBelt)` | Assert tool belt does not render sticky tools. |
|
|
422
|
+
| `actionFocusesTool(svcOrToolBelt, toolId, action)` | Assert an action focuses a specific tool. |
|
|
423
|
+
| `actionOpensToolBelt(svcOrToolBelt, action, options?)` | Assert an action opens the tool belt. |
|
|
424
|
+
| `actionDoesNotOpenToolBelt(svcOrToolBelt, action)` | Assert an action does not open the tool belt. |
|
|
425
|
+
| `actionClosesToolBelt(svcOrToolBelt, action)` | Assert an action closes the tool belt. |
|
|
426
|
+
| `actionDoesNotCloseToolBelt(svcOrToolBelt, action)` | Assert an action does not close the tool belt. |
|
|
427
|
+
|
|
428
|
+
### toastAssert
|
|
429
|
+
|
|
430
|
+
Assert toast message rendering and content.
|
|
431
|
+
|
|
432
|
+
| Method | Description |
|
|
433
|
+
|---|---|
|
|
434
|
+
| `rendersToast(cb)` | Assert an action renders a toast message. Returns the toast message. |
|
|
435
|
+
| `doesNotRenderToast(cb)` | Assert an action does not render a toast message. |
|
|
436
|
+
| `toastMatches(action, message)` | Assert a toast matches a partial `ToastMessage` (e.g., `{ headline, classification }`). |
|
|
437
|
+
|
|
438
|
+
### feedAssert
|
|
439
|
+
|
|
440
|
+
Assert feed rendering and scroll mode.
|
|
441
|
+
|
|
442
|
+
| Method | Description |
|
|
443
|
+
|---|---|
|
|
444
|
+
| `cardRendersFeed(vc)` | Assert card renders a feed. Returns `FeedViewController`. |
|
|
445
|
+
| `scrollModeEquals(vc, expected)` | Assert feed scroll mode equals expected value. |
|
|
446
|
+
|
|
447
|
+
### activeRecordCardAssert
|
|
448
|
+
|
|
449
|
+
Assert active record card rendering and paging.
|
|
450
|
+
|
|
451
|
+
| Method | Description |
|
|
452
|
+
|---|---|
|
|
453
|
+
| `rendersAsActiveRecordCard(vc)` | Assert a card vc is an active record card. |
|
|
454
|
+
| `skillViewRendersActiveRecordCard(svc, id?)` | Assert skill view renders an active record card. Returns `ActiveRecordCardViewController`. |
|
|
455
|
+
| `pagingOptionsEqual(vc, expected)` | Assert active record card paging options match expected `ActiveRecordPagingOptions`. |
|
|
456
|
+
|
|
457
|
+
### activeRecordListAssert
|
|
458
|
+
|
|
459
|
+
Assert active record list rendering.
|
|
460
|
+
|
|
461
|
+
| Method | Description |
|
|
462
|
+
|---|---|
|
|
463
|
+
| `cardRendersActiveRecordList(vc, id?)` | Assert card renders an active record list. Returns `ActiveRecordListViewController`. |
|
|
464
|
+
| `cardDoesNotRendersActiveRecordList(vc, id?)` | Assert card does not render an active record list. |
|
|
465
|
+
|
|
466
|
+
### lockScreenAssert
|
|
467
|
+
|
|
468
|
+
Assert lock screen rendering.
|
|
469
|
+
|
|
470
|
+
| Method | Description |
|
|
471
|
+
|---|---|
|
|
472
|
+
| `actionRendersLockScreen(svcOrApp, action)` | Assert an action renders a lock screen. Returns `LockScreenSkillViewController`. |
|
|
473
|
+
| `actionDoesNotRenderLockScreen(svcOrApp, action)` | Assert an action does not render a lock screen. |
|
|
474
|
+
|
|
475
|
+
### deviceAssert
|
|
476
|
+
|
|
477
|
+
Assert device vibration, calls, URLs, and torch state.
|
|
478
|
+
|
|
479
|
+
| Method | Description |
|
|
480
|
+
|---|---|
|
|
481
|
+
| `wasVibrated(vc)` | Assert the device was vibrated. |
|
|
482
|
+
| `wasNotVibrated(vc)` | Assert the device was not vibrated. |
|
|
483
|
+
| `madeCall(vc, number)` | Assert the device made a phone call to the given number. |
|
|
484
|
+
| `openedUrl(vc, url)` | Assert the device opened a URL. |
|
|
485
|
+
| `isTorchOn(vc, expectedBrightness?)` | Assert the torch is on, optionally at a specific brightness. |
|
|
486
|
+
| `isTorchOff(vc)` | Assert the torch is off. |
|
|
487
|
+
|
|
488
|
+
### chartAssert
|
|
489
|
+
|
|
490
|
+
Assert bar chart and line graph rendering and data sets.
|
|
491
|
+
|
|
492
|
+
| Method | Description |
|
|
493
|
+
|---|---|
|
|
494
|
+
| `cardRendersBarChart(cardVc, id?)` | Assert card renders a bar chart. Returns the chart controller. |
|
|
495
|
+
| `cardRendersLineGraph(cardVc, id?)` | Assert card renders a line graph. Returns the chart controller. |
|
|
496
|
+
| `dataSetsEqual(chartVc, dataSets)` | Assert chart data sets match expected `ChartDataSet[]`. |
|
|
497
|
+
|
|
498
|
+
### pagerAssert
|
|
499
|
+
|
|
500
|
+
Assert pager rendering, pages, and state.
|
|
501
|
+
|
|
502
|
+
| Method | Description |
|
|
503
|
+
|---|---|
|
|
504
|
+
| `cardRendersPager(vc, id?)` | Assert card renders a pager. Returns `PagerViewController`. |
|
|
505
|
+
| `cardDoesNotRenderPager(vc, id?)` | Assert card does not render a pager. |
|
|
506
|
+
| `totalPages(vc, expected)` | Assert pager total pages equals expected. |
|
|
507
|
+
| `currentPage(vc, expected)` | Assert pager current page equals expected. |
|
|
508
|
+
| `pagerIsConfigured(vc)` | Assert pager has both `currentPage` and `totalPages` set. |
|
|
509
|
+
| `pagerIsCleared(vc)` | Assert pager is cleared (no `currentPage` or `totalPages`). |
|
|
510
|
+
|
|
511
|
+
### progressNavigatorAssert
|
|
512
|
+
|
|
513
|
+
Assert progress navigator steps and completion.
|
|
514
|
+
|
|
515
|
+
| Method | Description |
|
|
516
|
+
|---|---|
|
|
517
|
+
| `skillViewRendersNavigator(vc)` | Assert skill view renders a progress navigator. Returns the navigator controller. |
|
|
518
|
+
| `skillViewDoesNotRenderNavigator(vc)` | Assert skill view does not render a progress navigator. |
|
|
519
|
+
| `rendersStep(vc, stepId)` | Assert navigator renders a step with the given id. |
|
|
520
|
+
| `rendersSteps(vc, stepIds)` | Assert navigator renders multiple steps. |
|
|
521
|
+
| `currentStep(vc, stepId)` | Assert the current step matches the given id. |
|
|
522
|
+
| `stepIsComplete(vc, stepId)` | Assert a step is marked complete. |
|
|
523
|
+
| `stepIsNotComplete(vc, stepId)` | Assert a step is not marked complete. |
|
|
524
|
+
|
|
525
|
+
### countdownTimerAssert
|
|
526
|
+
|
|
527
|
+
Assert countdown timer rendering and state.
|
|
528
|
+
|
|
529
|
+
| Method | Description |
|
|
530
|
+
|---|---|
|
|
531
|
+
| `cardRendersCountdownTimer(vc)` | Assert card renders a countdown timer. Returns `CountdownTimerViewController`. |
|
|
532
|
+
| `timerStartedWithEndDate(vc, endDateMs)` | Assert timer was started with a specific end date (ms). |
|
|
533
|
+
| `timerIsStopped(vc)` | Assert timer is stopped. |
|
|
534
|
+
| `timerStartedWithEndDateInRangeInclusive(vc, bottomMs, topMs)` | Assert timer end date is within an inclusive range. |
|
|
535
|
+
|
|
536
|
+
### mapAssert
|
|
537
|
+
|
|
538
|
+
Assert map rendering and pins.
|
|
539
|
+
|
|
540
|
+
| Method | Description |
|
|
541
|
+
|---|---|
|
|
542
|
+
| `assertCardRendersMap(vc)` | Assert card renders a map. Returns the map controller. |
|
|
543
|
+
| `assertMapHasPin(vc, pin)` | Assert map has a pin matching a partial `MapPin`. |
|
|
544
|
+
|
|
545
|
+
### webRtcAssert
|
|
546
|
+
|
|
547
|
+
Assert WebRTC player rendering, offers, answers, and cropping.
|
|
548
|
+
|
|
549
|
+
| Method | Description |
|
|
550
|
+
|---|---|
|
|
551
|
+
| `beforeEach(views)` | Set up mock WebRTC controller. **Must be called in `beforeEach` before creating any controllers.** |
|
|
552
|
+
| `cardRendersPlayer(vc, id?)` | Assert card renders a WebRTC player. Returns `WebRtcPlayerViewController`. |
|
|
553
|
+
| `actionCreatesOffer(vc, action, expectedOptions?)` | Assert an action creates a WebRTC offer. Returns the generated offer SDP. |
|
|
554
|
+
| `answerSet(vc, answerSdp?)` | Assert an answer was set on the player, optionally matching a specific SDP. |
|
|
555
|
+
| `croppingIsEnabled(vc)` | Assert cropping is enabled on the player. |
|
|
556
|
+
| `croppingIsDisabled(vc)` | Assert cropping is disabled on the player. |
|
|
557
|
+
| `assertCropEquals(vc, expectedCrop?)` | Assert the crop point matches expected `WebRtcCropPoint`. |
|
|
558
|
+
|
|
559
|
+
### autocompleteAssert
|
|
560
|
+
|
|
561
|
+
Assert autocomplete suggestions visibility.
|
|
562
|
+
|
|
563
|
+
| Method | Description |
|
|
564
|
+
|---|---|
|
|
565
|
+
| `actionShowsSuggestions(vc, action, expectedSuggestionIds?)` | Assert an action shows autocomplete suggestions, optionally matching ids. |
|
|
566
|
+
| `actionHidesSuggestions(vc, action)` | Assert an action hides autocomplete suggestions. |
|
|
567
|
+
| `suggestionsAreShowing(vc, suggestionIds)` | Assert specific suggestions are currently showing. |
|
|
568
|
+
| `suggestionIsShowing(vc, suggestionId)` | Assert a specific suggestion is showing. |
|
|
569
|
+
| `suggestionIsNotShowing(vc, suggestionId)` | Assert a specific suggestion is not showing. |
|
|
570
|
+
|
|
571
|
+
### vcDurationAssert
|
|
572
|
+
|
|
573
|
+
Assert duration utility configuration.
|
|
574
|
+
|
|
575
|
+
| Method | Description |
|
|
576
|
+
|---|---|
|
|
577
|
+
| `beforeEach(views)` | Set up duration assert. **Must be called in `beforeEach`.** Pass `this.views.getFactory()`. |
|
|
578
|
+
| `durationUtilIsConfiguredForVc(vc)` | Assert `durationUtil.dates` is configured to match the vc's dates. |
|
|
579
|
+
|
|
580
|
+
### vcPluginAssert
|
|
581
|
+
|
|
582
|
+
Assert plugin installation.
|
|
583
|
+
|
|
584
|
+
| Method | Description |
|
|
585
|
+
|---|---|
|
|
586
|
+
| `pluginIsInstalled(vc, named, PluginClass?)` | Assert a plugin is installed on a vc by name, optionally checking it's an instance of `PluginClass`. Returns the plugin. |
|
|
587
|
+
|
|
588
|
+
### Trigger Render Counting
|
|
589
|
+
|
|
590
|
+
Track how many times `triggerRender()` is called on a controller:
|
|
591
|
+
|
|
592
|
+
```ts
|
|
593
|
+
vcAssert.attachTriggerRenderCounter(vc)
|
|
594
|
+
// ... perform actions ...
|
|
595
|
+
vcAssert.assertTriggerRenderCount(vc, expectedCount)
|
|
596
|
+
```
|
|
597
|
+
|
|
598
|
+
### interactor
|
|
599
|
+
|
|
600
|
+
Simulate clicks, form submissions, row interactions, navigation, and more.
|
|
601
|
+
|
|
602
|
+
| Method | Description |
|
|
603
|
+
|---|---|
|
|
604
|
+
| `click(button, onClickOptions?)` | Click a button or clickable element. Simulates a full mouse event. |
|
|
605
|
+
| `clickButton(vc, buttonId)` | Click a button by id in a card, form, or navigation. |
|
|
606
|
+
| `clickCard(vc)` | Click a card (requires `onClick` set on the card model). |
|
|
607
|
+
| `clickButtonInGroup(buttonGroupVc, buttonIdOrIdx)` | Click a button in a button group by id or index. |
|
|
608
|
+
| `clickButtonHint(vc, buttonId)` | Click a button's hint icon (`onClickHintIcon`). |
|
|
609
|
+
| `clickButtonInButtonBar(vc, buttonId)` | Click a button in a button bar by id. |
|
|
610
|
+
| `clickInFooterWithType(vc, type)` | Click a footer button by type (e.g., `'primary'`, `'secondary'`, `'destructive'`). |
|
|
611
|
+
| `clickPrimaryInFooter(vc)` | Click the primary button in the footer. |
|
|
612
|
+
| `clickSecondaryInFooter(vc)` | Click the secondary button in the footer. |
|
|
613
|
+
| `clickDestructiveInFooter(vc)` | Click the destructive button in the footer. |
|
|
614
|
+
| `clickInputButton(vc, fieldName, id)` | Click a right-side input button on a form field. |
|
|
615
|
+
| `clickDestructiveInRow(listVc, rowIdxOrId)` | Click the destructive button in a list row. |
|
|
616
|
+
| `cancelForm(vc)` | Cancel a form (triggers `onCancel`). |
|
|
617
|
+
| `submitBigFormSlide(vc)` | Submit the current big form slide (validates the slide first). |
|
|
618
|
+
| `submitForm(vc)` | Submit a form (triggers `onSubmit`). |
|
|
619
|
+
| `clickPagerButton(vc, button)` | Click a pager button: `'previous'`, `'next'`, or a page number. |
|
|
620
|
+
| `submitLoginForm(vc, demoNumber)` | Submit a login form with a demo phone number. |
|
|
621
|
+
| `clickButtonInRow(vc, rowIdxOrId, buttonId)` | Click a button in a list row by button id. |
|
|
622
|
+
| `keyDownOnInputInRow({ vc, key, cell })` | Simulate a key down event on an input in a list row cell. |
|
|
623
|
+
| `clickCheckboxInRow(vc, row, name?)` | Toggle a checkbox in a list row, optionally by name. |
|
|
624
|
+
| `clickToggleInRow(vc, row)` | Toggle a toggle input in a list row. |
|
|
625
|
+
| `selectChoiceInRow({ vc, row, newChoice, name? })` | Select a choice in a list row's select input. |
|
|
626
|
+
| `clickRow(listVc, row)` | Click a list row (triggers `onClick`). |
|
|
627
|
+
| `dragAndDropListRow(listVc, newRowIds)` | Drag and drop to reorder list rows. Pass the new order of row ids. |
|
|
628
|
+
| `clickCell(listVc, rowIdxOrId, cellIdxOrId)` | Click a cell in a list row. |
|
|
629
|
+
| `clickCalendarEvent(vc, eventId, blockIdx?)` | Click a calendar event (delegates to `calendarInteractor`). |
|
|
630
|
+
| `dragCalendarEventTo(vc, eventId, updates)` | Drag and drop a calendar event (delegates to `calendarInteractor`). |
|
|
631
|
+
| `focus(vc)` | Focus a view controller (triggers `willFocus` and `didFocus`). |
|
|
632
|
+
| `hide(vc)` | Hide a view controller (triggers `didHide`). |
|
|
633
|
+
| `blur(vc)` | Blur a view controller (triggers `willBlur` and `didBlur`). |
|
|
634
|
+
| `clickCriticalErrorButton(vc, buttonId)` | Click a button in a card's critical error. |
|
|
635
|
+
| `clickNavButton(vc, buttonId)` | Click a navigation button (works with skill view or navigation vc). |
|
|
636
|
+
|
|
637
|
+
### autocompleteInteractor
|
|
638
|
+
|
|
639
|
+
Click autocomplete suggestions.
|
|
640
|
+
|
|
641
|
+
| Method | Description |
|
|
642
|
+
|---|---|
|
|
643
|
+
| `clickSuggestion(vc, suggestionId)` | Click an autocomplete suggestion by id. Suggestions must be showing. |
|
|
644
|
+
|
|
645
|
+
### calendarInteractor
|
|
646
|
+
|
|
647
|
+
Tap, long press, click events, drag and drop, and swipe on calendars.
|
|
648
|
+
|
|
649
|
+
| Method | Description |
|
|
650
|
+
|---|---|
|
|
651
|
+
| `tapView(vc, options?)` | Tap on a calendar view (triggers `onTapView`). |
|
|
652
|
+
| `longPressThenDrop(vc, options?)` | Long press then drop on a calendar view (triggers `onLongPressViewDrop`). |
|
|
653
|
+
| `clickMonthView(vc, dateTimeMs)` | Click on a month view at a specific date (triggers `onClickView`). |
|
|
654
|
+
| `clickDayView(vc, dateTimeMs, personId?)` | Click on a day view at a specific time, optionally for a person (triggers `onClickView`). |
|
|
655
|
+
| `clickEvent(vc, eventId, blockIdx?)` | Click a calendar event at a specific block index (triggers `onClickEvent`). |
|
|
656
|
+
| `dragAndDropEvent(vc, eventId, updates)` | Drag and drop a calendar event (triggers `onDropEvent`). Returns `boolean`. |
|
|
657
|
+
| `swipe(vc, direction)` | Swipe on a calendar (triggers `onSwipe`). |
|
|
658
|
+
|
|
659
|
+
### countdownTimerInteractor
|
|
660
|
+
|
|
661
|
+
Simulate timer completion.
|
|
662
|
+
|
|
663
|
+
| Method | Description |
|
|
664
|
+
|---|---|
|
|
665
|
+
| `simulateOnComplete(vc)` | Simulate the countdown timer completing (triggers `onComplete`). |
|
|
666
|
+
|
|
667
|
+
### feedInteractor
|
|
668
|
+
|
|
669
|
+
Submit messages to a feed.
|
|
670
|
+
|
|
671
|
+
| Method | Description |
|
|
672
|
+
|---|---|
|
|
673
|
+
| `submitMessage(vc, message)` | Submit a message to a feed (triggers `onSubmitMessage`). Returns `boolean`. |
|
|
674
|
+
|
|
675
|
+
### talkingSprucebotInteractor
|
|
676
|
+
|
|
677
|
+
Simulate Sprucebot animation completion.
|
|
678
|
+
|
|
679
|
+
| Method | Description |
|
|
680
|
+
|---|---|
|
|
681
|
+
| `simulateOnComplete(talkingVc)` | Simulate the talking Sprucebot finishing its animation (triggers `onComplete`). |
|
|
682
|
+
|
|
683
|
+
### webRtcInteractor
|
|
684
|
+
|
|
685
|
+
Simulate crop actions and state changes.
|
|
686
|
+
|
|
687
|
+
| Method | Description |
|
|
688
|
+
|---|---|
|
|
689
|
+
| `simulateCrop(vc, cropPoint?)` | Simulate a crop action on a WebRTC player (triggers `onCrop`). |
|
|
690
|
+
| `simulateStateChange(vc, state, event?)` | Simulate a WebRTC connection state change (triggers `onStateChange`). Requires `MockRtcPeerConnection` setup. |
|
|
691
|
+
|
|
692
|
+
### mapInteractor
|
|
693
|
+
|
|
694
|
+
Click buttons on map pins.
|
|
695
|
+
|
|
696
|
+
| Method | Description |
|
|
697
|
+
|---|---|
|
|
698
|
+
| `clickButtonOnPin(vc, pinIdx, buttonId)` | Click a button on a map pin by pin index and button id or index. |
|
|
699
|
+
|
|
700
|
+
### Test Support
|
|
701
|
+
|
|
702
|
+
| Export | Description |
|
|
703
|
+
|---|---|
|
|
704
|
+
| `MockActiveRecordCard` | Mock for active record cards. |
|
|
705
|
+
| `MockAudioController` | Mock for audio playback. |
|
|
706
|
+
| `MockRtcPeerConnection` | Mock for WebRTC connections. |
|
|
707
|
+
| `SpyDevice` | Spy on device interactions. |
|
|
708
|
+
| `FakeStorage` | In-memory storage for tests. |
|
|
709
|
+
| `StubStorage` | Stub storage for tests. |
|
|
710
|
+
| `SpyViewControllerExporter` | Spy on view controller exports. |
|
|
711
|
+
|
|
712
|
+
## Constants
|
|
713
|
+
|
|
714
|
+
| Export | Description |
|
|
715
|
+
|---|---|
|
|
716
|
+
| `fancyIcons` | Array of 400+ fancy icon names. |
|
|
717
|
+
| `lineIcons` | Array of line icon names (from `@sprucelabs/calendar-utils`). |
|
|
718
|
+
| `defaultSubmitButtonLabel` | `'Go!'` |
|
|
719
|
+
| `defaultCancelButtonLabel` | `'Cancel'` |
|
|
720
|
+
| `formBuilderFieldTypes` | Map of field types to labels for the form builder. |
|
|
721
|
+
| `fieldTypeChoices` | `SelectChoice[]` for the form builder. |
|
package/package.json
CHANGED