@instructure/ui-simple-select 8.43.2-snapshot-13 → 8.44.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.
- package/CHANGELOG.md +5 -2
- package/es/SimpleSelect/__new-tests__/SimpleSelect.test.js +63 -0
- package/lib/SimpleSelect/__new-tests__/SimpleSelect.test.js +68 -0
- package/package.json +17 -14
- package/src/SimpleSelect/__new-tests__/SimpleSelect.test.tsx +75 -0
- package/tsconfig.build.json +2 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/SimpleSelect/__new-tests__/SimpleSelect.test.d.ts +2 -0
- package/types/SimpleSelect/__new-tests__/SimpleSelect.test.d.ts.map +1 -0
package/CHANGELOG.md
CHANGED
@@ -3,9 +3,12 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
-
|
6
|
+
# [8.44.0](https://github.com/instructure/instructure-ui/compare/v8.43.1...v8.44.0) (2023-09-21)
|
7
7
|
|
8
|
-
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
* **ui-select,ui-simple-select:** add new tests ([e156baa](https://github.com/instructure/instructure-ui/commit/e156baa29c0d8fe70037057a500f1217bc2d51e5))
|
9
12
|
|
10
13
|
|
11
14
|
|
@@ -0,0 +1,63 @@
|
|
1
|
+
/*
|
2
|
+
* The MIT License (MIT)
|
3
|
+
*
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
5
|
+
*
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
11
|
+
* furnished to do so, subject to the following conditions:
|
12
|
+
*
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
14
|
+
* copies or substantial portions of the Software.
|
15
|
+
*
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
* SOFTWARE.
|
23
|
+
*/
|
24
|
+
import React from 'react';
|
25
|
+
import { render } from '@testing-library/react';
|
26
|
+
import '@testing-library/jest-dom/extend-expect';
|
27
|
+
import SimpleSelect from '../index';
|
28
|
+
import * as utils from '@instructure/ui-utils';
|
29
|
+
jest.mock('@instructure/ui-utils', () => {
|
30
|
+
const originalModule = jest.requireActual('@instructure/ui-utils');
|
31
|
+
return {
|
32
|
+
__esModule: true,
|
33
|
+
...originalModule,
|
34
|
+
isSafari: jest.fn(() => true)
|
35
|
+
};
|
36
|
+
});
|
37
|
+
const mockUtils = utils;
|
38
|
+
describe('<SimpleSelect />', () => {
|
39
|
+
const defaultOptions = ['foo', 'bar', 'baz'];
|
40
|
+
const getOptions = disabled => defaultOptions.map(opt => /*#__PURE__*/React.createElement(SimpleSelect.Option, {
|
41
|
+
id: opt,
|
42
|
+
key: opt,
|
43
|
+
value: opt,
|
44
|
+
isDisabled: opt === disabled
|
45
|
+
}, opt));
|
46
|
+
it('should have role button in Safari', async () => {
|
47
|
+
const _render = render( /*#__PURE__*/React.createElement(SimpleSelect, {
|
48
|
+
renderLabel: "Choose an option"
|
49
|
+
}, getOptions())),
|
50
|
+
container = _render.container;
|
51
|
+
const input = container.querySelector('input');
|
52
|
+
expect(input).toHaveAttribute('role', 'button');
|
53
|
+
});
|
54
|
+
it('should have role combobox in different browsers than Safari', async () => {
|
55
|
+
mockUtils.isSafari = jest.fn(() => false);
|
56
|
+
const _render2 = render( /*#__PURE__*/React.createElement(SimpleSelect, {
|
57
|
+
renderLabel: "Choose an option"
|
58
|
+
}, getOptions())),
|
59
|
+
container = _render2.container;
|
60
|
+
const input = container.querySelector('input');
|
61
|
+
expect(input).toHaveAttribute('role', 'combobox');
|
62
|
+
});
|
63
|
+
});
|
@@ -0,0 +1,68 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
6
|
+
var _react2 = require("@testing-library/react");
|
7
|
+
require("@testing-library/jest-dom/extend-expect");
|
8
|
+
var _index = _interopRequireDefault(require("../index"));
|
9
|
+
var utils = _interopRequireWildcard(require("@instructure/ui-utils"));
|
10
|
+
/*
|
11
|
+
* The MIT License (MIT)
|
12
|
+
*
|
13
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
14
|
+
*
|
15
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
16
|
+
* of this software and associated documentation files (the "Software"), to deal
|
17
|
+
* in the Software without restriction, including without limitation the rights
|
18
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
19
|
+
* copies of the Software, and to permit persons to whom the Software is
|
20
|
+
* furnished to do so, subject to the following conditions:
|
21
|
+
*
|
22
|
+
* The above copyright notice and this permission notice shall be included in all
|
23
|
+
* copies or substantial portions of the Software.
|
24
|
+
*
|
25
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
26
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
27
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
28
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
29
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
30
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
31
|
+
* SOFTWARE.
|
32
|
+
*/
|
33
|
+
|
34
|
+
jest.mock('@instructure/ui-utils', () => {
|
35
|
+
const originalModule = jest.requireActual('@instructure/ui-utils');
|
36
|
+
return {
|
37
|
+
__esModule: true,
|
38
|
+
...originalModule,
|
39
|
+
isSafari: jest.fn(() => true)
|
40
|
+
};
|
41
|
+
});
|
42
|
+
const mockUtils = utils;
|
43
|
+
describe('<SimpleSelect />', () => {
|
44
|
+
const defaultOptions = ['foo', 'bar', 'baz'];
|
45
|
+
const getOptions = disabled => defaultOptions.map(opt => /*#__PURE__*/_react.default.createElement(_index.default.Option, {
|
46
|
+
id: opt,
|
47
|
+
key: opt,
|
48
|
+
value: opt,
|
49
|
+
isDisabled: opt === disabled
|
50
|
+
}, opt));
|
51
|
+
it('should have role button in Safari', async () => {
|
52
|
+
const _render = (0, _react2.render)( /*#__PURE__*/_react.default.createElement(_index.default, {
|
53
|
+
renderLabel: "Choose an option"
|
54
|
+
}, getOptions())),
|
55
|
+
container = _render.container;
|
56
|
+
const input = container.querySelector('input');
|
57
|
+
expect(input).toHaveAttribute('role', 'button');
|
58
|
+
});
|
59
|
+
it('should have role combobox in different browsers than Safari', async () => {
|
60
|
+
mockUtils.isSafari = jest.fn(() => false);
|
61
|
+
const _render2 = (0, _react2.render)( /*#__PURE__*/_react.default.createElement(_index.default, {
|
62
|
+
renderLabel: "Choose an option"
|
63
|
+
}, getOptions())),
|
64
|
+
container = _render2.container;
|
65
|
+
const input = container.querySelector('input');
|
66
|
+
expect(input).toHaveAttribute('role', 'combobox');
|
67
|
+
});
|
68
|
+
});
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@instructure/ui-simple-select",
|
3
|
-
"version": "8.
|
3
|
+
"version": "8.44.0",
|
4
4
|
"description": "A component for standard select element behavior.",
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
6
6
|
"module": "./es/index.js",
|
@@ -24,22 +24,25 @@
|
|
24
24
|
"license": "MIT",
|
25
25
|
"dependencies": {
|
26
26
|
"@babel/runtime": "^7.22.15",
|
27
|
-
"@instructure/console": "8.
|
28
|
-
"@instructure/shared-types": "8.
|
29
|
-
"@instructure/ui-form-field": "8.
|
30
|
-
"@instructure/ui-position": "8.
|
31
|
-
"@instructure/ui-prop-types": "8.
|
32
|
-
"@instructure/ui-react-utils": "8.
|
33
|
-
"@instructure/ui-select": "8.
|
34
|
-
"@instructure/ui-testable": "8.
|
27
|
+
"@instructure/console": "8.44.0",
|
28
|
+
"@instructure/shared-types": "8.44.0",
|
29
|
+
"@instructure/ui-form-field": "8.44.0",
|
30
|
+
"@instructure/ui-position": "8.44.0",
|
31
|
+
"@instructure/ui-prop-types": "8.44.0",
|
32
|
+
"@instructure/ui-react-utils": "8.44.0",
|
33
|
+
"@instructure/ui-select": "8.44.0",
|
34
|
+
"@instructure/ui-testable": "8.44.0",
|
35
35
|
"prop-types": "^15.8.1"
|
36
36
|
},
|
37
37
|
"devDependencies": {
|
38
|
-
"@instructure/ui-babel-preset": "8.
|
39
|
-
"@instructure/ui-color-utils": "8.
|
40
|
-
"@instructure/ui-icons": "8.
|
41
|
-
"@instructure/ui-test-locator": "8.
|
42
|
-
"@instructure/ui-test-utils": "8.
|
38
|
+
"@instructure/ui-babel-preset": "8.44.0",
|
39
|
+
"@instructure/ui-color-utils": "8.44.0",
|
40
|
+
"@instructure/ui-icons": "8.44.0",
|
41
|
+
"@instructure/ui-test-locator": "8.44.0",
|
42
|
+
"@instructure/ui-test-utils": "8.44.0",
|
43
|
+
"@instructure/ui-utils": "8.44.0",
|
44
|
+
"@testing-library/jest-dom": "^5.17.0",
|
45
|
+
"@testing-library/react": "^14.0.0"
|
43
46
|
},
|
44
47
|
"peerDependencies": {
|
45
48
|
"react": ">=16.8 <=18"
|
@@ -0,0 +1,75 @@
|
|
1
|
+
/*
|
2
|
+
* The MIT License (MIT)
|
3
|
+
*
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
5
|
+
*
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
11
|
+
* furnished to do so, subject to the following conditions:
|
12
|
+
*
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
14
|
+
* copies or substantial portions of the Software.
|
15
|
+
*
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
* SOFTWARE.
|
23
|
+
*/
|
24
|
+
import React from 'react'
|
25
|
+
import { render } from '@testing-library/react'
|
26
|
+
import '@testing-library/jest-dom/extend-expect'
|
27
|
+
import SimpleSelect from '../index'
|
28
|
+
import * as utils from '@instructure/ui-utils'
|
29
|
+
|
30
|
+
type ExampleOption = 'foo' | 'bar' | 'baz'
|
31
|
+
jest.mock('@instructure/ui-utils', () => {
|
32
|
+
const originalModule = jest.requireActual('@instructure/ui-utils')
|
33
|
+
|
34
|
+
return {
|
35
|
+
__esModule: true,
|
36
|
+
...originalModule,
|
37
|
+
isSafari: jest.fn(() => true)
|
38
|
+
}
|
39
|
+
})
|
40
|
+
|
41
|
+
const mockUtils = utils as jest.Mocked<typeof utils>
|
42
|
+
|
43
|
+
describe('<SimpleSelect />', () => {
|
44
|
+
const defaultOptions: ExampleOption[] = ['foo', 'bar', 'baz']
|
45
|
+
|
46
|
+
const getOptions = (disabled?: ExampleOption) =>
|
47
|
+
defaultOptions.map((opt) => (
|
48
|
+
<SimpleSelect.Option
|
49
|
+
id={opt}
|
50
|
+
key={opt}
|
51
|
+
value={opt}
|
52
|
+
isDisabled={opt === disabled}
|
53
|
+
>
|
54
|
+
{opt}
|
55
|
+
</SimpleSelect.Option>
|
56
|
+
))
|
57
|
+
|
58
|
+
it('should have role button in Safari', async () => {
|
59
|
+
const { container } = render(
|
60
|
+
<SimpleSelect renderLabel="Choose an option">{getOptions()}</SimpleSelect>
|
61
|
+
)
|
62
|
+
const input = container.querySelector('input')
|
63
|
+
expect(input).toHaveAttribute('role', 'button')
|
64
|
+
})
|
65
|
+
|
66
|
+
it('should have role combobox in different browsers than Safari', async () => {
|
67
|
+
mockUtils.isSafari = jest.fn(() => false)
|
68
|
+
|
69
|
+
const { container } = render(
|
70
|
+
<SimpleSelect renderLabel="Choose an option">{getOptions()}</SimpleSelect>
|
71
|
+
)
|
72
|
+
const input = container.querySelector('input')
|
73
|
+
expect(input).toHaveAttribute('role', 'combobox')
|
74
|
+
})
|
75
|
+
})
|
package/tsconfig.build.json
CHANGED
@@ -19,6 +19,7 @@
|
|
19
19
|
{ "path": "../ui-icons/tsconfig.build.json" },
|
20
20
|
{ "path": "../ui-test-locator/tsconfig.build.json" },
|
21
21
|
{ "path": "../ui-test-utils/tsconfig.build.json" },
|
22
|
-
{ "path": "../shared-types/tsconfig.build.json" }
|
22
|
+
{ "path": "../shared-types/tsconfig.build.json" },
|
23
|
+
{ "path": "../ui-utils/tsconfig.build.json" }
|
23
24
|
]
|
24
25
|
}
|