@perses-dev/plugin-system 0.23.0 → 0.24.0

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.
Files changed (44) hide show
  1. package/dist/cjs/model/calculations.js +6 -1
  2. package/dist/cjs/model/index.js +2 -2
  3. package/dist/model/calculations.d.ts +1 -1
  4. package/dist/model/calculations.d.ts.map +1 -1
  5. package/dist/model/calculations.js +7 -1
  6. package/dist/model/calculations.js.map +1 -1
  7. package/dist/model/index.d.ts +2 -2
  8. package/dist/model/index.d.ts.map +1 -1
  9. package/dist/model/index.js +2 -2
  10. package/dist/model/index.js.map +1 -1
  11. package/dist/model/time-series-queries.d.ts +3 -4
  12. package/dist/model/time-series-queries.d.ts.map +1 -1
  13. package/dist/model/time-series-queries.js.map +1 -1
  14. package/package.json +5 -4
  15. package/dist/cjs/components/CalculationSelector/CalculationSelector.test.js +0 -65
  16. package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.test.js +0 -107
  17. package/dist/cjs/components/PluginEditor/PluginEditor.test.js +0 -150
  18. package/dist/cjs/components/PluginKindSelect.test.js +0 -86
  19. package/dist/cjs/components/PluginRegistry/PluginRegistry.test.js +0 -144
  20. package/dist/cjs/components/PluginSpecEditor.test.js +0 -92
  21. package/dist/components/CalculationSelector/CalculationSelector.test.d.ts +0 -2
  22. package/dist/components/CalculationSelector/CalculationSelector.test.d.ts.map +0 -1
  23. package/dist/components/CalculationSelector/CalculationSelector.test.js +0 -58
  24. package/dist/components/CalculationSelector/CalculationSelector.test.js.map +0 -1
  25. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.test.d.ts +0 -2
  26. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.test.d.ts.map +0 -1
  27. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.test.js +0 -100
  28. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.test.js.map +0 -1
  29. package/dist/components/PluginEditor/PluginEditor.test.d.ts +0 -2
  30. package/dist/components/PluginEditor/PluginEditor.test.d.ts.map +0 -1
  31. package/dist/components/PluginEditor/PluginEditor.test.js +0 -143
  32. package/dist/components/PluginEditor/PluginEditor.test.js.map +0 -1
  33. package/dist/components/PluginKindSelect.test.d.ts +0 -2
  34. package/dist/components/PluginKindSelect.test.d.ts.map +0 -1
  35. package/dist/components/PluginKindSelect.test.js +0 -79
  36. package/dist/components/PluginKindSelect.test.js.map +0 -1
  37. package/dist/components/PluginRegistry/PluginRegistry.test.d.ts +0 -2
  38. package/dist/components/PluginRegistry/PluginRegistry.test.d.ts.map +0 -1
  39. package/dist/components/PluginRegistry/PluginRegistry.test.js +0 -137
  40. package/dist/components/PluginRegistry/PluginRegistry.test.js.map +0 -1
  41. package/dist/components/PluginSpecEditor.test.d.ts +0 -2
  42. package/dist/components/PluginSpecEditor.test.d.ts.map +0 -1
  43. package/dist/components/PluginSpecEditor.test.js +0 -85
  44. package/dist/components/PluginSpecEditor.test.js.map +0 -1
@@ -1,144 +0,0 @@
1
- // Copyright 2023 The Perses Authors
2
- // Licensed under the Apache License, Version 2.0 (the "License");
3
- // you may not use this file except in compliance with the License.
4
- // You may obtain a copy of the License at
5
- //
6
- // http://www.apache.org/licenses/LICENSE-2.0
7
- //
8
- // Unless required by applicable law or agreed to in writing, software
9
- // distributed under the License is distributed on an "AS IS" BASIS,
10
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- // See the License for the specific language governing permissions and
12
- // limitations under the License.
13
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- const _jsxRuntime = require("react/jsx-runtime");
18
- const _react = /*#__PURE__*/ _interopRequireDefault(require("react"));
19
- const _react1 = require("@testing-library/react");
20
- const _runtime = require("../../runtime");
21
- const _test = require("../../test");
22
- function _interopRequireDefault(obj) {
23
- return obj && obj.__esModule ? obj : {
24
- default: obj
25
- };
26
- }
27
- describe('PluginRegistry', ()=>{
28
- const renderPluginRegistry = (children)=>{
29
- (0, _test.renderWithContext)(children);
30
- };
31
- it('can load a plugin that exists', async ()=>{
32
- renderPluginRegistry(/*#__PURE__*/ (0, _jsxRuntime.jsx)(PluginConsumer, {
33
- pluginType: "Variable",
34
- kind: "ErnieVariable"
35
- }));
36
- const hasPlugin = await _react1.screen.findByText('Has plugin: true', undefined, {
37
- timeout: 3000
38
- });
39
- expect(hasPlugin).toBeInTheDocument();
40
- });
41
- it('errors when plugin is not installed', async ()=>{
42
- // This plugin is not in the test metadata at all
43
- renderPluginRegistry(/*#__PURE__*/ (0, _jsxRuntime.jsx)(PluginConsumer, {
44
- pluginType: "TimeSeriesQuery",
45
- kind: "NotInstalled"
46
- }));
47
- const error = await _react1.screen.findByText(/error:/i);
48
- expect(error).toBeInTheDocument();
49
- expect(error).toHaveTextContent(/not installed/i);
50
- });
51
- it('errors when plugin is missing from the module', async ()=>{
52
- // This plugin is in the test metadata, but the code is missing from the module
53
- renderPluginRegistry(/*#__PURE__*/ (0, _jsxRuntime.jsx)(PluginConsumer, {
54
- pluginType: "Variable",
55
- kind: "MissingErnieVariable"
56
- }));
57
- const error = await _react1.screen.findByText(/error:/i);
58
- expect(error).toBeInTheDocument();
59
- expect(error).toHaveTextContent(/missing/i);
60
- });
61
- it('lists metadata for plugin metadata that exists', async ()=>{
62
- // There should be 3 variable plugins across both test modules
63
- renderPluginRegistry(/*#__PURE__*/ (0, _jsxRuntime.jsx)(MetadataConsumer, {
64
- pluginType: "Variable"
65
- }));
66
- const table = await _react1.screen.findByRole('table');
67
- expect(table).toBeInTheDocument();
68
- const rows = _react1.screen.getAllByRole('row');
69
- expect(rows).toHaveLength(3);
70
- });
71
- it('lists metadata for plugin types with no plugins available', async ()=>{
72
- // There are no TimeSeriesQuery plugins in any of the test modules
73
- renderPluginRegistry(/*#__PURE__*/ (0, _jsxRuntime.jsx)(MetadataConsumer, {
74
- pluginType: "TimeSeriesQuery"
75
- }));
76
- const table = await _react1.screen.findByRole('table');
77
- expect(table).toBeInTheDocument();
78
- const rows = _react1.screen.queryAllByRole('row');
79
- expect(rows).toHaveLength(0);
80
- });
81
- });
82
- // A helper component for testing the PluginRegistry by calling usePlugin to load a plugin
83
- const PluginConsumer = (props)=>{
84
- const { data: plugin , isLoading , error } = (0, _runtime.usePlugin)(props.pluginType, props.kind);
85
- if (error) {
86
- return /*#__PURE__*/ (0, _jsxRuntime.jsxs)("div", {
87
- children: [
88
- "Error: ",
89
- error.message
90
- ]
91
- });
92
- }
93
- if (isLoading) {
94
- return /*#__PURE__*/ (0, _jsxRuntime.jsx)("div", {
95
- children: "Loading"
96
- });
97
- }
98
- return /*#__PURE__*/ (0, _jsxRuntime.jsxs)("div", {
99
- children: [
100
- "Has plugin: ",
101
- (plugin !== undefined).toString()
102
- ]
103
- });
104
- };
105
- // A helper component for testing the PluginRegistry metadata APIs by calling useListPluginMetadata
106
- const MetadataConsumer = (props)=>{
107
- const { data: pluginMetadata , isLoading , error } = (0, _runtime.useListPluginMetadata)(props.pluginType);
108
- if (error) {
109
- return /*#__PURE__*/ (0, _jsxRuntime.jsxs)("div", {
110
- children: [
111
- "Error: ",
112
- error.message
113
- ]
114
- });
115
- }
116
- if (isLoading) {
117
- return /*#__PURE__*/ (0, _jsxRuntime.jsx)("div", {
118
- children: "Loading"
119
- });
120
- }
121
- if (pluginMetadata === undefined) {
122
- return null;
123
- }
124
- return /*#__PURE__*/ (0, _jsxRuntime.jsx)("table", {
125
- children: /*#__PURE__*/ (0, _jsxRuntime.jsx)("tbody", {
126
- children: pluginMetadata.map((item)=>/*#__PURE__*/ (0, _jsxRuntime.jsxs)("tr", {
127
- children: [
128
- /*#__PURE__*/ (0, _jsxRuntime.jsx)("td", {
129
- children: item.pluginType
130
- }),
131
- /*#__PURE__*/ (0, _jsxRuntime.jsx)("td", {
132
- children: item.kind
133
- }),
134
- /*#__PURE__*/ (0, _jsxRuntime.jsx)("td", {
135
- children: item.display.name
136
- }),
137
- /*#__PURE__*/ (0, _jsxRuntime.jsx)("td", {
138
- children: item.display.description
139
- })
140
- ]
141
- }, item.kind))
142
- })
143
- });
144
- };
@@ -1,92 +0,0 @@
1
- // Copyright 2023 The Perses Authors
2
- // Licensed under the Apache License, Version 2.0 (the "License");
3
- // you may not use this file except in compliance with the License.
4
- // You may obtain a copy of the License at
5
- //
6
- // http://www.apache.org/licenses/LICENSE-2.0
7
- //
8
- // Unless required by applicable law or agreed to in writing, software
9
- // distributed under the License is distributed on an "AS IS" BASIS,
10
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- // See the License for the specific language governing permissions and
12
- // limitations under the License.
13
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- const _jsxRuntime = require("react/jsx-runtime");
18
- const _userEvent = /*#__PURE__*/ _interopRequireDefault(require("@testing-library/user-event"));
19
- const _react = require("@testing-library/react");
20
- const _test = require("../test");
21
- const _pluginSpecEditor = require("./PluginSpecEditor");
22
- function _interopRequireDefault(obj) {
23
- return obj && obj.__esModule ? obj : {
24
- default: obj
25
- };
26
- }
27
- describe('PluginSpecEditor', ()=>{
28
- const renderComponent = (props)=>{
29
- (0, _test.renderWithContext)(/*#__PURE__*/ (0, _jsxRuntime.jsx)(_pluginSpecEditor.PluginSpecEditor, {
30
- ...props
31
- }));
32
- };
33
- describe('Panel plugin', ()=>{
34
- it('should show query and json editors', async ()=>{
35
- renderComponent({
36
- pluginType: 'Panel',
37
- pluginKind: 'BertPanel1',
38
- value: {},
39
- onChange: jest.fn()
40
- });
41
- const queryTab = await _react.screen.findByLabelText('Query');
42
- expect(queryTab).toBeInTheDocument();
43
- const editor = await _react.screen.findByLabelText('BertPanel1 editor');
44
- expect(editor).toBeInTheDocument();
45
- const jsonEditor = await _react.screen.findByLabelText('JSON');
46
- expect(jsonEditor).toBeInTheDocument();
47
- });
48
- it('should display other options editor components', async ()=>{
49
- renderComponent({
50
- pluginType: 'Panel',
51
- pluginKind: 'BertPanel2',
52
- value: {},
53
- onChange: jest.fn()
54
- });
55
- const settingsTab = await _react.screen.findByLabelText('Settings');
56
- expect(settingsTab).toBeInTheDocument();
57
- const editor = await _react.screen.findByLabelText('BertPanel2 editor');
58
- expect(editor).toBeInTheDocument();
59
- const customTab = await _react.screen.findByLabelText('Custom Tab');
60
- expect(customTab).toBeInTheDocument();
61
- const jsonEditor = await _react.screen.findByLabelText('JSON');
62
- expect(jsonEditor).toBeInTheDocument();
63
- });
64
- });
65
- it('propagates value changes', async ()=>{
66
- const onChange = jest.fn();
67
- renderComponent({
68
- pluginType: 'Panel',
69
- pluginKind: 'BertPanel1',
70
- value: {
71
- option1: 'Option1Value'
72
- },
73
- onChange
74
- });
75
- const editor = await _react.screen.findByLabelText('BertPanel1 editor');
76
- expect(editor).toHaveValue('Option1Value');
77
- _userEvent.default.clear(editor);
78
- expect(onChange).toHaveBeenCalledWith({
79
- option1: ''
80
- });
81
- });
82
- it('shows an error if plugin fails to load', async ()=>{
83
- renderComponent({
84
- pluginType: 'Variable',
85
- pluginKind: 'DoesNotExist',
86
- value: {},
87
- onChange: jest.fn()
88
- });
89
- const errorAlert = await _react.screen.findByRole('alert');
90
- expect(errorAlert).toHaveTextContent(/doesnotexist/i);
91
- });
92
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=CalculationSelector.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CalculationSelector.test.d.ts","sourceRoot":"","sources":["../../../src/components/CalculationSelector/CalculationSelector.test.tsx"],"names":[],"mappings":""}
@@ -1,58 +0,0 @@
1
- // Copyright 2023 The Perses Authors
2
- // Licensed under the Apache License, Version 2.0 (the "License");
3
- // you may not use this file except in compliance with the License.
4
- // You may obtain a copy of the License at
5
- //
6
- // http://www.apache.org/licenses/LICENSE-2.0
7
- //
8
- // Unless required by applicable law or agreed to in writing, software
9
- // distributed under the License is distributed on an "AS IS" BASIS,
10
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- // See the License for the specific language governing permissions and
12
- // limitations under the License.
13
- import { jsx as _jsx } from "react/jsx-runtime";
14
- import { render, screen } from '@testing-library/react';
15
- import userEvent from '@testing-library/user-event';
16
- import { CalculationSelector } from './CalculationSelector';
17
- describe('CalculationSelector', ()=>{
18
- const renderCalculationSelector = (value, onChange = jest.fn())=>{
19
- render(/*#__PURE__*/ _jsx("div", {
20
- children: /*#__PURE__*/ _jsx(CalculationSelector, {
21
- value: value,
22
- onChange: onChange
23
- })
24
- }));
25
- };
26
- const getCalculationSelector = ()=>{
27
- return screen.getByRole('combobox', {
28
- name: 'Calculation'
29
- });
30
- };
31
- it('can change the calculation by clicking', ()=>{
32
- const onChange = jest.fn();
33
- renderCalculationSelector('Last', onChange);
34
- const calcSelector = getCalculationSelector();
35
- userEvent.click(calcSelector);
36
- const sumOption = screen.getByRole('option', {
37
- name: 'Sum'
38
- });
39
- userEvent.click(sumOption);
40
- expect(onChange).toHaveBeenCalledWith('Sum');
41
- });
42
- it('can change the calculation using a keyboard', ()=>{
43
- const onChange = jest.fn();
44
- renderCalculationSelector('First', onChange);
45
- const calcSelector = getCalculationSelector();
46
- userEvent.tab();
47
- expect(calcSelector).toHaveFocus();
48
- userEvent.clear(calcSelector);
49
- userEvent.keyboard('first');
50
- screen.getByRole('option', {
51
- name: 'First'
52
- });
53
- userEvent.keyboard('{arrowup}{enter}');
54
- expect(onChange).toHaveBeenCalledWith('First');
55
- });
56
- });
57
-
58
- //# sourceMappingURL=CalculationSelector.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/CalculationSelector/CalculationSelector.test.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { render, screen } from '@testing-library/react';\nimport userEvent from '@testing-library/user-event';\nimport { CalculationType } from '../../model/calculations';\nimport { CalculationSelector } from './CalculationSelector';\n\ndescribe('CalculationSelector', () => {\n const renderCalculationSelector = (value: CalculationType, onChange = jest.fn()) => {\n render(\n <div>\n <CalculationSelector value={value} onChange={onChange} />\n </div>\n );\n };\n\n const getCalculationSelector = () => {\n return screen.getByRole('combobox', { name: 'Calculation' });\n };\n\n it('can change the calculation by clicking', () => {\n const onChange = jest.fn();\n renderCalculationSelector('Last', onChange);\n\n const calcSelector = getCalculationSelector();\n userEvent.click(calcSelector);\n const sumOption = screen.getByRole('option', {\n name: 'Sum',\n });\n userEvent.click(sumOption);\n\n expect(onChange).toHaveBeenCalledWith('Sum');\n });\n\n it('can change the calculation using a keyboard', () => {\n const onChange = jest.fn();\n renderCalculationSelector('First', onChange);\n\n const calcSelector = getCalculationSelector();\n userEvent.tab();\n expect(calcSelector).toHaveFocus();\n\n userEvent.clear(calcSelector);\n userEvent.keyboard('first');\n screen.getByRole('option', {\n name: 'First',\n });\n\n userEvent.keyboard('{arrowup}{enter}');\n\n expect(onChange).toHaveBeenCalledWith('First');\n });\n});\n"],"names":["render","screen","userEvent","CalculationSelector","describe","renderCalculationSelector","value","onChange","jest","fn","div","getCalculationSelector","getByRole","name","it","calcSelector","click","sumOption","expect","toHaveBeenCalledWith","tab","toHaveFocus","clear","keyboard"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,SAASA,MAAM,EAAEC,MAAM,QAAQ,wBAAwB,CAAC;AACxD,OAAOC,SAAS,MAAM,6BAA6B,CAAC;AAEpD,SAASC,mBAAmB,QAAQ,uBAAuB,CAAC;AAE5DC,QAAQ,CA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CnB,SAAS,CAACoB,KAAK,CAACP,YAAY,CAAC,CAAC;QAC9Bb,SAAS,CAACqB,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC5BtB,MAAM,CAACW,SAAS,CAAC,QAAQ,EAAE;YACzBC,IAAI,EAAE,OAAO;SACd,CAAC,CAAC;QAEHX,SAAS,CAACqB,QAAQ,CAAC,kBAAkB,CAAC,CAAC;QAEvCL,MAAM,CAACX,QAAQ,CAAC,CAACY,oBAAoB,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=OptionsEditorTabs.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"OptionsEditorTabs.test.d.ts","sourceRoot":"","sources":["../../../src/components/OptionsEditorTabs/OptionsEditorTabs.test.tsx"],"names":[],"mappings":""}
@@ -1,100 +0,0 @@
1
- // Copyright 2023 The Perses Authors
2
- // Licensed under the Apache License, Version 2.0 (the "License");
3
- // you may not use this file except in compliance with the License.
4
- // You may obtain a copy of the License at
5
- //
6
- // http://www.apache.org/licenses/LICENSE-2.0
7
- //
8
- // Unless required by applicable law or agreed to in writing, software
9
- // distributed under the License is distributed on an "AS IS" BASIS,
10
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- // See the License for the specific language governing permissions and
12
- // limitations under the License.
13
- import { jsx as _jsx } from "react/jsx-runtime";
14
- import { screen, render, getAllByRole } from '@testing-library/react';
15
- import userEvent from '@testing-library/user-event';
16
- import { OptionsEditorTabs } from './OptionsEditorTabs';
17
- describe('OptionsEditorTabs', ()=>{
18
- const mockTabs = [
19
- {
20
- label: 'Query',
21
- content: /*#__PURE__*/ _jsx("div", {
22
- children: "Edit query configuration"
23
- })
24
- },
25
- {
26
- label: 'Settings',
27
- content: /*#__PURE__*/ _jsx("div", {
28
- children: "Edit settings configuration"
29
- })
30
- },
31
- {
32
- label: 'JSON',
33
- content: /*#__PURE__*/ _jsx("div", {
34
- children: "JSON editor"
35
- })
36
- }
37
- ];
38
- const renderTabs = (otherTabs)=>{
39
- const tabs = otherTabs !== null && otherTabs !== void 0 ? otherTabs : mockTabs;
40
- render(/*#__PURE__*/ _jsx(OptionsEditorTabs, {
41
- tabs: tabs
42
- }));
43
- };
44
- it('renders all specified tabs in a tab list', ()=>{
45
- renderTabs();
46
- const tabList = screen.getByRole('tablist');
47
- const tabs = getAllByRole(tabList, 'tab');
48
- expect(tabs).toHaveLength(3);
49
- expect(tabs[0]).toHaveTextContent('Query');
50
- expect(tabs[1]).toHaveTextContent('Settings');
51
- expect(tabs[2]).toHaveTextContent('JSON');
52
- });
53
- it('defaults to selecting the first tab', ()=>{
54
- renderTabs();
55
- const activeTab = screen.getByRole('tab', {
56
- selected: true
57
- });
58
- expect(activeTab).toHaveTextContent('Query');
59
- const activeTabPanel = screen.getByRole('tabpanel');
60
- expect(activeTabPanel).toHaveTextContent('query configuration');
61
- });
62
- it('switches selected tab on click', ()=>{
63
- renderTabs();
64
- const jsonTab = screen.getByRole('tab', {
65
- name: 'JSON'
66
- });
67
- userEvent.click(jsonTab);
68
- const activeTab = screen.getByRole('tab', {
69
- selected: true
70
- });
71
- expect(activeTab).toBe(jsonTab);
72
- const activeTabPanel = screen.getByRole('tabpanel');
73
- expect(activeTabPanel).toHaveTextContent('JSON editor');
74
- });
75
- it('switches selected tab on keyboard interactions', ()=>{
76
- renderTabs();
77
- const vizTab = screen.getByRole('tab', {
78
- name: 'Settings'
79
- });
80
- userEvent.tab();
81
- userEvent.keyboard('{arrowright}{space}');
82
- const activeTab = screen.getByRole('tab', {
83
- selected: true
84
- });
85
- expect(activeTab).toBe(vizTab);
86
- const activeTabPanel = screen.getByRole('tabpanel');
87
- expect(activeTabPanel).toHaveTextContent('settings configuration');
88
- });
89
- it('renders tabs in correct order', ()=>{
90
- renderTabs();
91
- const tabList = screen.getByRole('tablist');
92
- const tabs = getAllByRole(tabList, 'tab');
93
- expect(tabs).toHaveLength(3);
94
- expect(tabs[0]).toHaveTextContent('Query');
95
- expect(tabs[1]).toHaveTextContent('Settings');
96
- expect(tabs[2]).toHaveTextContent('JSON');
97
- });
98
- });
99
-
100
- //# sourceMappingURL=OptionsEditorTabs.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/OptionsEditorTabs/OptionsEditorTabs.test.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { screen, render, getAllByRole } from '@testing-library/react';\nimport userEvent from '@testing-library/user-event';\n\nimport { OptionsEditorTabs, OptionsEditorTabsProps } from './OptionsEditorTabs';\n\ndescribe('OptionsEditorTabs', () => {\n const mockTabs: OptionsEditorTabsProps['tabs'] = [\n {\n label: 'Query',\n content: <div>Edit query configuration</div>,\n },\n {\n label: 'Settings',\n content: <div>Edit settings configuration</div>,\n },\n {\n label: 'JSON',\n content: <div>JSON editor</div>,\n },\n ];\n const renderTabs = (otherTabs?: OptionsEditorTabsProps['tabs']) => {\n const tabs = otherTabs ?? mockTabs;\n render(<OptionsEditorTabs tabs={tabs} />);\n };\n\n it('renders all specified tabs in a tab list', () => {\n renderTabs();\n\n const tabList = screen.getByRole('tablist');\n const tabs = getAllByRole(tabList, 'tab');\n expect(tabs).toHaveLength(3);\n expect(tabs[0]).toHaveTextContent('Query');\n expect(tabs[1]).toHaveTextContent('Settings');\n expect(tabs[2]).toHaveTextContent('JSON');\n });\n\n it('defaults to selecting the first tab', () => {\n renderTabs();\n\n const activeTab = screen.getByRole('tab', {\n selected: true,\n });\n expect(activeTab).toHaveTextContent('Query');\n\n const activeTabPanel = screen.getByRole('tabpanel');\n expect(activeTabPanel).toHaveTextContent('query configuration');\n });\n\n it('switches selected tab on click', () => {\n renderTabs();\n const jsonTab = screen.getByRole('tab', { name: 'JSON' });\n userEvent.click(jsonTab);\n\n const activeTab = screen.getByRole('tab', {\n selected: true,\n });\n expect(activeTab).toBe(jsonTab);\n\n const activeTabPanel = screen.getByRole('tabpanel');\n expect(activeTabPanel).toHaveTextContent('JSON editor');\n });\n\n it('switches selected tab on keyboard interactions', () => {\n renderTabs();\n const vizTab = screen.getByRole('tab', { name: 'Settings' });\n userEvent.tab();\n userEvent.keyboard('{arrowright}{space}');\n\n const activeTab = screen.getByRole('tab', {\n selected: true,\n });\n expect(activeTab).toBe(vizTab);\n\n const activeTabPanel = screen.getByRole('tabpanel');\n expect(activeTabPanel).toHaveTextContent('settings configuration');\n });\n\n it('renders tabs in correct order', () => {\n renderTabs();\n\n const tabList = screen.getByRole('tablist');\n const tabs = getAllByRole(tabList, 'tab');\n expect(tabs).toHaveLength(3);\n expect(tabs[0]).toHaveTextContent('Query');\n expect(tabs[1]).toHaveTextContent('Settings');\n expect(tabs[2]).toHaveTextContent('JSON');\n });\n});\n"],"names":["screen","render","getAllByRole","userEvent","OptionsEditorTabs","describe","mockTabs","label","content","div","renderTabs","otherTabs","tabs","it","tabList","getByRole","expect","toHaveLength","toHaveTextContent","activeTab","selected","activeTabPanel","jsonTab","name","click","toBe","vizTab","tab","keyboard"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,SAASA,MAAM,EAAEC,MAAM,EAAEC,YAAY,QAAQ,wBAAwB,CAAC;AACtE,OAAOC,SAAS,MAAM,6BAA6B,CAAC;AAEpD,SAASC,iBAAiB,QAAgC,q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,QAAQ,EAAE,IAAI;SACf,CAAC,AAAC;QACHJ,MAAM,CAACG,SAAS,CAAC,CAACM,IAAI,CAACC,MAAM,CAAC,CAAC;QAE/B,MAAML,cAAc,GAAGrB,MAAM,CAACe,SAAS,CAAC,UAAU,CAAC,AAAC;QACpDC,MAAM,CAACK,cAAc,CAAC,CAACH,iBAAiB,CAAC,wBAAwB,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;IAEHL,EAAE,CAAC,+BAA+B,EAAE,IAAM;QACxCH,UAAU,EAAE,CAAC;QAEb,MAAMI,OAAO,GAAGd,MAAM,CAACe,SAAS,CAAC,SAAS,CAAC,AAAC;QAC5C,MAAMH,IAAI,GAAGV,YAAY,CAACY,OAAO,EAAE,KAAK,CAAC,AAAC;QAC1CE,MAAM,CAACJ,IAAI,CAAC,CAACK,YAAY,CAAC,CAAC,CAAC,CAAC;QAC7BD,MAAM,CAACJ,IAAI,CAAC,CAAC,CAAC,CAAC,CAACM,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAC3CF,MAAM,CAACJ,IAAI,CAAC,CAAC,CAAC,CAAC,CAACM,iBAAiB,CAAC,UAAU,CAAC,CAAC;QAC9CF,MAAM,CAACJ,IAAI,CAAC,CAAC,CAAC,CAAC,CAACM,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=PluginEditor.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PluginEditor.test.d.ts","sourceRoot":"","sources":["../../../src/components/PluginEditor/PluginEditor.test.tsx"],"names":[],"mappings":""}
@@ -1,143 +0,0 @@
1
- // Copyright 2023 The Perses Authors
2
- // Licensed under the Apache License, Version 2.0 (the "License");
3
- // you may not use this file except in compliance with the License.
4
- // You may obtain a copy of the License at
5
- //
6
- // http://www.apache.org/licenses/LICENSE-2.0
7
- //
8
- // Unless required by applicable law or agreed to in writing, software
9
- // distributed under the License is distributed on an "AS IS" BASIS,
10
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- // See the License for the specific language governing permissions and
12
- // limitations under the License.
13
- import { jsx as _jsx } from "react/jsx-runtime";
14
- import userEvent from '@testing-library/user-event';
15
- import { screen, waitFor } from '@testing-library/react';
16
- import { useState } from 'react';
17
- import { renderWithContext } from '../../test';
18
- import { PluginEditor } from './PluginEditor';
19
- describe('PluginEditor', ()=>{
20
- const renderComponent = ({ pluginType ='Panel' , defaultPluginKinds , value } = {})=>{
21
- const testValue = value || {
22
- kind: 'BertPanel1',
23
- spec: {
24
- option1: 'Option1Value'
25
- }
26
- };
27
- // A test helper component that includes the state that's controlled from outside
28
- let onChange = jest.fn();
29
- function TestHelperForm() {
30
- const [value, setValue] = useState(testValue);
31
- onChange = jest.fn((v)=>setValue(v));
32
- return /*#__PURE__*/ _jsx(PluginEditor, {
33
- pluginType: pluginType,
34
- pluginKindLabel: "Panel Type",
35
- value: value,
36
- onChange: onChange
37
- });
38
- }
39
- renderWithContext(/*#__PURE__*/ _jsx(TestHelperForm, {}), undefined, {
40
- defaultPluginKinds
41
- });
42
- return {
43
- onChange
44
- };
45
- };
46
- // Opens the PluginKindSelect and waits for loading to finish (i.e. options to appear)
47
- const openPluginKind = async ()=>{
48
- const select = screen.getByRole('button', {
49
- name: 'Panel Type'
50
- });
51
- userEvent.click(select);
52
- const options = await screen.findAllByRole('option');
53
- return options;
54
- };
55
- it('shows plugin kind and spec editor', async ()=>{
56
- renderComponent();
57
- const pluginKind = screen.getByRole('button', {
58
- name: 'Panel Type'
59
- });
60
- await waitFor(()=>expect(pluginKind).toHaveTextContent('Bert Panel 1'));
61
- const specEditor = await screen.findByLabelText('BertPanel1 editor');
62
- expect(specEditor).toHaveValue('Option1Value');
63
- });
64
- it('initializes kind and spec together', async ()=>{
65
- const { onChange } = renderComponent();
66
- // Switch to a new plugin kind
67
- await openPluginKind();
68
- const newPluginKind = screen.getByRole('option', {
69
- name: 'Bert Panel 2'
70
- });
71
- userEvent.click(newPluginKind);
72
- // Wait for the editor of the other plugin
73
- const newEditor = await screen.findByLabelText('BertPanel2 editor');
74
- expect(newEditor).toBeInTheDocument();
75
- expect(newEditor).toHaveValue('');
76
- // Make sure onChange was only called once (i.e. initializes both kind and spec at the same time
77
- expect(onChange).toHaveBeenCalledTimes(1);
78
- expect(onChange).toHaveBeenCalledWith({
79
- kind: 'BertPanel2',
80
- spec: {
81
- option2: ''
82
- }
83
- });
84
- });
85
- it('remembers previous spec values', async ()=>{
86
- renderComponent();
87
- // Use the current editor to make a change to the spec value
88
- let editor = await screen.findByLabelText('BertPanel1 editor');
89
- userEvent.clear(editor);
90
- userEvent.type(editor, 'MyNewValue');
91
- // Switch to a new plugin kind
92
- await openPluginKind();
93
- const newPluginKind = screen.getByRole('option', {
94
- name: 'Bert Panel 2'
95
- });
96
- userEvent.click(newPluginKind);
97
- // Wait for the other editor to appear, then switch back
98
- const newEditor = await screen.findByLabelText('BertPanel2 editor');
99
- expect(newEditor).toHaveValue('');
100
- await openPluginKind();
101
- const oldPluginKind = screen.getByRole('option', {
102
- name: 'Bert Panel 1'
103
- });
104
- userEvent.click(oldPluginKind);
105
- // Make sure the editor from the first plugin appears and has our modified value from before the switch
106
- editor = await screen.findByLabelText('BertPanel1 editor');
107
- expect(editor).toHaveValue('MyNewValue');
108
- });
109
- describe('when defaultPluginKinds specified in plugin registry', ()=>{
110
- it('uses default kind when one is not provided', async ()=>{
111
- renderComponent({
112
- pluginType: 'Panel',
113
- defaultPluginKinds: {
114
- Panel: 'BertPanel2'
115
- },
116
- value: {
117
- kind: '',
118
- spec: {}
119
- }
120
- });
121
- // Wait for default panel kind to load.
122
- const pluginKind = screen.getByRole('button', {
123
- name: 'Panel Type'
124
- });
125
- await waitFor(()=>expect(pluginKind).toHaveTextContent('Bert Panel 2'));
126
- });
127
- it('does not use default when kind is provided', async ()=>{
128
- renderComponent({
129
- pluginType: 'Panel',
130
- defaultPluginKinds: {
131
- Panel: 'BertPanel2'
132
- }
133
- });
134
- // Wait for specified panel kind to load.
135
- const pluginKind = screen.getByRole('button', {
136
- name: 'Panel Type'
137
- });
138
- await waitFor(()=>expect(pluginKind).toHaveTextContent('Bert Panel 1'));
139
- });
140
- });
141
- });
142
-
143
- //# sourceMappingURL=PluginEditor.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/PluginEditor/PluginEditor.test.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport userEvent from '@testing-library/user-event';\nimport { screen, waitFor } from '@testing-library/react';\nimport { useState } from 'react';\nimport { renderWithContext } from '../../test';\nimport { DefaultPluginKinds } from '../../model';\nimport { PluginEditor } from './PluginEditor';\nimport { PluginEditorProps } from './plugin-editor-api';\n\ntype RenderComponentOptions = {\n pluginType?: PluginEditorProps['pluginType'];\n defaultPluginKinds?: DefaultPluginKinds;\n value?: PluginEditorProps['value'];\n};\n\ndescribe('PluginEditor', () => {\n const renderComponent = ({ pluginType = 'Panel', defaultPluginKinds, value }: RenderComponentOptions = {}) => {\n const testValue: PluginEditorProps['value'] = value || { kind: 'BertPanel1', spec: { option1: 'Option1Value' } };\n\n // A test helper component that includes the state that's controlled from outside\n let onChange: jest.Mocked<PluginEditorProps['onChange']> = jest.fn();\n function TestHelperForm() {\n const [value, setValue] = useState(testValue);\n onChange = jest.fn((v) => setValue(v));\n\n return <PluginEditor pluginType={pluginType} pluginKindLabel=\"Panel Type\" value={value} onChange={onChange} />;\n }\n\n renderWithContext(<TestHelperForm />, undefined, { defaultPluginKinds });\n return { onChange };\n };\n\n // Opens the PluginKindSelect and waits for loading to finish (i.e. options to appear)\n const openPluginKind = async () => {\n const select = screen.getByRole('button', { name: 'Panel Type' });\n userEvent.click(select);\n const options = await screen.findAllByRole('option');\n return options;\n };\n\n it('shows plugin kind and spec editor', async () => {\n renderComponent();\n\n const pluginKind = screen.getByRole('button', { name: 'Panel Type' });\n await waitFor(() => expect(pluginKind).toHaveTextContent('Bert Panel 1'));\n const specEditor = await screen.findByLabelText('BertPanel1 editor');\n expect(specEditor).toHaveValue('Option1Value');\n });\n\n it('initializes kind and spec together', async () => {\n const { onChange } = renderComponent();\n\n // Switch to a new plugin kind\n await openPluginKind();\n const newPluginKind = screen.getByRole('option', { name: 'Bert Panel 2' });\n userEvent.click(newPluginKind);\n\n // Wait for the editor of the other plugin\n const newEditor = await screen.findByLabelText('BertPanel2 editor');\n expect(newEditor).toBeInTheDocument();\n expect(newEditor).toHaveValue('');\n\n // Make sure onChange was only called once (i.e. initializes both kind and spec at the same time\n expect(onChange).toHaveBeenCalledTimes(1);\n expect(onChange).toHaveBeenCalledWith({ kind: 'BertPanel2', spec: { option2: '' } });\n });\n\n it('remembers previous spec values', async () => {\n renderComponent();\n\n // Use the current editor to make a change to the spec value\n let editor = await screen.findByLabelText('BertPanel1 editor');\n userEvent.clear(editor);\n userEvent.type(editor, 'MyNewValue');\n\n // Switch to a new plugin kind\n await openPluginKind();\n const newPluginKind = screen.getByRole('option', { name: 'Bert Panel 2' });\n userEvent.click(newPluginKind);\n\n // Wait for the other editor to appear, then switch back\n const newEditor = await screen.findByLabelText('BertPanel2 editor');\n expect(newEditor).toHaveValue('');\n await openPluginKind();\n const oldPluginKind = screen.getByRole('option', { name: 'Bert Panel 1' });\n userEvent.click(oldPluginKind);\n\n // Make sure the editor from the first plugin appears and has our modified value from before the switch\n editor = await screen.findByLabelText('BertPanel1 editor');\n expect(editor).toHaveValue('MyNewValue');\n });\n\n describe('when defaultPluginKinds specified in plugin registry', () => {\n it('uses default kind when one is not provided', async () => {\n renderComponent({\n pluginType: 'Panel',\n defaultPluginKinds: {\n Panel: 'BertPanel2',\n },\n value: { kind: '', spec: {} },\n });\n\n // Wait for default panel kind to load.\n const pluginKind = screen.getByRole('button', { name: 'Panel Type' });\n await waitFor(() => expect(pluginKind).toHaveTextContent('Bert Panel 2'));\n });\n\n it('does not use default when kind is provided', async () => {\n renderComponent({ pluginType: 'Panel', defaultPluginKinds: { Panel: 'BertPanel2' } });\n\n // Wait for specified panel kind to load.\n const pluginKind = screen.getByRole('button', { name: 'Panel Type' });\n await waitFor(() => expect(pluginKind).toHaveTextContent('Bert Panel 1'));\n });\n });\n});\n"],"names":["userEvent","screen","waitFor","useState","renderWithContext","PluginEditor","describe","renderComponent","pluginType","defaultPluginKinds","value","testValue","kind","spec","option1","onChange","jest","fn","TestHelperForm","setValue","v","pluginKindLabel","undefined","openPluginKind","select","getByRole","name","click","options","findAllByRole","it","pluginKind","expect","toHaveTextContent","specEditor","findByLabelText","toHaveValue","newPluginKind","newEditor","toBeInTheDocument","toHaveBeenCalledTimes","toHaveBeenCalledWith","option2","editor","clear","type","oldPluginKind","Panel"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,OAAOA,SAAS,MAAM,6BAA6B,CAAC;AACpD,SAASC,MAAM,EAAEC,OAAO,QAAQ,wBAAwB,CAAC;AACzD,SAASC,QAAQ,QAAQ,OAAO,CAAC;AACjC,SAASC,iBAAiB,QAAQ,YAAY,CAAC;AAE/C,SAASC,YAAY,QAAQ,gBAAgB,CAAC;AAS9CC,QAAQ,CAAC,cAAc,EAAE,IAAM;IAC7B,MAAMC,eAAe,GAAG,CAAC,EAAEC,UAAU,EAAG,OAAO,CAAA,EAAEC,kBAAkB,CAAA,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AuC;YACvC,MAAMkB,UAAU,GAAG9B,MAAM,CAACwB,SAAS,CAAC,QAAQ,EAAE;gBAAEC,IAAI,EAAE,YAAY;aAAE,CAAC,AAAC;YACtE,MAAMxB,OAAO,CAAC,IAAM8B,MAAM,CAACD,UAAU,CAAC,CAACE,iBAAiB,CAAC,cAAc,CAAC,CAAC,CAAC;QAC5E,CAAC,CAAC,CAAC;QAEHH,EAAE,CAAC,4CAA4C,EAAE,UAAY;YAC3DvB,eAAe,CAAC;gBAAEC,UAAU,EAAE,OAAO;gBAAEC,kBAAkB,EAAE;oBAAEsC,KAAK,EAAE,YAAY;iBAAE;aAAE,CAAC,CAAC;YAEtF,yCAAyC;YACzC,MAAMhB,UAAU,GAAG9B,MAAM,CAACwB,SAAS,CAAC,QAAQ,EAAE;gBAAEC,IAAI,EAAE,YAAY;aAAE,CAAC,AAAC;YACtE,MAAMxB,OAAO,CAAC,IAAM8B,MAAM,CAACD,UAAU,CAAC,CAACE,iBAAiB,CAAC,cAAc,CAAC,CAAC,CAAC;QAC5E,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=PluginKindSelect.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PluginKindSelect.test.d.ts","sourceRoot":"","sources":["../../src/components/PluginKindSelect.test.tsx"],"names":[],"mappings":""}