@truedat/core 4.56.8 → 4.56.9

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.56.9] 2022-11-12
4
+
5
+ ### Added
6
+
7
+ - [TD-5161] Get specific domain_ids have been indluded for the selector
8
+
3
9
  ## [4.56.3] 2022-11-24
4
10
 
5
11
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/core",
3
- "version": "4.56.8",
3
+ "version": "4.56.9",
4
4
  "description": "Truedat Web Core",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -35,7 +35,7 @@
35
35
  "@testing-library/jest-dom": "^5.16.5",
36
36
  "@testing-library/react": "^12.0.0",
37
37
  "@testing-library/user-event": "^13.2.1",
38
- "@truedat/test": "4.56.8",
38
+ "@truedat/test": "4.56.9",
39
39
  "babel-jest": "^28.1.0",
40
40
  "babel-plugin-dynamic-import-node": "^2.3.3",
41
41
  "babel-plugin-lodash": "^3.3.4",
@@ -115,5 +115,5 @@
115
115
  "react-dom": ">= 16.8.6 < 17",
116
116
  "semantic-ui-react": ">= 2.0.3 < 2.2"
117
117
  },
118
- "gitHead": "9bf266eb26e4af0b774560d5a88b0f22325495e0"
118
+ "gitHead": "da9a49da6d48b51faf603abff56ff7b1b6c5e413"
119
119
  }
@@ -1,8 +1,8 @@
1
1
  import { gql } from "@apollo/client";
2
2
 
3
3
  export const DOMAINS_QUERY = gql`
4
- query DomainsQuery($action: String!, $domainActions: [String!]) {
5
- domains(action: $action) {
4
+ query DomainsQuery($action: String!, $domainActions: [String!], $ids: [ID]) {
5
+ domains(action: $action, ids: $ids) {
6
6
  id
7
7
  externalId
8
8
  name
@@ -12,6 +12,7 @@ export const DomainSelector = ({
12
12
  action,
13
13
  multiple,
14
14
  domainActions,
15
+ domainIds,
15
16
  onLoad,
16
17
  value,
17
18
  ...props
@@ -22,11 +23,13 @@ export const DomainSelector = ({
22
23
  variables: {
23
24
  action: action || "viewDomain",
24
25
  domainActions,
26
+ ids: domainIds,
25
27
  },
26
28
  onCompleted: onLoad,
27
29
  });
28
30
  if (error) return null;
29
31
  if (loading) return null;
32
+
30
33
  const options = _.flow(
31
34
  _.propOr([], "domains"),
32
35
  _.sortBy(accentInsensitivePathOrder("name")),
@@ -53,6 +56,7 @@ DomainSelector.propTypes = {
53
56
  action: PropTypes.string,
54
57
  multiple: PropTypes.bool,
55
58
  domainActions: PropTypes.array,
59
+ domainIds: PropTypes.array,
56
60
  onLoad: PropTypes.func,
57
61
  value: PropTypes.oneOfType([
58
62
  PropTypes.array,
@@ -2,59 +2,24 @@ import React from "react";
2
2
  import { waitFor } from "@testing-library/react";
3
3
  import userEvent from "@testing-library/user-event";
4
4
  import { render } from "@truedat/test/render";
5
- import { DOMAINS_QUERY } from "../../api/queries";
5
+ import { domainsMock } from "@truedat/test/mocks";
6
6
  import DomainSelector from "../DomainSelector";
7
7
 
8
8
  const action = "manageTags";
9
+ const variables = { action: action };
9
10
 
10
- const domainsMock = {
11
- request: { query: DOMAINS_QUERY, variables: { action } },
12
- result: {
13
- data: {
14
- domains: [
15
- {
16
- __typename: "Domain",
17
- id: "1",
18
- name: "foo",
19
- externalId: "A",
20
- parentId: null,
21
- actions: [],
22
- },
23
- {
24
- __typename: "Domain",
25
- id: "2",
26
- name: "bar",
27
- externalId: "B",
28
- parentId: "1",
29
- actions: [],
30
- },
31
- {
32
- __typename: "Domain",
33
- id: "3",
34
- name: "baz",
35
- externalId: "C",
36
- parentId: "2",
37
- actions: [],
38
- },
39
- {
40
- __typename: "Domain",
41
- id: "4",
42
- name: "xyzzy",
43
- externalId: "D",
44
- parentId: "99",
45
- actions: [],
46
- },
47
- ],
48
- },
49
- },
50
- };
51
-
52
- const renderOpts = { mocks: [domainsMock] };
11
+ const renderOpts = { mocks: [domainsMock(variables)] };
53
12
 
54
13
  describe("<DomainSelector />", () => {
55
- it("matches latest snapshot", () => {
14
+ it("matches latest snapshot", async () => {
56
15
  const props = { action, onChange: jest.fn() };
57
- const { container } = render(<DomainSelector {...props} />, renderOpts);
16
+ const { container, queryByText } = render(
17
+ <DomainSelector {...props} />,
18
+ renderOpts
19
+ );
20
+ await waitFor(() => {
21
+ expect(queryByText(/fooDomain/)).toBeInTheDocument();
22
+ });
58
23
  expect(container).toMatchSnapshot();
59
24
  });
60
25
 
@@ -1,3 +1,89 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`<DomainSelector /> matches latest snapshot 1`] = `<div />`;
3
+ exports[`<DomainSelector /> matches latest snapshot 1`] = `
4
+ <div>
5
+ <div
6
+ class="field"
7
+ >
8
+ <div
9
+ aria-expanded="false"
10
+ aria-multiselectable="false"
11
+ class="ui floating dropdown"
12
+ role="listbox"
13
+ tabindex="0"
14
+ >
15
+ <label>
16
+ Select a domain...
17
+ </label>
18
+ <i
19
+ aria-hidden="true"
20
+ class="dropdown icon"
21
+ />
22
+ <div
23
+ class="menu transition"
24
+ >
25
+ <div
26
+ class="ui left icon input search"
27
+ >
28
+ <input
29
+ type="text"
30
+ />
31
+ <i
32
+ aria-hidden="true"
33
+ class="search icon"
34
+ />
35
+ </div>
36
+ <div
37
+ class="scrolling menu transition"
38
+ >
39
+ <div
40
+ aria-selected="false"
41
+ class="item"
42
+ role="option"
43
+ >
44
+ <div
45
+ style="margin-left: 0px;"
46
+ >
47
+ <i
48
+ aria-hidden="true"
49
+ class="plus icon"
50
+ />
51
+ barDomain
52
+ </div>
53
+ </div>
54
+ <div
55
+ aria-selected="false"
56
+ class="item"
57
+ role="option"
58
+ >
59
+ <div
60
+ style="margin-left: 0px;"
61
+ >
62
+ <i
63
+ aria-hidden="true"
64
+ class="icon"
65
+ />
66
+ bazDomain
67
+ </div>
68
+ </div>
69
+ <div
70
+ aria-selected="false"
71
+ class="item"
72
+ role="option"
73
+ >
74
+ <div
75
+ style="margin-left: 0px;"
76
+ >
77
+ <i
78
+ aria-hidden="true"
79
+ class="icon"
80
+ />
81
+ fooDomain
82
+ </div>
83
+ </div>
84
+ </div>
85
+ </div>
86
+ </div>
87
+ </div>
88
+ </div>
89
+ `;