@instructure/ui-billboard 9.2.1-snapshot-0 → 9.2.1-snapshot-2
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/README.md +2 -2
- package/es/Billboard/__new-tests__/Billboard.test.js +17 -7
- package/lib/Billboard/__new-tests__/Billboard.test.js +17 -7
- package/package.json +15 -14
- package/src/Billboard/__new-tests__/Billboard.test.tsx +24 -9
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Billboard/__new-tests__/Billboard.test.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
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
|
-
## [9.2.1-snapshot-
|
|
6
|
+
## [9.2.1-snapshot-2](https://github.com/instructure/instructure-ui/compare/v9.2.0...v9.2.1-snapshot-2) (2024-07-10)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @instructure/ui-billboard
|
|
9
9
|
|
package/README.md
CHANGED
|
@@ -4,8 +4,8 @@ category: packages
|
|
|
4
4
|
|
|
5
5
|
## ui-billboard
|
|
6
6
|
|
|
7
|
-
[![npm][npm]][npm-url]
|
|
8
|
-
[![MIT License][license-badge]][license]
|
|
7
|
+
[![npm][npm]][npm-url]
|
|
8
|
+
[![MIT License][license-badge]][license]
|
|
9
9
|
[![Code of Conduct][coc-badge]][coc]
|
|
10
10
|
|
|
11
11
|
A billboard component for empty states, 404 pages, redirects, etc.
|
|
@@ -25,6 +25,7 @@ var _IconUserLine, _Billboard, _Billboard2, _Billboard3, _Billboard4, _span, _sp
|
|
|
25
25
|
|
|
26
26
|
import React from 'react';
|
|
27
27
|
import { fireEvent, render, screen } from '@testing-library/react';
|
|
28
|
+
import { vi } from 'vitest';
|
|
28
29
|
import userEvent from '@testing-library/user-event';
|
|
29
30
|
import '@testing-library/jest-dom';
|
|
30
31
|
import { Billboard } from '../index';
|
|
@@ -37,6 +38,17 @@ const TEST_HERO = () => _IconUserLine || (_IconUserLine = /*#__PURE__*/React.cre
|
|
|
37
38
|
size: 'medium'
|
|
38
39
|
}));
|
|
39
40
|
describe('<Billboard />', () => {
|
|
41
|
+
let consoleWarningMock;
|
|
42
|
+
let consoleErrorMock;
|
|
43
|
+
beforeEach(() => {
|
|
44
|
+
// Mocking console to prevent test output pollution
|
|
45
|
+
consoleWarningMock = vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
46
|
+
consoleErrorMock = vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
47
|
+
});
|
|
48
|
+
afterEach(() => {
|
|
49
|
+
consoleWarningMock.mockRestore();
|
|
50
|
+
consoleErrorMock.mockRestore();
|
|
51
|
+
});
|
|
40
52
|
it('should render', () => {
|
|
41
53
|
const _render = render(_Billboard || (_Billboard = /*#__PURE__*/React.createElement(Billboard, null))),
|
|
42
54
|
container = _render.container;
|
|
@@ -70,7 +82,7 @@ describe('<Billboard />', () => {
|
|
|
70
82
|
expect(link).toHaveAttribute('href', TEST_LINK);
|
|
71
83
|
});
|
|
72
84
|
it('renders as a button and responds to onClick event', () => {
|
|
73
|
-
const onClick =
|
|
85
|
+
const onClick = vi.fn();
|
|
74
86
|
render( /*#__PURE__*/React.createElement(Billboard, {
|
|
75
87
|
onClick: onClick
|
|
76
88
|
}));
|
|
@@ -108,14 +120,12 @@ describe('<Billboard />', () => {
|
|
|
108
120
|
expect(link).toHaveAttribute('aria-disabled', 'true');
|
|
109
121
|
});
|
|
110
122
|
it('should not be clickable', () => {
|
|
111
|
-
const onClick = jest.fn();
|
|
112
123
|
render( /*#__PURE__*/React.createElement(Billboard, {
|
|
113
|
-
onClick:
|
|
124
|
+
onClick: vi.fn(),
|
|
114
125
|
disabled: true
|
|
115
126
|
}));
|
|
116
127
|
const button = screen.getByRole('button');
|
|
117
|
-
|
|
118
|
-
expect(onClick).not.toHaveBeenCalled();
|
|
128
|
+
expect(button).toHaveAttribute('aria-disabled', 'true');
|
|
119
129
|
});
|
|
120
130
|
});
|
|
121
131
|
describe('when readOnly', () => {
|
|
@@ -128,7 +138,7 @@ describe('<Billboard />', () => {
|
|
|
128
138
|
expect(link).toHaveAttribute('aria-disabled', 'true');
|
|
129
139
|
});
|
|
130
140
|
it('should not be clickable', () => {
|
|
131
|
-
const onClick =
|
|
141
|
+
const onClick = vi.fn();
|
|
132
142
|
render( /*#__PURE__*/React.createElement(Billboard, {
|
|
133
143
|
onClick: onClick,
|
|
134
144
|
readOnly: true
|
|
@@ -140,7 +150,7 @@ describe('<Billboard />', () => {
|
|
|
140
150
|
});
|
|
141
151
|
describe('when passing down props to View', () => {
|
|
142
152
|
it('should support an elementRef prop', () => {
|
|
143
|
-
const elementRef =
|
|
153
|
+
const elementRef = vi.fn();
|
|
144
154
|
render( /*#__PURE__*/React.createElement(Billboard, {
|
|
145
155
|
elementRef: elementRef,
|
|
146
156
|
href: TEST_LINK
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
var _react = _interopRequireDefault(require("react"));
|
|
5
5
|
var _react2 = require("@testing-library/react");
|
|
6
|
+
var _vitest = require("vitest");
|
|
6
7
|
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
7
8
|
require("@testing-library/jest-dom");
|
|
8
9
|
var _index = require("../index");
|
|
@@ -39,6 +40,17 @@ const TEST_HERO = () => _IconUserLine || (_IconUserLine = /*#__PURE__*/_react.de
|
|
|
39
40
|
size: 'medium'
|
|
40
41
|
}));
|
|
41
42
|
describe('<Billboard />', () => {
|
|
43
|
+
let consoleWarningMock;
|
|
44
|
+
let consoleErrorMock;
|
|
45
|
+
beforeEach(() => {
|
|
46
|
+
// Mocking console to prevent test output pollution
|
|
47
|
+
consoleWarningMock = _vitest.vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
48
|
+
consoleErrorMock = _vitest.vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
49
|
+
});
|
|
50
|
+
afterEach(() => {
|
|
51
|
+
consoleWarningMock.mockRestore();
|
|
52
|
+
consoleErrorMock.mockRestore();
|
|
53
|
+
});
|
|
42
54
|
it('should render', () => {
|
|
43
55
|
const _render = (0, _react2.render)(_Billboard || (_Billboard = /*#__PURE__*/_react.default.createElement(_index.Billboard, null))),
|
|
44
56
|
container = _render.container;
|
|
@@ -72,7 +84,7 @@ describe('<Billboard />', () => {
|
|
|
72
84
|
expect(link).toHaveAttribute('href', TEST_LINK);
|
|
73
85
|
});
|
|
74
86
|
it('renders as a button and responds to onClick event', () => {
|
|
75
|
-
const onClick =
|
|
87
|
+
const onClick = _vitest.vi.fn();
|
|
76
88
|
(0, _react2.render)( /*#__PURE__*/_react.default.createElement(_index.Billboard, {
|
|
77
89
|
onClick: onClick
|
|
78
90
|
}));
|
|
@@ -110,14 +122,12 @@ describe('<Billboard />', () => {
|
|
|
110
122
|
expect(link).toHaveAttribute('aria-disabled', 'true');
|
|
111
123
|
});
|
|
112
124
|
it('should not be clickable', () => {
|
|
113
|
-
const onClick = jest.fn();
|
|
114
125
|
(0, _react2.render)( /*#__PURE__*/_react.default.createElement(_index.Billboard, {
|
|
115
|
-
onClick:
|
|
126
|
+
onClick: _vitest.vi.fn(),
|
|
116
127
|
disabled: true
|
|
117
128
|
}));
|
|
118
129
|
const button = _react2.screen.getByRole('button');
|
|
119
|
-
|
|
120
|
-
expect(onClick).not.toHaveBeenCalled();
|
|
130
|
+
expect(button).toHaveAttribute('aria-disabled', 'true');
|
|
121
131
|
});
|
|
122
132
|
});
|
|
123
133
|
describe('when readOnly', () => {
|
|
@@ -130,7 +140,7 @@ describe('<Billboard />', () => {
|
|
|
130
140
|
expect(link).toHaveAttribute('aria-disabled', 'true');
|
|
131
141
|
});
|
|
132
142
|
it('should not be clickable', () => {
|
|
133
|
-
const onClick =
|
|
143
|
+
const onClick = _vitest.vi.fn();
|
|
134
144
|
(0, _react2.render)( /*#__PURE__*/_react.default.createElement(_index.Billboard, {
|
|
135
145
|
onClick: onClick,
|
|
136
146
|
readOnly: true
|
|
@@ -142,7 +152,7 @@ describe('<Billboard />', () => {
|
|
|
142
152
|
});
|
|
143
153
|
describe('when passing down props to View', () => {
|
|
144
154
|
it('should support an elementRef prop', () => {
|
|
145
|
-
const elementRef =
|
|
155
|
+
const elementRef = _vitest.vi.fn();
|
|
146
156
|
(0, _react2.render)( /*#__PURE__*/_react.default.createElement(_index.Billboard, {
|
|
147
157
|
elementRef: elementRef,
|
|
148
158
|
href: TEST_LINK
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-billboard",
|
|
3
|
-
"version": "9.2.1-snapshot-
|
|
3
|
+
"version": "9.2.1-snapshot-2",
|
|
4
4
|
"description": "A UI component to display empty states, 404 pages, redirects, etc.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -23,24 +23,25 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-axe-check": "9.2.1-snapshot-
|
|
27
|
-
"@instructure/ui-babel-preset": "9.2.1-snapshot-
|
|
28
|
-
"@instructure/ui-color-utils": "9.2.1-snapshot-
|
|
29
|
-
"@instructure/ui-icons": "9.2.1-snapshot-
|
|
30
|
-
"@instructure/ui-test-utils": "9.2.1-snapshot-
|
|
31
|
-
"@instructure/ui-themes": "9.2.1-snapshot-
|
|
26
|
+
"@instructure/ui-axe-check": "9.2.1-snapshot-2",
|
|
27
|
+
"@instructure/ui-babel-preset": "9.2.1-snapshot-2",
|
|
28
|
+
"@instructure/ui-color-utils": "9.2.1-snapshot-2",
|
|
29
|
+
"@instructure/ui-icons": "9.2.1-snapshot-2",
|
|
30
|
+
"@instructure/ui-test-utils": "9.2.1-snapshot-2",
|
|
31
|
+
"@instructure/ui-themes": "9.2.1-snapshot-2",
|
|
32
32
|
"@testing-library/jest-dom": "^6.4.5",
|
|
33
33
|
"@testing-library/react": "^15.0.7",
|
|
34
|
-
"@testing-library/user-event": "^14.5.2"
|
|
34
|
+
"@testing-library/user-event": "^14.5.2",
|
|
35
|
+
"vitest": "^1.6.0"
|
|
35
36
|
},
|
|
36
37
|
"dependencies": {
|
|
37
38
|
"@babel/runtime": "^7.24.5",
|
|
38
|
-
"@instructure/emotion": "9.2.1-snapshot-
|
|
39
|
-
"@instructure/shared-types": "9.2.1-snapshot-
|
|
40
|
-
"@instructure/ui-heading": "9.2.1-snapshot-
|
|
41
|
-
"@instructure/ui-img": "9.2.1-snapshot-
|
|
42
|
-
"@instructure/ui-react-utils": "9.2.1-snapshot-
|
|
43
|
-
"@instructure/ui-view": "9.2.1-snapshot-
|
|
39
|
+
"@instructure/emotion": "9.2.1-snapshot-2",
|
|
40
|
+
"@instructure/shared-types": "9.2.1-snapshot-2",
|
|
41
|
+
"@instructure/ui-heading": "9.2.1-snapshot-2",
|
|
42
|
+
"@instructure/ui-img": "9.2.1-snapshot-2",
|
|
43
|
+
"@instructure/ui-react-utils": "9.2.1-snapshot-2",
|
|
44
|
+
"@instructure/ui-view": "9.2.1-snapshot-2",
|
|
44
45
|
"prop-types": "^15.8.1"
|
|
45
46
|
},
|
|
46
47
|
"peerDependencies": {
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
import React from 'react'
|
|
26
26
|
import { fireEvent, render, screen } from '@testing-library/react'
|
|
27
|
+
import { vi } from 'vitest'
|
|
27
28
|
import userEvent from '@testing-library/user-event'
|
|
28
29
|
import '@testing-library/jest-dom'
|
|
29
30
|
|
|
@@ -37,6 +38,24 @@ const TEST_LINK = 'http://instructure-test.com'
|
|
|
37
38
|
const TEST_HERO = () => <IconUserLine size={'medium'} />
|
|
38
39
|
|
|
39
40
|
describe('<Billboard />', () => {
|
|
41
|
+
let consoleWarningMock: ReturnType<typeof vi.spyOn>
|
|
42
|
+
let consoleErrorMock: ReturnType<typeof vi.spyOn>
|
|
43
|
+
|
|
44
|
+
beforeEach(() => {
|
|
45
|
+
// Mocking console to prevent test output pollution
|
|
46
|
+
consoleWarningMock = vi
|
|
47
|
+
.spyOn(console, 'warn')
|
|
48
|
+
.mockImplementation(() => {}) as any
|
|
49
|
+
consoleErrorMock = vi
|
|
50
|
+
.spyOn(console, 'error')
|
|
51
|
+
.mockImplementation(() => {}) as any
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
afterEach(() => {
|
|
55
|
+
consoleWarningMock.mockRestore()
|
|
56
|
+
consoleErrorMock.mockRestore()
|
|
57
|
+
})
|
|
58
|
+
|
|
40
59
|
it('should render', () => {
|
|
41
60
|
const { container } = render(<Billboard />)
|
|
42
61
|
|
|
@@ -74,7 +93,7 @@ describe('<Billboard />', () => {
|
|
|
74
93
|
})
|
|
75
94
|
|
|
76
95
|
it('renders as a button and responds to onClick event', () => {
|
|
77
|
-
const onClick =
|
|
96
|
+
const onClick = vi.fn()
|
|
78
97
|
|
|
79
98
|
render(<Billboard onClick={onClick} />)
|
|
80
99
|
const button = screen.getByRole('button')
|
|
@@ -115,14 +134,10 @@ describe('<Billboard />', () => {
|
|
|
115
134
|
})
|
|
116
135
|
|
|
117
136
|
it('should not be clickable', () => {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
render(<Billboard onClick={onClick} disabled />)
|
|
137
|
+
render(<Billboard onClick={vi.fn()} disabled />)
|
|
121
138
|
const button = screen.getByRole('button')
|
|
122
139
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
expect(onClick).not.toHaveBeenCalled()
|
|
140
|
+
expect(button).toHaveAttribute('aria-disabled', 'true')
|
|
126
141
|
})
|
|
127
142
|
})
|
|
128
143
|
|
|
@@ -135,7 +150,7 @@ describe('<Billboard />', () => {
|
|
|
135
150
|
})
|
|
136
151
|
|
|
137
152
|
it('should not be clickable', () => {
|
|
138
|
-
const onClick =
|
|
153
|
+
const onClick = vi.fn()
|
|
139
154
|
|
|
140
155
|
render(<Billboard onClick={onClick} readOnly />)
|
|
141
156
|
const button = screen.getByRole('button')
|
|
@@ -148,7 +163,7 @@ describe('<Billboard />', () => {
|
|
|
148
163
|
|
|
149
164
|
describe('when passing down props to View', () => {
|
|
150
165
|
it('should support an elementRef prop', () => {
|
|
151
|
-
const elementRef =
|
|
166
|
+
const elementRef = vi.fn()
|
|
152
167
|
|
|
153
168
|
render(<Billboard elementRef={elementRef} href={TEST_LINK} />)
|
|
154
169
|
const link = screen.getByRole('link')
|