@sprucelabs/heartwood-polish 7.1.34 → 7.1.36

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.
@@ -18,7 +18,7 @@ export type AssertHandlerOptions<Options extends Record<string, any>> = {
18
18
  page: Page;
19
19
  originalTarget: PolishTarget;
20
20
  targetSelector: string;
21
- getProperty: (selector: string, property: string) => Promise<string>;
21
+ getProperty: (selector: string, property: string) => Promise<string | undefined>;
22
22
  getInnerHtml: (selector: string) => Promise<string>;
23
23
  } & Options;
24
24
  export type AssertionHandler<Options extends Record<string, any>> = (options: AssertHandlerOptions<Options>) => void | Promise<void>;
@@ -10,7 +10,7 @@ function doesTargetIncludeField(target) {
10
10
  target.some((item) => Array.isArray(item) ? item[0] === 'Field' : item === 'Field'));
11
11
  }
12
12
  async function assertInputValue(options) {
13
- const { targetSelector, originalTarget, equals, getProperty } = options;
13
+ const { targetSelector, originalTarget, equals: expected, getProperty, } = options;
14
14
  if (!doesTargetIncludeField(originalTarget)) {
15
15
  throw new SpruceError_1.default({
16
16
  code: 'INVALID_TARGET',
@@ -21,13 +21,14 @@ async function assertInputValue(options) {
21
21
  const selector = targetSelector.includes('name=')
22
22
  ? targetSelector
23
23
  : `${targetSelector} input[value]`;
24
- const actual = await getProperty(selector, 'value');
25
- const expected = equals;
26
- //@ts-ignore
24
+ let actual = await getProperty(selector, 'value');
25
+ if (actual === '') {
26
+ actual = undefined;
27
+ }
27
28
  if (actual !== expected) {
28
29
  throw new SpruceError_1.default({
29
30
  code: 'ASSERTION_FAILED',
30
- friendlyMessage: `I expected to find the value '${expected}', but found '${actual}'. I was looking for ${selector}.`,
31
+ friendlyMessage: `I expected to find the value ${JSON.stringify(expected)}, but found ${actual === undefined ? 'it undefined. Assert against undefined to match' : JSON.stringify(actual)}. I was looking for ${selector}.`,
31
32
  });
32
33
  }
33
34
  }
@@ -12,7 +12,7 @@ class TargetSelectorGenerator {
12
12
  Toggle: 'button.toggle',
13
13
  Card: '.card',
14
14
  Calendar: '.bigcalendar',
15
- Dialog: '.dialog ',
15
+ Dialog: '.dialog:last-of-type ',
16
16
  Field: '',
17
17
  ListRow: '.list__row',
18
18
  NavLink: '.dropdown button',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sprucelabs/heartwood-polish",
3
- "version": "7.1.34",
3
+ "version": "7.1.36",
4
4
  "main": "build/index.js",
5
5
  "license": "MIT",
6
6
  "access": "public",