@instructure/ui-modal 10.19.2-snapshot-3 → 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.
@@ -1,111 +0,0 @@
1
- var _ModalBody, _ModalBody2, _ModalBody3;
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 { vi } from 'vitest';
28
- import '@testing-library/jest-dom';
29
- import { color2hex } from '@instructure/ui-color-utils';
30
- import canvas from '@instructure/ui-themes';
31
- import { View } from '@instructure/ui-view';
32
- import { ModalBody } from '../index';
33
- import generateComponentTheme from '../theme';
34
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
35
- const BODY_TEXT = 'Modal-body-text';
36
- describe('<ModalBody />', () => {
37
- it('should render', async () => {
38
- const _render = render(_ModalBody || (_ModalBody = _jsx(ModalBody, {
39
- children: BODY_TEXT
40
- }))),
41
- findByText = _render.findByText;
42
- const modalBody = await findByText(BODY_TEXT);
43
- expect(modalBody).toBeInTheDocument();
44
- });
45
- it('should set inverse styles', async () => {
46
- const themeVariables = generateComponentTheme(canvas);
47
- const _render2 = render(_ModalBody2 || (_ModalBody2 = _jsx(ModalBody, {
48
- variant: "inverse",
49
- children: BODY_TEXT
50
- }))),
51
- findByText = _render2.findByText;
52
- const modalBody = await findByText(BODY_TEXT);
53
- const modalBodyStyle = window.getComputedStyle(modalBody);
54
- const bodyBackground = color2hex(modalBodyStyle.getPropertyValue('background-color'));
55
- expect(modalBody).toBeInTheDocument();
56
- expect(bodyBackground).toBe(themeVariables.inverseBackground);
57
- });
58
- it('should set the same width and height as the parent when overflow is set to fit', async () => {
59
- const _render3 = render(_jsx("div", {
60
- style: {
61
- width: '500px',
62
- height: '600px'
63
- },
64
- children: _ModalBody3 || (_ModalBody3 = _jsx(ModalBody, {
65
- overflow: "fit",
66
- children: BODY_TEXT
67
- }))
68
- })),
69
- findByText = _render3.findByText;
70
- const modalBody = await findByText(BODY_TEXT);
71
- const modalBodyStyle = window.getComputedStyle(modalBody);
72
- expect(modalBodyStyle.width).toBe('100%');
73
- expect(modalBodyStyle.height).toBe('100%');
74
- });
75
- describe('when passing down props to View', () => {
76
- const allowedProps = {
77
- padding: 'small',
78
- elementRef: () => {},
79
- as: 'section'
80
- };
81
- const allProps = View.allowedProps.filter(prop => prop !== 'children');
82
- allProps.forEach(prop => {
83
- if (prop in allowedProps) {
84
- it(`should allow the '${prop}' prop`, () => {
85
- const consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
86
- const props = {
87
- [prop]: allowedProps[prop]
88
- };
89
- render(_jsx(ModalBody, {
90
- ...props
91
- }));
92
- expect(consoleErrorSpy).not.toHaveBeenCalled();
93
- consoleErrorSpy.mockRestore();
94
- });
95
- } else {
96
- it(`should NOT allow the '${prop}' prop`, () => {
97
- const expectedErrorMessage = `prop '${prop}' is not allowed.`;
98
- const consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
99
- const props = {
100
- [prop]: 'NOT_ALLOWED_VALUE'
101
- };
102
- render(_jsx(ModalBody, {
103
- ...props
104
- }));
105
- expect(consoleErrorSpy).toHaveBeenCalledWith(expect.stringContaining(expectedErrorMessage), expect.any(String));
106
- consoleErrorSpy.mockRestore();
107
- });
108
- }
109
- });
110
- });
111
- });
@@ -1,58 +0,0 @@
1
- var _ModalFooter, _ModalFooter2;
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 canvas from '@instructure/ui-themes';
29
- import { color2hex } from '@instructure/ui-color-utils';
30
- import { ModalFooter } from '../index';
31
- import generateComponentTheme from '../theme';
32
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
33
- const FOOTER_TEXT = 'Modal-footer-text';
34
- describe('<ModalFooter />', () => {
35
- it('should render', async () => {
36
- const _render = render(_ModalFooter || (_ModalFooter = _jsx(ModalFooter, {
37
- children: FOOTER_TEXT
38
- }))),
39
- findByText = _render.findByText;
40
- const modalFooter = await findByText(FOOTER_TEXT);
41
- expect(modalFooter).toBeInTheDocument();
42
- });
43
- it('should set inverse styles', async () => {
44
- const themeVariables = generateComponentTheme(canvas);
45
- const _render2 = render(_ModalFooter2 || (_ModalFooter2 = _jsx(ModalFooter, {
46
- variant: "inverse",
47
- children: FOOTER_TEXT
48
- }))),
49
- findByText = _render2.findByText;
50
- const modalFooter = await findByText(FOOTER_TEXT);
51
- const modalFooterStyle = window.getComputedStyle(modalFooter);
52
- const footerBackground = color2hex(modalFooterStyle.getPropertyValue('background-color'));
53
- const footerBorderColor = color2hex(modalFooterStyle.getPropertyValue('border-top-color'));
54
- expect(modalFooter).toBeInTheDocument();
55
- expect(footerBackground).toBe(themeVariables.inverseBackground);
56
- expect(footerBorderColor).toBe(themeVariables.inverseBorderColor);
57
- });
58
- });
@@ -1,98 +0,0 @@
1
- var _ModalHeader, _ModalHeader2, _ModalHeader3, _ModalHeader4, _ModalHeader5;
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 canvas from '@instructure/ui-themes';
29
- import { color2hex } from '@instructure/ui-color-utils';
30
- import { ModalHeader } from '../index';
31
- import generateComponentTheme from '../theme';
32
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
33
- const HEADER_TEXT = 'Modal-footer-text';
34
- describe('<ModalHeader />', () => {
35
- it('should render', async () => {
36
- const _render = render(_ModalHeader || (_ModalHeader = _jsx(ModalHeader, {
37
- children: HEADER_TEXT
38
- }))),
39
- findByText = _render.findByText;
40
- const modalHeader = await findByText(HEADER_TEXT);
41
- expect(modalHeader).toBeInTheDocument();
42
- });
43
- it('should set inverse styles', async () => {
44
- const themeVariables = generateComponentTheme(canvas);
45
- const _render2 = render(_ModalHeader2 || (_ModalHeader2 = _jsx(ModalHeader, {
46
- variant: "inverse",
47
- children: HEADER_TEXT
48
- }))),
49
- findByText = _render2.findByText;
50
- const modalHeader = await findByText(HEADER_TEXT);
51
- const modalHeaderStyle = window.getComputedStyle(modalHeader);
52
- const headerBackground = color2hex(modalHeaderStyle.getPropertyValue('background-color'));
53
- const headerBorderColor = color2hex(modalHeaderStyle.getPropertyValue('border-bottom-color'));
54
- expect(modalHeader).toBeInTheDocument();
55
- expect(headerBackground).toBe(themeVariables.inverseBackground);
56
- expect(headerBorderColor).toBe(themeVariables.inverseBorderColor);
57
- });
58
- describe('spacing prop', () => {
59
- it('should be correct by default', async () => {
60
- const themeVariables = generateComponentTheme(canvas);
61
- const _render3 = render(_ModalHeader3 || (_ModalHeader3 = _jsx(ModalHeader, {
62
- children: HEADER_TEXT
63
- }))),
64
- findByText = _render3.findByText;
65
- const modalHeader = await findByText(HEADER_TEXT);
66
- const modalHeaderStyle = window.getComputedStyle(modalHeader);
67
- const headerPadding = modalHeaderStyle.padding;
68
- expect(modalHeader).toBeInTheDocument();
69
- expect(headerPadding).toBe(themeVariables.padding);
70
- });
71
- it('should correctly set default spacing', async () => {
72
- const themeVariables = generateComponentTheme(canvas);
73
- const _render4 = render(_ModalHeader4 || (_ModalHeader4 = _jsx(ModalHeader, {
74
- spacing: "default",
75
- children: HEADER_TEXT
76
- }))),
77
- findByText = _render4.findByText;
78
- const modalHeader = await findByText(HEADER_TEXT);
79
- const modalHeaderStyle = window.getComputedStyle(modalHeader);
80
- const headerPadding = modalHeaderStyle.padding;
81
- expect(modalHeader).toBeInTheDocument();
82
- expect(headerPadding).toBe(themeVariables.padding);
83
- });
84
- it('should correctly set compact spacing', async () => {
85
- const themeVariables = generateComponentTheme(canvas);
86
- const _render5 = render(_ModalHeader5 || (_ModalHeader5 = _jsx(ModalHeader, {
87
- spacing: "compact",
88
- children: HEADER_TEXT
89
- }))),
90
- findByText = _render5.findByText;
91
- const modalHeader = await findByText(HEADER_TEXT);
92
- const modalHeaderStyle = window.getComputedStyle(modalHeader);
93
- const headerPadding = modalHeaderStyle.padding;
94
- expect(modalHeader).toBeInTheDocument();
95
- expect(headerPadding).toBe(themeVariables.paddingCompact);
96
- });
97
- });
98
- });