@ebertjendustries/cstestwrapper 1.0.15 → 1.0.16

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
@@ -1,6 +1,6 @@
1
1
  import * as RealRestClient from '@ebertjendustries/cswrapper';
2
2
  import { LocalisationNamespace, Localiser, FieldSpec, EnumFactory, ViewSpec, IViewElementSpec, LocalisationVariableType, CSVNoItemsViewElements, CSVPriceInputViewElements, IPrice, CSVSearchFilterViewElements, CSVTextPromptModalViewElements, PropertyChangeFunction } from '@ebertjendustries/cswrapper';
3
- import { MultiselectWrapper, SelectWrapper, InputWrapper, DatePickerWrapper, TableWrapper, WizardWrapper, ButtonWrapper, ButtonDropdownWrapper, ModalWrapper, CheckboxWrapper, HeaderWrapper, BoxWrapper, CollectionPreferencesWrapper, LinkWrapper, ToggleWrapper, FlashbarWrapper, SegmentedControlWrapper, AlertWrapper, StatusIndicatorWrapper, CardsWrapper, TextareaWrapper, TabsWrapper, TextFilterWrapper, TextContentWrapper, PaginationWrapper, FormWrapper, ProgressBarWrapper, IconWrapper, ElementWrapper as ElementWrapper$1, FormFieldWrapper } from '@cloudscape-design/components/test-utils/dom';
3
+ import { MultiselectWrapper, SelectWrapper, InputWrapper, DatePickerWrapper, TableWrapper, WizardWrapper, ButtonWrapper, ButtonDropdownWrapper, ModalWrapper, CheckboxWrapper, HeaderWrapper, BoxWrapper, CollectionPreferencesWrapper, LinkWrapper, ToggleWrapper, FlashbarWrapper, SegmentedControlWrapper, AlertWrapper, StatusIndicatorWrapper, CardsWrapper, TextareaWrapper, TabsWrapper, TextFilterWrapper, TextContentWrapper, PaginationWrapper, FormWrapper, ProgressBarWrapper, IconWrapper, ElementWrapper as ElementWrapper$1, FormFieldWrapper, CopyToClipboardWrapper } from '@cloudscape-design/components/test-utils/dom';
4
4
  import { ElementWrapper, ComponentWrapper } from '@cloudscape-design/test-utils-core/dom';
5
5
  import DropdownHostComponentWrapper from '@cloudscape-design/components/test-utils/dom/internal/dropdown-host';
6
6
  import * as vitest from 'vitest';
@@ -499,6 +499,13 @@ declare class CSVTextPromptModalViewTesting extends AbstractViewTesting<CSVTextP
499
499
  expectVisibleAfterOpsThenDismiss(operations: (() => void)[], navigatingAway?: boolean): Promise<void>;
500
500
  }
501
501
 
502
+ declare class CopyToClipboardTesting extends AbstractComponentTesting<CopyToClipboardWrapper, FieldSpec> {
503
+ protected view: AbstractViewTesting<any>;
504
+ constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
505
+ expectEnabled(): void;
506
+ copyText(text: string | RegExp): Promise<void>;
507
+ }
508
+
502
509
  declare class MockBrowserAPIs {
503
510
  static mockConfirmAlways(confirm: boolean): Function;
504
511
  static mockScroll(): Function;
@@ -571,4 +578,4 @@ declare class ViewTestWrapperProps<T> {
571
578
  }
572
579
  declare function ViewTestWrapper<T>(props: ViewTestWrapperProps<T>): react_jsx_runtime.JSX.Element;
573
580
 
574
- export { AbstractComponentTesting, AbstractInputTesting, AbstractSelectTesting, AbstractViewTesting, AlertTesting, BoxTesting, ButtonDropdownTesting, ButtonTesting, CSVNoItemsViewTesting, CSVPriceInputViewTesting, CSVSearchFilterViewTesting, CSVTextPromptModalViewTesting, CardsTesting, CheckboxTesting, CollectionPreferencesSetting, CollectionPreferencesTesting, DatePickerTesting, FlashbarTesting, FormTesting, HeaderTesting, IconTesting, LinkTesting, MockBrowserAPIs, MockRestClient, MockServerBuilder, ModalTesting, MultiselectTesting, NumberInputTesting, PaginationTesting, ProgressBarTesting, RatingTesting, SegmentedControlTesting, SelectTesting, StatusIndicatorTesting, StringInputTesting, TableTesting, TabsTesting, TestLocalisation, TestingFactory, TextContentTesting, TextFilterTesting, TextareaTesting, ToggleTesting, ViewTestWrapper, WizardTesting, setupRestClientMock };
581
+ export { AbstractComponentTesting, AbstractInputTesting, AbstractSelectTesting, AbstractViewTesting, AlertTesting, BoxTesting, ButtonDropdownTesting, ButtonTesting, CSVNoItemsViewTesting, CSVPriceInputViewTesting, CSVSearchFilterViewTesting, CSVTextPromptModalViewTesting, CardsTesting, CheckboxTesting, CollectionPreferencesSetting, CollectionPreferencesTesting, CopyToClipboardTesting, DatePickerTesting, FlashbarTesting, FormTesting, HeaderTesting, IconTesting, LinkTesting, MockBrowserAPIs, MockRestClient, MockServerBuilder, ModalTesting, MultiselectTesting, NumberInputTesting, PaginationTesting, ProgressBarTesting, RatingTesting, SegmentedControlTesting, SelectTesting, StatusIndicatorTesting, StringInputTesting, TableTesting, TabsTesting, TestLocalisation, TestingFactory, TextContentTesting, TextFilterTesting, TextareaTesting, ToggleTesting, ViewTestWrapper, WizardTesting, setupRestClientMock };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as RealRestClient from '@ebertjendustries/cswrapper';
2
2
  import { LocalisationNamespace, Localiser, FieldSpec, EnumFactory, ViewSpec, IViewElementSpec, LocalisationVariableType, CSVNoItemsViewElements, CSVPriceInputViewElements, IPrice, CSVSearchFilterViewElements, CSVTextPromptModalViewElements, PropertyChangeFunction } from '@ebertjendustries/cswrapper';
3
- import { MultiselectWrapper, SelectWrapper, InputWrapper, DatePickerWrapper, TableWrapper, WizardWrapper, ButtonWrapper, ButtonDropdownWrapper, ModalWrapper, CheckboxWrapper, HeaderWrapper, BoxWrapper, CollectionPreferencesWrapper, LinkWrapper, ToggleWrapper, FlashbarWrapper, SegmentedControlWrapper, AlertWrapper, StatusIndicatorWrapper, CardsWrapper, TextareaWrapper, TabsWrapper, TextFilterWrapper, TextContentWrapper, PaginationWrapper, FormWrapper, ProgressBarWrapper, IconWrapper, ElementWrapper as ElementWrapper$1, FormFieldWrapper } from '@cloudscape-design/components/test-utils/dom';
3
+ import { MultiselectWrapper, SelectWrapper, InputWrapper, DatePickerWrapper, TableWrapper, WizardWrapper, ButtonWrapper, ButtonDropdownWrapper, ModalWrapper, CheckboxWrapper, HeaderWrapper, BoxWrapper, CollectionPreferencesWrapper, LinkWrapper, ToggleWrapper, FlashbarWrapper, SegmentedControlWrapper, AlertWrapper, StatusIndicatorWrapper, CardsWrapper, TextareaWrapper, TabsWrapper, TextFilterWrapper, TextContentWrapper, PaginationWrapper, FormWrapper, ProgressBarWrapper, IconWrapper, ElementWrapper as ElementWrapper$1, FormFieldWrapper, CopyToClipboardWrapper } from '@cloudscape-design/components/test-utils/dom';
4
4
  import { ElementWrapper, ComponentWrapper } from '@cloudscape-design/test-utils-core/dom';
5
5
  import DropdownHostComponentWrapper from '@cloudscape-design/components/test-utils/dom/internal/dropdown-host';
6
6
  import * as vitest from 'vitest';
@@ -499,6 +499,13 @@ declare class CSVTextPromptModalViewTesting extends AbstractViewTesting<CSVTextP
499
499
  expectVisibleAfterOpsThenDismiss(operations: (() => void)[], navigatingAway?: boolean): Promise<void>;
500
500
  }
501
501
 
502
+ declare class CopyToClipboardTesting extends AbstractComponentTesting<CopyToClipboardWrapper, FieldSpec> {
503
+ protected view: AbstractViewTesting<any>;
504
+ constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
505
+ expectEnabled(): void;
506
+ copyText(text: string | RegExp): Promise<void>;
507
+ }
508
+
502
509
  declare class MockBrowserAPIs {
503
510
  static mockConfirmAlways(confirm: boolean): Function;
504
511
  static mockScroll(): Function;
@@ -571,4 +578,4 @@ declare class ViewTestWrapperProps<T> {
571
578
  }
572
579
  declare function ViewTestWrapper<T>(props: ViewTestWrapperProps<T>): react_jsx_runtime.JSX.Element;
573
580
 
574
- export { AbstractComponentTesting, AbstractInputTesting, AbstractSelectTesting, AbstractViewTesting, AlertTesting, BoxTesting, ButtonDropdownTesting, ButtonTesting, CSVNoItemsViewTesting, CSVPriceInputViewTesting, CSVSearchFilterViewTesting, CSVTextPromptModalViewTesting, CardsTesting, CheckboxTesting, CollectionPreferencesSetting, CollectionPreferencesTesting, DatePickerTesting, FlashbarTesting, FormTesting, HeaderTesting, IconTesting, LinkTesting, MockBrowserAPIs, MockRestClient, MockServerBuilder, ModalTesting, MultiselectTesting, NumberInputTesting, PaginationTesting, ProgressBarTesting, RatingTesting, SegmentedControlTesting, SelectTesting, StatusIndicatorTesting, StringInputTesting, TableTesting, TabsTesting, TestLocalisation, TestingFactory, TextContentTesting, TextFilterTesting, TextareaTesting, ToggleTesting, ViewTestWrapper, WizardTesting, setupRestClientMock };
581
+ export { AbstractComponentTesting, AbstractInputTesting, AbstractSelectTesting, AbstractViewTesting, AlertTesting, BoxTesting, ButtonDropdownTesting, ButtonTesting, CSVNoItemsViewTesting, CSVPriceInputViewTesting, CSVSearchFilterViewTesting, CSVTextPromptModalViewTesting, CardsTesting, CheckboxTesting, CollectionPreferencesSetting, CollectionPreferencesTesting, CopyToClipboardTesting, DatePickerTesting, FlashbarTesting, FormTesting, HeaderTesting, IconTesting, LinkTesting, MockBrowserAPIs, MockRestClient, MockServerBuilder, ModalTesting, MultiselectTesting, NumberInputTesting, PaginationTesting, ProgressBarTesting, RatingTesting, SegmentedControlTesting, SelectTesting, StatusIndicatorTesting, StringInputTesting, TableTesting, TabsTesting, TestLocalisation, TestingFactory, TextContentTesting, TextFilterTesting, TextareaTesting, ToggleTesting, ViewTestWrapper, WizardTesting, setupRestClientMock };
package/dist/index.js CHANGED
@@ -46,6 +46,7 @@ __export(index_exports, {
46
46
  CheckboxTesting: () => CheckboxTesting,
47
47
  CollectionPreferencesSetting: () => CollectionPreferencesSetting,
48
48
  CollectionPreferencesTesting: () => CollectionPreferencesTesting,
49
+ CopyToClipboardTesting: () => CopyToClipboardTesting,
49
50
  DatePickerTesting: () => DatePickerTesting,
50
51
  FlashbarTesting: () => FlashbarTesting,
51
52
  FormTesting: () => FormTesting,
@@ -976,8 +977,8 @@ var FlashbarTesting = class extends AbstractComponentTesting {
976
977
  await (0, import_react20.waitFor)(() => (0, import_vitest14.expect)(this.getElementWrapper().findItems().length).toBeGreaterThan(0));
977
978
  const wrappers = this.getElementWrapper().findItems();
978
979
  for (let index = 0; index < wrappers.length; index++) {
979
- const wrapper29 = wrappers[index];
980
- await (0, import_react20.waitFor)(() => (0, import_vitest14.expect)(wrapper29.findContent()).not.toBeNull());
980
+ const wrapper30 = wrappers[index];
981
+ await (0, import_react20.waitFor)(() => (0, import_vitest14.expect)(wrapper30.findContent()).not.toBeNull());
981
982
  }
982
983
  }
983
984
  expectMessagePresentCount(text, count, headerMessage) {
@@ -1591,19 +1592,44 @@ var CSVTextPromptModalViewTesting = class extends AbstractViewTesting {
1591
1592
  }
1592
1593
  };
1593
1594
 
1594
- // src/mocks/MockBrowserAPIs.ts
1595
+ // src/components/CopyToClipboardTesting.ts
1596
+ var import_dom30 = __toESM(require("@cloudscape-design/components/test-utils/dom"));
1597
+ var import_user_event3 = __toESM(require("@testing-library/user-event"));
1598
+ var import_dom31 = require("@testing-library/dom");
1595
1599
  var import_vitest25 = require("vitest");
1600
+ var CopyToClipboardTesting = class extends AbstractComponentTesting {
1601
+ constructor(fieldSpec, view) {
1602
+ super(fieldSpec, view, (selector) => (0, import_dom30.default)().findCopyToClipboard(selector));
1603
+ this.view = view;
1604
+ }
1605
+ expectEnabled() {
1606
+ AbstractComponentTesting.expectEnabled(this.getElementWrapper().findCopyButton().getElement(), this.msgForExpect());
1607
+ }
1608
+ async copyText(text) {
1609
+ const user = import_user_event3.default.setup();
1610
+ await (0, import_dom31.waitFor)(() => user.click(this.getElementWrapper().findCopyButton().getElement()));
1611
+ if (text !== "") {
1612
+ await (0, import_dom31.waitFor)(async () => {
1613
+ const copiedText = await window.navigator.clipboard.readText();
1614
+ (0, import_vitest25.expect)(copiedText).toEqual(text);
1615
+ });
1616
+ }
1617
+ }
1618
+ };
1619
+
1620
+ // src/mocks/MockBrowserAPIs.ts
1621
+ var import_vitest26 = require("vitest");
1596
1622
  var realDateNow = global.Date.now;
1597
1623
  var MockBrowserAPIs = class {
1598
1624
  static mockConfirmAlways(confirm) {
1599
- return window.confirm = import_vitest25.vi.fn().mockImplementation(() => confirm);
1625
+ return window.confirm = import_vitest26.vi.fn().mockImplementation(() => confirm);
1600
1626
  }
1601
1627
  static mockScroll() {
1602
- return window.scrollTo = import_vitest25.vi.fn();
1628
+ return window.scrollTo = import_vitest26.vi.fn();
1603
1629
  }
1604
1630
  static mockDateNow(epochMillisToReturn) {
1605
1631
  realDateNow = Date.now.bind(global.Date);
1606
- const dateNowStub = import_vitest25.vi.fn(() => epochMillisToReturn);
1632
+ const dateNowStub = import_vitest26.vi.fn(() => epochMillisToReturn);
1607
1633
  global.Date.now = dateNowStub;
1608
1634
  return dateNowStub;
1609
1635
  }
@@ -1613,7 +1639,7 @@ var MockBrowserAPIs = class {
1613
1639
  };
1614
1640
 
1615
1641
  // src/mocks/MockRestClient.ts
1616
- var import_vitest26 = require("vitest");
1642
+ var import_vitest27 = require("vitest");
1617
1643
  var import_console = require("console");
1618
1644
  var import_cswrapper12 = require("@ebertjendustries/cswrapper");
1619
1645
  var import_cswrapper13 = require("@ebertjendustries/cswrapper");
@@ -1664,7 +1690,7 @@ var MockResponseStore = class {
1664
1690
  };
1665
1691
  function setupRestClientMock(controllerSpec) {
1666
1692
  const mockRestClient = new MockRestClient(controllerSpec.key);
1667
- const mock = import_vitest26.vi.spyOn(RealRestClient, "createRestClient");
1693
+ const mock = import_vitest27.vi.spyOn(RealRestClient, "createRestClient");
1668
1694
  LOGGER.info(`Setting up mock rest client with key ${controllerSpec.key}.`);
1669
1695
  mock.mockImplementation(() => {
1670
1696
  return mockRestClient;
@@ -1673,10 +1699,10 @@ function setupRestClientMock(controllerSpec) {
1673
1699
  }
1674
1700
  var MockRestClient = class {
1675
1701
  constructor(name) {
1676
- this.get = import_vitest26.vi.fn();
1677
- this.put = import_vitest26.vi.fn();
1678
- this.post = import_vitest26.vi.fn();
1679
- this.del = import_vitest26.vi.fn();
1702
+ this.get = import_vitest27.vi.fn();
1703
+ this.put = import_vitest27.vi.fn();
1704
+ this.post = import_vitest27.vi.fn();
1705
+ this.del = import_vitest27.vi.fn();
1680
1706
  this.uuid = "<" + crypto.randomUUID().split("-")[4] + ">";
1681
1707
  LOGGER.info(`Instantiating mock rest client with name ${name} and UUID ${this.uuid}.`);
1682
1708
  this.getResponseValues = new MockResponseStore(this.uuid);
@@ -1909,6 +1935,7 @@ function ViewTestWrapper(props) {
1909
1935
  CheckboxTesting,
1910
1936
  CollectionPreferencesSetting,
1911
1937
  CollectionPreferencesTesting,
1938
+ CopyToClipboardTesting,
1912
1939
  DatePickerTesting,
1913
1940
  FlashbarTesting,
1914
1941
  FormTesting,
package/dist/index.mjs CHANGED
@@ -895,8 +895,8 @@ var FlashbarTesting = class extends AbstractComponentTesting {
895
895
  await waitFor7(() => expect14(this.getElementWrapper().findItems().length).toBeGreaterThan(0));
896
896
  const wrappers = this.getElementWrapper().findItems();
897
897
  for (let index = 0; index < wrappers.length; index++) {
898
- const wrapper29 = wrappers[index];
899
- await waitFor7(() => expect14(wrapper29.findContent()).not.toBeNull());
898
+ const wrapper30 = wrappers[index];
899
+ await waitFor7(() => expect14(wrapper30.findContent()).not.toBeNull());
900
900
  }
901
901
  }
902
902
  expectMessagePresentCount(text, count, headerMessage) {
@@ -1512,6 +1512,31 @@ var CSVTextPromptModalViewTesting = class extends AbstractViewTesting {
1512
1512
  }
1513
1513
  };
1514
1514
 
1515
+ // src/components/CopyToClipboardTesting.ts
1516
+ import wrapper29 from "@cloudscape-design/components/test-utils/dom";
1517
+ import userEvent3 from "@testing-library/user-event";
1518
+ import { waitFor as waitFor11 } from "@testing-library/dom";
1519
+ import { expect as expect25 } from "vitest";
1520
+ var CopyToClipboardTesting = class extends AbstractComponentTesting {
1521
+ constructor(fieldSpec, view) {
1522
+ super(fieldSpec, view, (selector) => wrapper29().findCopyToClipboard(selector));
1523
+ this.view = view;
1524
+ }
1525
+ expectEnabled() {
1526
+ AbstractComponentTesting.expectEnabled(this.getElementWrapper().findCopyButton().getElement(), this.msgForExpect());
1527
+ }
1528
+ async copyText(text) {
1529
+ const user = userEvent3.setup();
1530
+ await waitFor11(() => user.click(this.getElementWrapper().findCopyButton().getElement()));
1531
+ if (text !== "") {
1532
+ await waitFor11(async () => {
1533
+ const copiedText = await window.navigator.clipboard.readText();
1534
+ expect25(copiedText).toEqual(text);
1535
+ });
1536
+ }
1537
+ }
1538
+ };
1539
+
1515
1540
  // src/mocks/MockBrowserAPIs.ts
1516
1541
  import { vi } from "vitest";
1517
1542
  var realDateNow = global.Date.now;
@@ -1829,6 +1854,7 @@ export {
1829
1854
  CheckboxTesting,
1830
1855
  CollectionPreferencesSetting,
1831
1856
  CollectionPreferencesTesting,
1857
+ CopyToClipboardTesting,
1832
1858
  DatePickerTesting,
1833
1859
  FlashbarTesting,
1834
1860
  FormTesting,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ebertjendustries/cstestwrapper",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "main": "dist/index.cjs",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",