@ebertjendustries/cstestwrapper 1.0.29 → 1.0.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.
package/dist/index.d.mts CHANGED
@@ -194,9 +194,11 @@ declare class HeaderTesting extends AbstractComponentTesting<HeaderWrapper, Fiel
194
194
  constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
195
195
  expectCounterLocalisation(variables?: any): void;
196
196
  expectCounter(counterText: string | RegExp): void;
197
- expectContent(content: string | RegExp): void;
197
+ expectContent(content: string | RegExp, message?: string): void;
198
198
  expectNotContent(content: string | RegExp): void;
199
199
  expectLocalisation(variables?: any, alternateNs?: LocalisationNamespace): void;
200
+ expectNotToBeDirty(): void;
201
+ expectToBeDirty(): void;
200
202
  }
201
203
 
202
204
  declare class BoxTesting extends AbstractComponentTesting<BoxWrapper, FieldSpec> {
package/dist/index.d.ts CHANGED
@@ -194,9 +194,11 @@ declare class HeaderTesting extends AbstractComponentTesting<HeaderWrapper, Fiel
194
194
  constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
195
195
  expectCounterLocalisation(variables?: any): void;
196
196
  expectCounter(counterText: string | RegExp): void;
197
- expectContent(content: string | RegExp): void;
197
+ expectContent(content: string | RegExp, message?: string): void;
198
198
  expectNotContent(content: string | RegExp): void;
199
199
  expectLocalisation(variables?: any, alternateNs?: LocalisationNamespace): void;
200
+ expectNotToBeDirty(): void;
201
+ expectToBeDirty(): void;
200
202
  }
201
203
 
202
204
  declare class BoxTesting extends AbstractComponentTesting<BoxWrapper, FieldSpec> {
package/dist/index.js CHANGED
@@ -377,7 +377,7 @@ var AbstractSelectTesting = class extends AbstractComponentTesting {
377
377
  async openDropdown() {
378
378
  const selectWrapper = this.getElementWrapper();
379
379
  (0, import_react5.act)(() => selectWrapper.openDropdown());
380
- await (0, import_react4.waitFor)(() => (0, import_vitest3.expect)(this.getDropdown(selectWrapper).findOptions().length, this.msgForExpect(void 0, "openDropdown - wait till options are present")).toBeGreaterThan(0));
380
+ await (0, import_react4.waitFor)(() => (0, import_vitest3.expect)(this.getDropdown(selectWrapper).findOptions().length, this.msgForExpect(void 0, "openDropdown - wait till options are present (IF FAILS - Ensure expandToViewPort is set to true in select() method!!!!!!)")).toBeGreaterThan(0));
381
381
  return selectWrapper;
382
382
  }
383
383
  async closeDropdown(selectWrapper) {
@@ -410,7 +410,7 @@ var AbstractSelectTesting = class extends AbstractComponentTesting {
410
410
  };
411
411
 
412
412
  // src/views/AbstractViewTesting.tsx
413
- var import_cswrapper6 = require("@ebertjendustries/cswrapper");
413
+ var import_cswrapper7 = require("@ebertjendustries/cswrapper");
414
414
 
415
415
  // src/components/MultiselectTesting.ts
416
416
  var import_dom2 = __toESM(require("@cloudscape-design/components/test-utils/dom"));
@@ -823,6 +823,7 @@ var CheckboxTesting = class extends AbstractComponentTesting {
823
823
 
824
824
  // src/components/HeaderTesting.ts
825
825
  var import_dom12 = __toESM(require("@cloudscape-design/components/test-utils/dom"));
826
+ var import_cswrapper6 = require("@ebertjendustries/cswrapper");
826
827
  var import_vitest11 = require("vitest");
827
828
  var HeaderTesting = class extends AbstractComponentTesting {
828
829
  constructor(fieldSpec, view) {
@@ -836,8 +837,8 @@ var HeaderTesting = class extends AbstractComponentTesting {
836
837
  expectCounter(counterText) {
837
838
  (0, import_vitest11.expect)(this.getElementWrapper().findCounter().getElement()).toHaveTextContent(counterText);
838
839
  }
839
- expectContent(content) {
840
- (0, import_vitest11.expect)(this.getElementWrapper().findHeadingText().getElement()).toHaveTextContent(content);
840
+ expectContent(content, message) {
841
+ (0, import_vitest11.expect)(this.getElementWrapper().findHeadingText().getElement(), message).toHaveTextContent(content);
841
842
  }
842
843
  expectNotContent(content) {
843
844
  (0, import_vitest11.expect)(this.getElementWrapper().findHeadingText().getElement()).not.toHaveTextContent(content);
@@ -845,6 +846,14 @@ var HeaderTesting = class extends AbstractComponentTesting {
845
846
  expectLocalisation(variables, alternateNs) {
846
847
  this.expectContent(this.getLocalisedField(variables, alternateNs).children.trim());
847
848
  }
849
+ expectNotToBeDirty() {
850
+ this.expectPresent();
851
+ this.expectNotContent(new RegExp(`.+\\${import_cswrapper6.DIRTY_MARKER}`));
852
+ }
853
+ expectToBeDirty() {
854
+ this.expectPresent();
855
+ this.expectContent(new RegExp(`.+\\${import_cswrapper6.DIRTY_MARKER}`));
856
+ }
848
857
  };
849
858
 
850
859
  // src/components/BoxTesting.ts
@@ -1454,7 +1463,7 @@ var AbstractViewTesting = class {
1454
1463
  return this.testLocalisation.getLocaliser(this.namespace);
1455
1464
  }
1456
1465
  fromSpec(componentSpec, testElements) {
1457
- return import_cswrapper6.ViewSpec.create(componentSpec.key, componentSpec.ns, (spec) => testElements(componentSpec.elements, this.factory));
1466
+ return import_cswrapper7.ViewSpec.create(componentSpec.key, componentSpec.ns, (spec) => testElements(componentSpec.elements, this.factory));
1458
1467
  }
1459
1468
  printDOM() {
1460
1469
  const dom = (0, import_react29.prettyDOM)(void 0, 1e7, { highlight: false });
@@ -1485,18 +1494,18 @@ var AbstractViewTesting = class {
1485
1494
  };
1486
1495
 
1487
1496
  // src/views/CSVNoItemsViewTesting.tsx
1488
- var import_cswrapper7 = require("@ebertjendustries/cswrapper");
1497
+ var import_cswrapper8 = require("@ebertjendustries/cswrapper");
1489
1498
  var CSVNoItemsViewTesting = class extends AbstractViewTesting {
1490
1499
  constructor(namespace, viewSpec, entityTypeFactory, testLocalisation) {
1491
1500
  super(namespace, viewSpec, testLocalisation);
1492
1501
  this.entityTypeFactory = entityTypeFactory;
1493
- this.noItemsView = this.fromSpec((0, import_cswrapper7.CSV_NO_ITEMS_VIEW_SPEC)(this.namespace), (elements, factory) => ({
1502
+ this.noItemsView = this.fromSpec((0, import_cswrapper8.CSV_NO_ITEMS_VIEW_SPEC)(this.namespace), (elements, factory) => ({
1494
1503
  boxHeading: factory.box(elements.boxHeading),
1495
1504
  boxBody: factory.box(elements.boxBody)
1496
1505
  }));
1497
1506
  }
1498
1507
  async awaitPresent() {
1499
- await this.waitForView((0, import_cswrapper7.CSV_NO_ITEMS_VIEW_SPEC)(this.namespace));
1508
+ await this.waitForView((0, import_cswrapper8.CSV_NO_ITEMS_VIEW_SPEC)(this.namespace));
1500
1509
  this.expectPresent();
1501
1510
  }
1502
1511
  async awaitNotPresent() {
@@ -1514,21 +1523,21 @@ var CSVNoItemsViewTesting = class extends AbstractViewTesting {
1514
1523
  };
1515
1524
 
1516
1525
  // src/views/CSVPriceInputViewTesting.tsx
1517
- var import_cswrapper8 = require("@ebertjendustries/cswrapper");
1518
1526
  var import_cswrapper9 = require("@ebertjendustries/cswrapper");
1527
+ var import_cswrapper10 = require("@ebertjendustries/cswrapper");
1519
1528
  var CSVPriceInputViewTesting = class extends AbstractViewTesting {
1520
1529
  constructor(namespace, viewSpec, testLocalisation, currencyFactory, expandToViewport) {
1521
1530
  super(namespace, viewSpec, testLocalisation);
1522
1531
  this.currencyFactory = currencyFactory;
1523
1532
  this.expandToViewport = expandToViewport;
1524
- this.csvPriceInputView = this.fromSpec((0, import_cswrapper8.CSV_PRICE_INPUT_VIEW_SPEC)(this.parent, this.viewSpec.key), (elements, factory) => ({
1533
+ this.csvPriceInputView = this.fromSpec((0, import_cswrapper9.CSV_PRICE_INPUT_VIEW_SPEC)(this.parent, this.viewSpec.key), (elements, factory) => ({
1525
1534
  amountInput: factory.numberInput(elements.inputPrice),
1526
1535
  currencyInput: factory.select(elements.selectCurrency, this.expandToViewport),
1527
1536
  displayBox: factory.box(elements.boxPriceDisplay)
1528
1537
  }));
1529
1538
  }
1530
1539
  expectDisplayPrice(price) {
1531
- this.csvPriceInputView.elements.displayBox.expectContent(import_cswrapper9.PriceUtils.getFormattedPrice("en", price));
1540
+ this.csvPriceInputView.elements.displayBox.expectContent(import_cswrapper10.PriceUtils.getFormattedPrice("en", price));
1532
1541
  }
1533
1542
  async setPrice(price) {
1534
1543
  if (isNaN(price.priceInCents)) {
@@ -1551,11 +1560,11 @@ var CSVPriceInputViewTesting = class extends AbstractViewTesting {
1551
1560
  };
1552
1561
 
1553
1562
  // src/views/CSVSearchFilterViewTesting.tsx
1554
- var import_cswrapper10 = require("@ebertjendustries/cswrapper");
1563
+ var import_cswrapper11 = require("@ebertjendustries/cswrapper");
1555
1564
  var CSVSearchFilterViewTesting = class extends AbstractViewTesting {
1556
1565
  constructor(namespace, viewSpec, testLocalisation) {
1557
1566
  super(namespace, viewSpec, testLocalisation);
1558
- this.csvSearchFilterView = this.fromSpec((0, import_cswrapper10.CSV_SEARCH_FILTER_VIEW_SPEC)(this.parent, this.viewSpec.key), (elements, factory) => ({
1567
+ this.csvSearchFilterView = this.fromSpec((0, import_cswrapper11.CSV_SEARCH_FILTER_VIEW_SPEC)(this.parent, this.viewSpec.key), (elements, factory) => ({
1559
1568
  searchTextFilter: factory.stringInput(elements.inputSearch),
1560
1569
  searchButton: factory.button(elements.buttonSearch)
1561
1570
  }));
@@ -1590,11 +1599,11 @@ var CSVSearchFilterViewTesting = class extends AbstractViewTesting {
1590
1599
  };
1591
1600
 
1592
1601
  // src/views/CSVTextPromptModalViewTesting.tsx
1593
- var import_cswrapper11 = require("@ebertjendustries/cswrapper");
1602
+ var import_cswrapper12 = require("@ebertjendustries/cswrapper");
1594
1603
  var CSVTextPromptModalViewTesting = class extends AbstractViewTesting {
1595
1604
  constructor(namespace, viewSpec, testLocalisation) {
1596
1605
  super(namespace, viewSpec, testLocalisation);
1597
- this.csvTextPromptModalView = this.fromSpec((0, import_cswrapper11.CSV_TEXT_PROMPT_MODAL_VIEW_SPEC)(this.parent, this.viewSpec.key), (elements, factory) => ({
1606
+ this.csvTextPromptModalView = this.fromSpec((0, import_cswrapper12.CSV_TEXT_PROMPT_MODAL_VIEW_SPEC)(this.parent, this.viewSpec.key), (elements, factory) => ({
1598
1607
  headerHeading: factory.header(elements.headerHeading),
1599
1608
  boxBodyText: factory.box(elements.boxBodyText),
1600
1609
  buttonPrimary: factory.button(elements.buttonPrimary),
@@ -1670,11 +1679,11 @@ var MockBrowserAPIs = class {
1670
1679
  // src/mocks/MockRestClient.ts
1671
1680
  var import_vitest27 = require("vitest");
1672
1681
  var import_console = require("console");
1673
- var import_cswrapper12 = require("@ebertjendustries/cswrapper");
1674
1682
  var import_cswrapper13 = require("@ebertjendustries/cswrapper");
1675
- var RealRestClient = __toESM(require("@ebertjendustries/cswrapper"));
1676
1683
  var import_cswrapper14 = require("@ebertjendustries/cswrapper");
1677
- var LOGGER = new import_cswrapper12.Log("RestClientMock");
1684
+ var RealRestClient = __toESM(require("@ebertjendustries/cswrapper"));
1685
+ var import_cswrapper15 = require("@ebertjendustries/cswrapper");
1686
+ var LOGGER = new import_cswrapper13.Log("RestClientMock");
1678
1687
  var MockResponseStore = class {
1679
1688
  constructor(parentUUID) {
1680
1689
  this.parentUUID = parentUUID;
@@ -1787,9 +1796,9 @@ var MockRestClient = class {
1787
1796
  const response = val.response;
1788
1797
  const delayInMilliseconds = val.delay;
1789
1798
  if (delayInMilliseconds !== void 0) {
1790
- await (0, import_cswrapper13.sleep)(delayInMilliseconds);
1799
+ await (0, import_cswrapper14.sleep)(delayInMilliseconds);
1791
1800
  }
1792
- if (response !== null && response !== void 0 && (0, import_cswrapper14.isContentWithMessages)(response)) {
1801
+ if (response !== null && response !== void 0 && (0, import_cswrapper15.isContentWithMessages)(response)) {
1793
1802
  return Promise.reject(response);
1794
1803
  }
1795
1804
  return this.mockImpl(response, endpoint, payload, operation, header);
package/dist/index.mjs CHANGED
@@ -296,7 +296,7 @@ var AbstractSelectTesting = class extends AbstractComponentTesting {
296
296
  async openDropdown() {
297
297
  const selectWrapper = this.getElementWrapper();
298
298
  act2(() => selectWrapper.openDropdown());
299
- await waitFor2(() => expect3(this.getDropdown(selectWrapper).findOptions().length, this.msgForExpect(void 0, "openDropdown - wait till options are present")).toBeGreaterThan(0));
299
+ await waitFor2(() => expect3(this.getDropdown(selectWrapper).findOptions().length, this.msgForExpect(void 0, "openDropdown - wait till options are present (IF FAILS - Ensure expandToViewPort is set to true in select() method!!!!!!)")).toBeGreaterThan(0));
300
300
  return selectWrapper;
301
301
  }
302
302
  async closeDropdown(selectWrapper) {
@@ -742,6 +742,7 @@ var CheckboxTesting = class extends AbstractComponentTesting {
742
742
 
743
743
  // src/components/HeaderTesting.ts
744
744
  import wrapper11 from "@cloudscape-design/components/test-utils/dom";
745
+ import { DIRTY_MARKER } from "@ebertjendustries/cswrapper";
745
746
  import { expect as expect11 } from "vitest";
746
747
  var HeaderTesting = class extends AbstractComponentTesting {
747
748
  constructor(fieldSpec, view) {
@@ -755,8 +756,8 @@ var HeaderTesting = class extends AbstractComponentTesting {
755
756
  expectCounter(counterText) {
756
757
  expect11(this.getElementWrapper().findCounter().getElement()).toHaveTextContent(counterText);
757
758
  }
758
- expectContent(content) {
759
- expect11(this.getElementWrapper().findHeadingText().getElement()).toHaveTextContent(content);
759
+ expectContent(content, message) {
760
+ expect11(this.getElementWrapper().findHeadingText().getElement(), message).toHaveTextContent(content);
760
761
  }
761
762
  expectNotContent(content) {
762
763
  expect11(this.getElementWrapper().findHeadingText().getElement()).not.toHaveTextContent(content);
@@ -764,6 +765,14 @@ var HeaderTesting = class extends AbstractComponentTesting {
764
765
  expectLocalisation(variables, alternateNs) {
765
766
  this.expectContent(this.getLocalisedField(variables, alternateNs).children.trim());
766
767
  }
768
+ expectNotToBeDirty() {
769
+ this.expectPresent();
770
+ this.expectNotContent(new RegExp(`.+\\${DIRTY_MARKER}`));
771
+ }
772
+ expectToBeDirty() {
773
+ this.expectPresent();
774
+ this.expectContent(new RegExp(`.+\\${DIRTY_MARKER}`));
775
+ }
767
776
  };
768
777
 
769
778
  // src/components/BoxTesting.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ebertjendustries/cstestwrapper",
3
- "version": "1.0.29",
3
+ "version": "1.0.30",
4
4
  "main": "dist/index.cjs",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -37,7 +37,7 @@
37
37
  "@cloudscape-design/design-tokens": "^3.0.70",
38
38
  "@cloudscape-design/global-styles": "^1.0.50",
39
39
  "@cloudscape-design/test-utils-core": "^1.0.71",
40
- "@ebertjendustries/cswrapper": "^1.0.29",
40
+ "@ebertjendustries/cswrapper": "^1.0.31",
41
41
  "@smastrom/react-rating": "^1.5.0",
42
42
  "@testing-library/dom": "^10.4.0",
43
43
  "@testing-library/jest-dom": "^6.6.3",