@instructure/ui-pill 10.19.2-snapshot-2 → 10.19.2-snapshot-4
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 +1 -1
- package/package.json +17 -19
- package/tsconfig.build.json +0 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/es/Pill/PillLocator.js +0 -42
- package/es/Pill/__new-tests__/Pill.test.js +0 -81
- package/es/Pill/locator.js +0 -27
- package/lib/Pill/PillLocator.js +0 -48
- package/lib/Pill/__new-tests__/Pill.test.js +0 -82
- package/lib/Pill/locator.js +0 -37
- package/src/Pill/PillLocator.ts +0 -40
- package/src/Pill/__new-tests__/Pill.test.tsx +0 -77
- package/src/Pill/locator.ts +0 -28
- package/types/Pill/PillLocator.d.ts +0 -320
- package/types/Pill/PillLocator.d.ts.map +0 -1
- package/types/Pill/__new-tests__/Pill.test.d.ts +0 -2
- package/types/Pill/__new-tests__/Pill.test.d.ts.map +0 -1
- package/types/Pill/locator.d.ts +0 -4
- package/types/Pill/locator.d.ts.map +0 -1
package/es/Pill/PillLocator.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
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
|
-
|
|
25
|
-
import { locator } from '@instructure/ui-test-locator';
|
|
26
|
-
import { parseQueryArguments } from '@instructure/ui-test-queries';
|
|
27
|
-
// @ts-ignore: Cannot find module
|
|
28
|
-
// eslint-disable-next-line no-restricted-imports
|
|
29
|
-
import { TooltipLocator } from '@instructure/ui-tooltip/es/Tooltip/TooltipLocator';
|
|
30
|
-
import { Pill } from './index';
|
|
31
|
-
|
|
32
|
-
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
33
|
-
export const PillLocator = locator(Pill.selector, {
|
|
34
|
-
findTooltipContent: async (...args) => {
|
|
35
|
-
const _parseQueryArguments = parseQueryArguments(...args),
|
|
36
|
-
element = _parseQueryArguments.element,
|
|
37
|
-
selector = _parseQueryArguments.selector,
|
|
38
|
-
options = _parseQueryArguments.options;
|
|
39
|
-
const tooltip = await TooltipLocator.find(element, options);
|
|
40
|
-
return tooltip ? tooltip.findContent(selector, options) : null;
|
|
41
|
-
}
|
|
42
|
-
});
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
var _Pill, _Pill2, _Pill3, _Pill4, _Pill5;
|
|
2
|
-
/*
|
|
3
|
-
* The MIT License (MIT)
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
6
|
-
*
|
|
7
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
-
* in the Software without restriction, including without limitation the rights
|
|
10
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
-
* furnished to do so, subject to the following conditions:
|
|
13
|
-
*
|
|
14
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
-
* copies or substantial portions of the Software.
|
|
16
|
-
*
|
|
17
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
-
* SOFTWARE.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
import { render } from '@testing-library/react';
|
|
27
|
-
import '@testing-library/jest-dom';
|
|
28
|
-
import { runAxeCheck } from '@instructure/ui-axe-check';
|
|
29
|
-
import { Pill } from '../index';
|
|
30
|
-
import { IconEyeLine } from '@instructure/ui-icons';
|
|
31
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
32
|
-
describe('<Pill />', () => {
|
|
33
|
-
it('should render', async () => {
|
|
34
|
-
const _render = render(_Pill || (_Pill = _jsx(Pill, {
|
|
35
|
-
children: "Overdue"
|
|
36
|
-
}))),
|
|
37
|
-
container = _render.container;
|
|
38
|
-
const pill = container.querySelector('div[class$="-pill"]');
|
|
39
|
-
expect(pill).toBeInTheDocument();
|
|
40
|
-
expect(pill).toHaveTextContent('Overdue');
|
|
41
|
-
});
|
|
42
|
-
it('should display text', async () => {
|
|
43
|
-
const _render2 = render(_Pill2 || (_Pill2 = _jsx(Pill, {
|
|
44
|
-
children: "Overdue"
|
|
45
|
-
}))),
|
|
46
|
-
container = _render2.container;
|
|
47
|
-
expect(container).toHaveTextContent('Overdue');
|
|
48
|
-
});
|
|
49
|
-
it('should display status text', async () => {
|
|
50
|
-
const _render3 = render(_Pill3 || (_Pill3 = _jsx(Pill, {
|
|
51
|
-
statusLabel: "Statuslabel",
|
|
52
|
-
children: "Overdue"
|
|
53
|
-
}))),
|
|
54
|
-
container = _render3.container;
|
|
55
|
-
expect(container).toHaveTextContent('Statuslabel:');
|
|
56
|
-
expect(container).toHaveTextContent('Overdue');
|
|
57
|
-
});
|
|
58
|
-
it('should render icon text', async () => {
|
|
59
|
-
const _render4 = render(_Pill4 || (_Pill4 = _jsx(Pill, {
|
|
60
|
-
statusLabel: "Statuslabel",
|
|
61
|
-
renderIcon: _jsx(IconEyeLine, {
|
|
62
|
-
color: "auto",
|
|
63
|
-
title: "Love"
|
|
64
|
-
}),
|
|
65
|
-
children: "Overdue"
|
|
66
|
-
}))),
|
|
67
|
-
container = _render4.container;
|
|
68
|
-
const svg = container.querySelector('svg');
|
|
69
|
-
expect(container).toHaveTextContent('Statuslabel:');
|
|
70
|
-
expect(container).toHaveTextContent('Overdue');
|
|
71
|
-
expect(svg).toHaveAttribute('name', 'IconEye');
|
|
72
|
-
});
|
|
73
|
-
it('should be accessible', async () => {
|
|
74
|
-
const _render5 = render(_Pill5 || (_Pill5 = _jsx(Pill, {
|
|
75
|
-
children: "Overdue"
|
|
76
|
-
}))),
|
|
77
|
-
container = _render5.container;
|
|
78
|
-
const axeCheck = await runAxeCheck(container);
|
|
79
|
-
expect(axeCheck).toBe(true);
|
|
80
|
-
});
|
|
81
|
-
});
|
package/es/Pill/locator.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
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
|
-
|
|
25
|
-
import { PillLocator } from './PillLocator';
|
|
26
|
-
export { PillLocator };
|
|
27
|
-
export default PillLocator;
|
package/lib/Pill/PillLocator.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.PillLocator = void 0;
|
|
7
|
-
var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
|
|
8
|
-
var _uiTestQueries = require("@instructure/ui-test-queries");
|
|
9
|
-
var _TooltipLocator = require("@instructure/ui-tooltip/lib/Tooltip/TooltipLocator");
|
|
10
|
-
var _index = require("./index");
|
|
11
|
-
/*
|
|
12
|
-
* The MIT License (MIT)
|
|
13
|
-
*
|
|
14
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
15
|
-
*
|
|
16
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
17
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
18
|
-
* in the Software without restriction, including without limitation the rights
|
|
19
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
20
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
21
|
-
* furnished to do so, subject to the following conditions:
|
|
22
|
-
*
|
|
23
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
24
|
-
* copies or substantial portions of the Software.
|
|
25
|
-
*
|
|
26
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
27
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
28
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
29
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
30
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
31
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
32
|
-
* SOFTWARE.
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
// @ts-ignore: Cannot find module
|
|
36
|
-
// eslint-disable-next-line no-restricted-imports
|
|
37
|
-
|
|
38
|
-
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
39
|
-
const PillLocator = exports.PillLocator = (0, _locator.locator)(_index.Pill.selector, {
|
|
40
|
-
findTooltipContent: async (...args) => {
|
|
41
|
-
const _parseQueryArguments = (0, _uiTestQueries.parseQueryArguments)(...args),
|
|
42
|
-
element = _parseQueryArguments.element,
|
|
43
|
-
selector = _parseQueryArguments.selector,
|
|
44
|
-
options = _parseQueryArguments.options;
|
|
45
|
-
const tooltip = await _TooltipLocator.TooltipLocator.find(element, options);
|
|
46
|
-
return tooltip ? tooltip.findContent(selector, options) : null;
|
|
47
|
-
}
|
|
48
|
-
});
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _react = require("@testing-library/react");
|
|
4
|
-
require("@testing-library/jest-dom");
|
|
5
|
-
var _runAxeCheck = require("@instructure/ui-axe-check/lib/runAxeCheck.js");
|
|
6
|
-
var _index = require("../index");
|
|
7
|
-
var _IconEyeLine = require("@instructure/ui-icons/lib/IconEyeLine.js");
|
|
8
|
-
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
9
|
-
var _Pill, _Pill2, _Pill3, _Pill4, _Pill5;
|
|
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
|
-
describe('<Pill />', () => {
|
|
34
|
-
it('should render', async () => {
|
|
35
|
-
const _render = (0, _react.render)(_Pill || (_Pill = (0, _jsxRuntime.jsx)(_index.Pill, {
|
|
36
|
-
children: "Overdue"
|
|
37
|
-
}))),
|
|
38
|
-
container = _render.container;
|
|
39
|
-
const pill = container.querySelector('div[class$="-pill"]');
|
|
40
|
-
expect(pill).toBeInTheDocument();
|
|
41
|
-
expect(pill).toHaveTextContent('Overdue');
|
|
42
|
-
});
|
|
43
|
-
it('should display text', async () => {
|
|
44
|
-
const _render2 = (0, _react.render)(_Pill2 || (_Pill2 = (0, _jsxRuntime.jsx)(_index.Pill, {
|
|
45
|
-
children: "Overdue"
|
|
46
|
-
}))),
|
|
47
|
-
container = _render2.container;
|
|
48
|
-
expect(container).toHaveTextContent('Overdue');
|
|
49
|
-
});
|
|
50
|
-
it('should display status text', async () => {
|
|
51
|
-
const _render3 = (0, _react.render)(_Pill3 || (_Pill3 = (0, _jsxRuntime.jsx)(_index.Pill, {
|
|
52
|
-
statusLabel: "Statuslabel",
|
|
53
|
-
children: "Overdue"
|
|
54
|
-
}))),
|
|
55
|
-
container = _render3.container;
|
|
56
|
-
expect(container).toHaveTextContent('Statuslabel:');
|
|
57
|
-
expect(container).toHaveTextContent('Overdue');
|
|
58
|
-
});
|
|
59
|
-
it('should render icon text', async () => {
|
|
60
|
-
const _render4 = (0, _react.render)(_Pill4 || (_Pill4 = (0, _jsxRuntime.jsx)(_index.Pill, {
|
|
61
|
-
statusLabel: "Statuslabel",
|
|
62
|
-
renderIcon: (0, _jsxRuntime.jsx)(_IconEyeLine.IconEyeLine, {
|
|
63
|
-
color: "auto",
|
|
64
|
-
title: "Love"
|
|
65
|
-
}),
|
|
66
|
-
children: "Overdue"
|
|
67
|
-
}))),
|
|
68
|
-
container = _render4.container;
|
|
69
|
-
const svg = container.querySelector('svg');
|
|
70
|
-
expect(container).toHaveTextContent('Statuslabel:');
|
|
71
|
-
expect(container).toHaveTextContent('Overdue');
|
|
72
|
-
expect(svg).toHaveAttribute('name', 'IconEye');
|
|
73
|
-
});
|
|
74
|
-
it('should be accessible', async () => {
|
|
75
|
-
const _render5 = (0, _react.render)(_Pill5 || (_Pill5 = (0, _jsxRuntime.jsx)(_index.Pill, {
|
|
76
|
-
children: "Overdue"
|
|
77
|
-
}))),
|
|
78
|
-
container = _render5.container;
|
|
79
|
-
const axeCheck = await (0, _runAxeCheck.runAxeCheck)(container);
|
|
80
|
-
expect(axeCheck).toBe(true);
|
|
81
|
-
});
|
|
82
|
-
});
|
package/lib/Pill/locator.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "PillLocator", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _PillLocator.PillLocator;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
exports.default = void 0;
|
|
13
|
-
var _PillLocator = require("./PillLocator");
|
|
14
|
-
/*
|
|
15
|
-
* The MIT License (MIT)
|
|
16
|
-
*
|
|
17
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
18
|
-
*
|
|
19
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
20
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
21
|
-
* in the Software without restriction, including without limitation the rights
|
|
22
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
23
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
24
|
-
* furnished to do so, subject to the following conditions:
|
|
25
|
-
*
|
|
26
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
27
|
-
* copies or substantial portions of the Software.
|
|
28
|
-
*
|
|
29
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
30
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
31
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
32
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
33
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
34
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
35
|
-
* SOFTWARE.
|
|
36
|
-
*/
|
|
37
|
-
var _default = exports.default = _PillLocator.PillLocator;
|
package/src/Pill/PillLocator.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
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
|
-
|
|
25
|
-
import { locator } from '@instructure/ui-test-locator'
|
|
26
|
-
import { parseQueryArguments } from '@instructure/ui-test-queries'
|
|
27
|
-
// @ts-ignore: Cannot find module
|
|
28
|
-
// eslint-disable-next-line no-restricted-imports
|
|
29
|
-
import { TooltipLocator } from '@instructure/ui-tooltip/es/Tooltip/TooltipLocator'
|
|
30
|
-
|
|
31
|
-
import { Pill } from './index'
|
|
32
|
-
|
|
33
|
-
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
34
|
-
export const PillLocator = locator(Pill.selector, {
|
|
35
|
-
findTooltipContent: async (...args: any[]) => {
|
|
36
|
-
const { element, selector, options } = parseQueryArguments(...args)
|
|
37
|
-
const tooltip = await TooltipLocator.find(element, options)
|
|
38
|
-
return tooltip ? tooltip.findContent(selector, options) : null
|
|
39
|
-
}
|
|
40
|
-
})
|
|
@@ -1,77 +0,0 @@
|
|
|
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
|
-
|
|
25
|
-
import { render } from '@testing-library/react'
|
|
26
|
-
import '@testing-library/jest-dom'
|
|
27
|
-
|
|
28
|
-
import { runAxeCheck } from '@instructure/ui-axe-check'
|
|
29
|
-
import { Pill } from '../index'
|
|
30
|
-
import { IconEyeLine } from '@instructure/ui-icons'
|
|
31
|
-
|
|
32
|
-
describe('<Pill />', () => {
|
|
33
|
-
it('should render', async () => {
|
|
34
|
-
const { container } = render(<Pill>Overdue</Pill>)
|
|
35
|
-
const pill = container.querySelector('div[class$="-pill"]')
|
|
36
|
-
|
|
37
|
-
expect(pill).toBeInTheDocument()
|
|
38
|
-
expect(pill).toHaveTextContent('Overdue')
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
it('should display text', async () => {
|
|
42
|
-
const { container } = render(<Pill>Overdue</Pill>)
|
|
43
|
-
|
|
44
|
-
expect(container).toHaveTextContent('Overdue')
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
it('should display status text', async () => {
|
|
48
|
-
const { container } = render(<Pill statusLabel="Statuslabel">Overdue</Pill>)
|
|
49
|
-
|
|
50
|
-
expect(container).toHaveTextContent('Statuslabel:')
|
|
51
|
-
expect(container).toHaveTextContent('Overdue')
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
it('should render icon text', async () => {
|
|
55
|
-
const { container } = render(
|
|
56
|
-
<Pill
|
|
57
|
-
statusLabel="Statuslabel"
|
|
58
|
-
renderIcon={<IconEyeLine color="auto" title="Love" />}
|
|
59
|
-
>
|
|
60
|
-
Overdue
|
|
61
|
-
</Pill>
|
|
62
|
-
)
|
|
63
|
-
|
|
64
|
-
const svg = container.querySelector('svg')
|
|
65
|
-
|
|
66
|
-
expect(container).toHaveTextContent('Statuslabel:')
|
|
67
|
-
expect(container).toHaveTextContent('Overdue')
|
|
68
|
-
expect(svg).toHaveAttribute('name', 'IconEye')
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
it('should be accessible', async () => {
|
|
72
|
-
const { container } = render(<Pill>Overdue</Pill>)
|
|
73
|
-
const axeCheck = await runAxeCheck(container)
|
|
74
|
-
|
|
75
|
-
expect(axeCheck).toBe(true)
|
|
76
|
-
})
|
|
77
|
-
})
|
package/src/Pill/locator.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
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
|
-
|
|
25
|
-
import { PillLocator } from './PillLocator'
|
|
26
|
-
|
|
27
|
-
export { PillLocator }
|
|
28
|
-
export default PillLocator
|