@instructure/ui-heading 9.2.1-snapshot-8 → 9.2.1-snapshot-9
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/es/Heading/__new-tests__/Heading.test.js +64 -0
- package/lib/Heading/__new-tests__/Heading.test.js +66 -0
- package/package.json +15 -12
- package/src/Heading/__new-tests__/Heading.test.tsx +67 -0
- package/tsconfig.build.json +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Heading/__new-tests__/Heading.test.d.ts +2 -0
- package/types/Heading/__new-tests__/Heading.test.d.ts.map +1 -0
- package/es/Heading/HeadingLocator.js +0 -28
- package/es/Heading/locator.js +0 -26
- package/lib/Heading/HeadingLocator.js +0 -34
- package/lib/Heading/locator.js +0 -37
- package/src/Heading/HeadingLocator.ts +0 -29
- package/src/Heading/locator.ts +0 -27
- package/types/Heading/HeadingLocator.d.ts +0 -566
- package/types/Heading/HeadingLocator.d.ts.map +0 -1
- package/types/Heading/locator.d.ts +0 -4
- package/types/Heading/locator.d.ts.map +0 -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-9](https://github.com/instructure/instructure-ui/compare/v9.2.0...v9.2.1-snapshot-9) (2024-07-16)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @instructure/ui-heading
|
|
9
9
|
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
var _Heading, _Heading2, _Heading3, _Heading4, _Heading5;
|
|
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 React from 'react';
|
|
27
|
+
import { render, screen } from '@testing-library/react';
|
|
28
|
+
import '@testing-library/jest-dom';
|
|
29
|
+
import { Heading } from '../index';
|
|
30
|
+
import { runAxeCheck } from '@instructure/ui-axe-check';
|
|
31
|
+
describe('<Heading />', () => {
|
|
32
|
+
it('should render as an H2 element', async () => {
|
|
33
|
+
const _render = render(_Heading || (_Heading = /*#__PURE__*/React.createElement(Heading, null, "Hello World"))),
|
|
34
|
+
container = _render.container;
|
|
35
|
+
const heading = container.querySelector('[class$="-heading"]');
|
|
36
|
+
expect(heading.tagName).toBe('H2');
|
|
37
|
+
});
|
|
38
|
+
it('should render the children as text content', async () => {
|
|
39
|
+
const _render2 = render(_Heading2 || (_Heading2 = /*#__PURE__*/React.createElement(Heading, null, "Hello World"))),
|
|
40
|
+
container = _render2.container;
|
|
41
|
+
const heading = container.querySelector('[class$="-heading"]');
|
|
42
|
+
expect(heading).toHaveTextContent('Hello World');
|
|
43
|
+
});
|
|
44
|
+
it('should render as a SPAN if level is `reset`', async () => {
|
|
45
|
+
render(_Heading3 || (_Heading3 = /*#__PURE__*/React.createElement(Heading, {
|
|
46
|
+
level: "reset"
|
|
47
|
+
}, "Hello World")));
|
|
48
|
+
const heading = screen.getByText('Hello World');
|
|
49
|
+
expect(heading.tagName).toBe('SPAN');
|
|
50
|
+
});
|
|
51
|
+
it('should meet a11y standards', async () => {
|
|
52
|
+
const _render3 = render(_Heading4 || (_Heading4 = /*#__PURE__*/React.createElement(Heading, null, "Hello World"))),
|
|
53
|
+
container = _render3.container;
|
|
54
|
+
const axeCheck = await runAxeCheck(container);
|
|
55
|
+
expect(axeCheck).toBe(true);
|
|
56
|
+
});
|
|
57
|
+
it('should render with the specified tag when `as` prop is set', async () => {
|
|
58
|
+
render(_Heading5 || (_Heading5 = /*#__PURE__*/React.createElement(Heading, {
|
|
59
|
+
as: "div"
|
|
60
|
+
}, "Hello World")));
|
|
61
|
+
const heading = screen.getByText('Hello World');
|
|
62
|
+
expect(heading.tagName).toBe('DIV');
|
|
63
|
+
});
|
|
64
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _react = _interopRequireDefault(require("react"));
|
|
5
|
+
var _react2 = require("@testing-library/react");
|
|
6
|
+
require("@testing-library/jest-dom");
|
|
7
|
+
var _index = require("../index");
|
|
8
|
+
var _runAxeCheck = require("@instructure/ui-axe-check/lib/runAxeCheck.js");
|
|
9
|
+
var _Heading, _Heading2, _Heading3, _Heading4, _Heading5;
|
|
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('<Heading />', () => {
|
|
34
|
+
it('should render as an H2 element', async () => {
|
|
35
|
+
const _render = (0, _react2.render)(_Heading || (_Heading = /*#__PURE__*/_react.default.createElement(_index.Heading, null, "Hello World"))),
|
|
36
|
+
container = _render.container;
|
|
37
|
+
const heading = container.querySelector('[class$="-heading"]');
|
|
38
|
+
expect(heading.tagName).toBe('H2');
|
|
39
|
+
});
|
|
40
|
+
it('should render the children as text content', async () => {
|
|
41
|
+
const _render2 = (0, _react2.render)(_Heading2 || (_Heading2 = /*#__PURE__*/_react.default.createElement(_index.Heading, null, "Hello World"))),
|
|
42
|
+
container = _render2.container;
|
|
43
|
+
const heading = container.querySelector('[class$="-heading"]');
|
|
44
|
+
expect(heading).toHaveTextContent('Hello World');
|
|
45
|
+
});
|
|
46
|
+
it('should render as a SPAN if level is `reset`', async () => {
|
|
47
|
+
(0, _react2.render)(_Heading3 || (_Heading3 = /*#__PURE__*/_react.default.createElement(_index.Heading, {
|
|
48
|
+
level: "reset"
|
|
49
|
+
}, "Hello World")));
|
|
50
|
+
const heading = _react2.screen.getByText('Hello World');
|
|
51
|
+
expect(heading.tagName).toBe('SPAN');
|
|
52
|
+
});
|
|
53
|
+
it('should meet a11y standards', async () => {
|
|
54
|
+
const _render3 = (0, _react2.render)(_Heading4 || (_Heading4 = /*#__PURE__*/_react.default.createElement(_index.Heading, null, "Hello World"))),
|
|
55
|
+
container = _render3.container;
|
|
56
|
+
const axeCheck = await (0, _runAxeCheck.runAxeCheck)(container);
|
|
57
|
+
expect(axeCheck).toBe(true);
|
|
58
|
+
});
|
|
59
|
+
it('should render with the specified tag when `as` prop is set', async () => {
|
|
60
|
+
(0, _react2.render)(_Heading5 || (_Heading5 = /*#__PURE__*/_react.default.createElement(_index.Heading, {
|
|
61
|
+
as: "div"
|
|
62
|
+
}, "Hello World")));
|
|
63
|
+
const heading = _react2.screen.getByText('Hello World');
|
|
64
|
+
expect(heading.tagName).toBe('DIV');
|
|
65
|
+
});
|
|
66
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-heading",
|
|
3
|
-
"version": "9.2.1-snapshot-
|
|
3
|
+
"version": "9.2.1-snapshot-9",
|
|
4
4
|
"description": "A component for creating typographic headings",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -24,20 +24,23 @@
|
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/runtime": "^7.24.5",
|
|
27
|
-
"@instructure/console": "9.2.1-snapshot-
|
|
28
|
-
"@instructure/emotion": "9.2.1-snapshot-
|
|
29
|
-
"@instructure/shared-types": "9.2.1-snapshot-
|
|
30
|
-
"@instructure/ui-prop-types": "9.2.1-snapshot-
|
|
31
|
-
"@instructure/ui-react-utils": "9.2.1-snapshot-
|
|
32
|
-
"@instructure/ui-testable": "9.2.1-snapshot-
|
|
33
|
-
"@instructure/ui-view": "9.2.1-snapshot-
|
|
27
|
+
"@instructure/console": "9.2.1-snapshot-9",
|
|
28
|
+
"@instructure/emotion": "9.2.1-snapshot-9",
|
|
29
|
+
"@instructure/shared-types": "9.2.1-snapshot-9",
|
|
30
|
+
"@instructure/ui-prop-types": "9.2.1-snapshot-9",
|
|
31
|
+
"@instructure/ui-react-utils": "9.2.1-snapshot-9",
|
|
32
|
+
"@instructure/ui-testable": "9.2.1-snapshot-9",
|
|
33
|
+
"@instructure/ui-view": "9.2.1-snapshot-9",
|
|
34
34
|
"prop-types": "^15.8.1"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@instructure/ui-
|
|
38
|
-
"@instructure/ui-
|
|
39
|
-
"@instructure/ui-test-utils": "9.2.1-snapshot-
|
|
40
|
-
"@instructure/ui-themes": "9.2.1-snapshot-
|
|
37
|
+
"@instructure/ui-axe-check": "9.2.1-snapshot-9",
|
|
38
|
+
"@instructure/ui-babel-preset": "9.2.1-snapshot-9",
|
|
39
|
+
"@instructure/ui-test-utils": "9.2.1-snapshot-9",
|
|
40
|
+
"@instructure/ui-themes": "9.2.1-snapshot-9",
|
|
41
|
+
"@testing-library/jest-dom": "^6.4.5",
|
|
42
|
+
"@testing-library/react": "^15.0.7",
|
|
43
|
+
"vitest": "^1.6.0"
|
|
41
44
|
},
|
|
42
45
|
"peerDependencies": {
|
|
43
46
|
"react": ">=16.8 <=18"
|
|
@@ -0,0 +1,67 @@
|
|
|
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 React from 'react'
|
|
26
|
+
import { render, screen } from '@testing-library/react'
|
|
27
|
+
import '@testing-library/jest-dom'
|
|
28
|
+
|
|
29
|
+
import { Heading } from '../index'
|
|
30
|
+
import { runAxeCheck } from '@instructure/ui-axe-check'
|
|
31
|
+
|
|
32
|
+
describe('<Heading />', () => {
|
|
33
|
+
it('should render as an H2 element', async () => {
|
|
34
|
+
const { container } = render(<Heading>Hello World</Heading>)
|
|
35
|
+
const heading = container.querySelector('[class$="-heading"]')
|
|
36
|
+
|
|
37
|
+
expect(heading!.tagName).toBe('H2')
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
it('should render the children as text content', async () => {
|
|
41
|
+
const { container } = render(<Heading>Hello World</Heading>)
|
|
42
|
+
const heading = container.querySelector('[class$="-heading"]')
|
|
43
|
+
|
|
44
|
+
expect(heading).toHaveTextContent('Hello World')
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
it('should render as a SPAN if level is `reset`', async () => {
|
|
48
|
+
render(<Heading level="reset">Hello World</Heading>)
|
|
49
|
+
const heading = screen.getByText('Hello World')
|
|
50
|
+
|
|
51
|
+
expect(heading.tagName).toBe('SPAN')
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
it('should meet a11y standards', async () => {
|
|
55
|
+
const { container } = render(<Heading>Hello World</Heading>)
|
|
56
|
+
const axeCheck = await runAxeCheck(container)
|
|
57
|
+
|
|
58
|
+
expect(axeCheck).toBe(true)
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
it('should render with the specified tag when `as` prop is set', async () => {
|
|
62
|
+
render(<Heading as="div">Hello World</Heading>)
|
|
63
|
+
const heading = screen.getByText('Hello World')
|
|
64
|
+
|
|
65
|
+
expect(heading.tagName).toBe('DIV')
|
|
66
|
+
})
|
|
67
|
+
})
|
package/tsconfig.build.json
CHANGED
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
{ "path": "../console/tsconfig.build.json" },
|
|
11
11
|
{ "path": "../emotion/tsconfig.build.json" },
|
|
12
12
|
{ "path": "../shared-types/tsconfig.build.json" },
|
|
13
|
+
{ "path": "../ui-axe-check/tsconfig.build.json" },
|
|
13
14
|
{ "path": "../ui-prop-types/tsconfig.build.json" },
|
|
14
15
|
{ "path": "../ui-react-utils/tsconfig.build.json" },
|
|
15
16
|
{ "path": "../ui-testable/tsconfig.build.json" },
|
|
16
17
|
{ "path": "../ui-view/tsconfig.build.json" },
|
|
17
18
|
{ "path": "../ui-babel-preset/tsconfig.build.json" },
|
|
18
|
-
{ "path": "../ui-test-locator/tsconfig.build.json" },
|
|
19
19
|
{ "path": "../ui-test-utils/tsconfig.build.json" },
|
|
20
20
|
{ "path": "../ui-themes/tsconfig.build.json" }
|
|
21
21
|
]
|