@dhis2-ui/button
Advanced tools
Comparing version 10.0.0-alpha.7 to 10.0.0-alpha.8
@@ -18,7 +18,7 @@ "use strict"; | ||
it('No warning if children exist but aria-label and title is missing', () => { | ||
(0, _react.render)( /*#__PURE__*/_react2.default.createElement(_button.Button, null, "Children content")); | ||
(0, _react.render)(/*#__PURE__*/_react2.default.createElement(_button.Button, null, "Children content")); | ||
expect(consoleSpy).not.toHaveBeenCalled(); | ||
}); | ||
it('does not warn if aria-label and title is present', () => { | ||
(0, _react.render)( /*#__PURE__*/_react2.default.createElement(_button.Button, { | ||
(0, _react.render)(/*#__PURE__*/_react2.default.createElement(_button.Button, { | ||
"aria-label": "Test", | ||
@@ -30,7 +30,7 @@ title: "Test" | ||
it('warns if no children are present with no arial-label and title', () => { | ||
(0, _react.render)( /*#__PURE__*/_react2.default.createElement(_button.Button, null)); | ||
(0, _react.render)(/*#__PURE__*/_react2.default.createElement(_button.Button, null)); | ||
expect(consoleSpy).toHaveBeenCalledWith('Button component has no children but is missing title and ariaLabel attribute.'); | ||
}); | ||
it('No warning if there are no children but arial label and title', () => { | ||
(0, _react.render)( /*#__PURE__*/_react2.default.createElement(_button.Button, { | ||
(0, _react.render)(/*#__PURE__*/_react2.default.createElement(_button.Button, { | ||
"aria-label": "Test", | ||
@@ -44,3 +44,3 @@ title: "Test" | ||
const dataTest = 'dhis2-uicore-button'; | ||
const wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react2.default.createElement(_button.Button, { | ||
const wrapper = (0, _enzyme.mount)(/*#__PURE__*/_react2.default.createElement(_button.Button, { | ||
dataTest: dataTest | ||
@@ -55,3 +55,3 @@ })); | ||
const dataTest = 'button-data-test'; | ||
const wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react2.default.createElement(_button.Button, { | ||
const wrapper = (0, _enzyme.mount)(/*#__PURE__*/_react2.default.createElement(_button.Button, { | ||
dataTest: dataTest | ||
@@ -66,3 +66,3 @@ })); | ||
const dataTest = 'button-data-test'; | ||
const wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react2.default.createElement(_button.Button, { | ||
const wrapper = (0, _enzyme.mount)(/*#__PURE__*/_react2.default.createElement(_button.Button, { | ||
dataTest: dataTest, | ||
@@ -78,3 +78,3 @@ ariaLabel: "test aria label", | ||
it('should have class "toggled" if toggled-prop is true', () => { | ||
const wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react2.default.createElement(_button.Button, { | ||
const wrapper = (0, _enzyme.mount)(/*#__PURE__*/_react2.default.createElement(_button.Button, { | ||
toggled: true | ||
@@ -86,3 +86,3 @@ })); | ||
it('should not have class "toggled" if toggled-prop is not passed', () => { | ||
const wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react2.default.createElement(_button.Button, null)); | ||
const wrapper = (0, _enzyme.mount)(/*#__PURE__*/_react2.default.createElement(_button.Button, null)); | ||
const actual = wrapper.find('button'); | ||
@@ -94,3 +94,3 @@ expect(actual.hasClass('toggled')).toBe(false); | ||
const onKeyDown = jest.fn(); | ||
(0, _react.render)( /*#__PURE__*/_react2.default.createElement(_button.Button, { | ||
(0, _react.render)(/*#__PURE__*/_react2.default.createElement(_button.Button, { | ||
name: "button-name", | ||
@@ -97,0 +97,0 @@ value: "button-value", |
@@ -47,3 +47,3 @@ "use strict"; | ||
queryByText | ||
} = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_dropdownButton.DropdownButton, { | ||
} = (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_dropdownButton.DropdownButton, { | ||
component: componentText | ||
@@ -72,3 +72,3 @@ })); | ||
queryByText | ||
} = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_modal.Modal, { | ||
} = (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_modal.Modal, { | ||
hide: false, | ||
@@ -93,3 +93,3 @@ onClose: () => {} | ||
const onClick = jest.fn(); | ||
const wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react2.default.createElement(_dropdownButton.DropdownButton, { | ||
const wrapper = (0, _enzyme.mount)(/*#__PURE__*/_react2.default.createElement(_dropdownButton.DropdownButton, { | ||
onClick: onClick, | ||
@@ -96,0 +96,0 @@ open: false, |
@@ -5,3 +5,2 @@ "use strict"; | ||
var _react2 = _interopRequireDefault(require("react")); | ||
require("@testing-library/jest-dom/extend-expect"); | ||
var _splitButton = require("./split-button.js"); | ||
@@ -14,3 +13,3 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } | ||
getByText | ||
} = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_splitButton.SplitButton, null, "Click me")); | ||
} = (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_splitButton.SplitButton, null, "Click me")); | ||
expect(getByText('Click me')).toBeInTheDocument(); | ||
@@ -22,3 +21,3 @@ }); | ||
queryByTestId | ||
} = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_splitButton.SplitButton, null)); | ||
} = (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_splitButton.SplitButton, null)); | ||
const toggleButton = getByTestId('dhis2-uicore-splitbutton-toggle'); | ||
@@ -33,3 +32,3 @@ _react.fireEvent.click(toggleButton); | ||
getByTestId | ||
} = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_splitButton.SplitButton, { | ||
} = (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_splitButton.SplitButton, { | ||
component: /*#__PURE__*/_react2.default.createElement("div", null, "Dropdown Content") | ||
@@ -44,3 +43,3 @@ })); | ||
getByTestId | ||
} = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_splitButton.SplitButton, { | ||
} = (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_splitButton.SplitButton, { | ||
component: /*#__PURE__*/_react2.default.createElement("div", null, "Dropdown Content") | ||
@@ -64,3 +63,3 @@ })); | ||
queryByTestId | ||
} = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_splitButton.SplitButton, { | ||
} = (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_splitButton.SplitButton, { | ||
component: /*#__PURE__*/_react2.default.createElement("div", null, "Dropdown Content") | ||
@@ -83,3 +82,3 @@ })); | ||
getByTestId | ||
} = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_splitButton.SplitButton, null)); | ||
} = (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_splitButton.SplitButton, null)); | ||
const toggleButton = getByTestId('dhis2-uicore-splitbutton-toggle'); | ||
@@ -86,0 +85,0 @@ expect(toggleButton).toHaveAttribute('title', 'Toggle dropdown'); |
@@ -15,7 +15,7 @@ import { render, fireEvent, screen } from '@testing-library/react'; | ||
it('No warning if children exist but aria-label and title is missing', () => { | ||
render( /*#__PURE__*/React.createElement(Button, null, "Children content")); | ||
render(/*#__PURE__*/React.createElement(Button, null, "Children content")); | ||
expect(consoleSpy).not.toHaveBeenCalled(); | ||
}); | ||
it('does not warn if aria-label and title is present', () => { | ||
render( /*#__PURE__*/React.createElement(Button, { | ||
render(/*#__PURE__*/React.createElement(Button, { | ||
"aria-label": "Test", | ||
@@ -27,7 +27,7 @@ title: "Test" | ||
it('warns if no children are present with no arial-label and title', () => { | ||
render( /*#__PURE__*/React.createElement(Button, null)); | ||
render(/*#__PURE__*/React.createElement(Button, null)); | ||
expect(consoleSpy).toHaveBeenCalledWith('Button component has no children but is missing title and ariaLabel attribute.'); | ||
}); | ||
it('No warning if there are no children but arial label and title', () => { | ||
render( /*#__PURE__*/React.createElement(Button, { | ||
render(/*#__PURE__*/React.createElement(Button, { | ||
"aria-label": "Test", | ||
@@ -41,3 +41,3 @@ title: "Test" | ||
const dataTest = 'dhis2-uicore-button'; | ||
const wrapper = mount( /*#__PURE__*/React.createElement(Button, { | ||
const wrapper = mount(/*#__PURE__*/React.createElement(Button, { | ||
dataTest: dataTest | ||
@@ -52,3 +52,3 @@ })); | ||
const dataTest = 'button-data-test'; | ||
const wrapper = mount( /*#__PURE__*/React.createElement(Button, { | ||
const wrapper = mount(/*#__PURE__*/React.createElement(Button, { | ||
dataTest: dataTest | ||
@@ -63,3 +63,3 @@ })); | ||
const dataTest = 'button-data-test'; | ||
const wrapper = mount( /*#__PURE__*/React.createElement(Button, { | ||
const wrapper = mount(/*#__PURE__*/React.createElement(Button, { | ||
dataTest: dataTest, | ||
@@ -75,3 +75,3 @@ ariaLabel: "test aria label", | ||
it('should have class "toggled" if toggled-prop is true', () => { | ||
const wrapper = mount( /*#__PURE__*/React.createElement(Button, { | ||
const wrapper = mount(/*#__PURE__*/React.createElement(Button, { | ||
toggled: true | ||
@@ -83,3 +83,3 @@ })); | ||
it('should not have class "toggled" if toggled-prop is not passed', () => { | ||
const wrapper = mount( /*#__PURE__*/React.createElement(Button, null)); | ||
const wrapper = mount(/*#__PURE__*/React.createElement(Button, null)); | ||
const actual = wrapper.find('button'); | ||
@@ -91,3 +91,3 @@ expect(actual.hasClass('toggled')).toBe(false); | ||
const onKeyDown = jest.fn(); | ||
render( /*#__PURE__*/React.createElement(Button, { | ||
render(/*#__PURE__*/React.createElement(Button, { | ||
name: "button-name", | ||
@@ -94,0 +94,0 @@ value: "button-value", |
@@ -44,3 +44,3 @@ import { Layer } from '@dhis2-ui/layer'; | ||
queryByText | ||
} = render( /*#__PURE__*/React.createElement(DropdownButton, { | ||
} = render(/*#__PURE__*/React.createElement(DropdownButton, { | ||
component: componentText | ||
@@ -69,3 +69,3 @@ })); | ||
queryByText | ||
} = render( /*#__PURE__*/React.createElement(Modal, { | ||
} = render(/*#__PURE__*/React.createElement(Modal, { | ||
hide: false, | ||
@@ -90,3 +90,3 @@ onClose: () => {} | ||
const onClick = jest.fn(); | ||
const wrapper = mount( /*#__PURE__*/React.createElement(DropdownButton, { | ||
const wrapper = mount(/*#__PURE__*/React.createElement(DropdownButton, { | ||
onClick: onClick, | ||
@@ -93,0 +93,0 @@ open: false, |
import { render, fireEvent, cleanup, waitFor } from '@testing-library/react'; | ||
import React from 'react'; | ||
import '@testing-library/jest-dom/extend-expect'; | ||
import { SplitButton } from './split-button.js'; | ||
@@ -10,3 +9,3 @@ describe('SplitButton', () => { | ||
getByText | ||
} = render( /*#__PURE__*/React.createElement(SplitButton, null, "Click me")); | ||
} = render(/*#__PURE__*/React.createElement(SplitButton, null, "Click me")); | ||
expect(getByText('Click me')).toBeInTheDocument(); | ||
@@ -18,3 +17,3 @@ }); | ||
queryByTestId | ||
} = render( /*#__PURE__*/React.createElement(SplitButton, null)); | ||
} = render(/*#__PURE__*/React.createElement(SplitButton, null)); | ||
const toggleButton = getByTestId('dhis2-uicore-splitbutton-toggle'); | ||
@@ -29,3 +28,3 @@ fireEvent.click(toggleButton); | ||
getByTestId | ||
} = render( /*#__PURE__*/React.createElement(SplitButton, { | ||
} = render(/*#__PURE__*/React.createElement(SplitButton, { | ||
component: /*#__PURE__*/React.createElement("div", null, "Dropdown Content") | ||
@@ -40,3 +39,3 @@ })); | ||
getByTestId | ||
} = render( /*#__PURE__*/React.createElement(SplitButton, { | ||
} = render(/*#__PURE__*/React.createElement(SplitButton, { | ||
component: /*#__PURE__*/React.createElement("div", null, "Dropdown Content") | ||
@@ -60,3 +59,3 @@ })); | ||
queryByTestId | ||
} = render( /*#__PURE__*/React.createElement(SplitButton, { | ||
} = render(/*#__PURE__*/React.createElement(SplitButton, { | ||
component: /*#__PURE__*/React.createElement("div", null, "Dropdown Content") | ||
@@ -79,3 +78,3 @@ })); | ||
getByTestId | ||
} = render( /*#__PURE__*/React.createElement(SplitButton, null)); | ||
} = render(/*#__PURE__*/React.createElement(SplitButton, null)); | ||
const toggleButton = getByTestId('dhis2-uicore-splitbutton-toggle'); | ||
@@ -82,0 +81,0 @@ expect(toggleButton).toHaveAttribute('title', 'Toggle dropdown'); |
{ | ||
"name": "@dhis2-ui/button", | ||
"version": "10.0.0-alpha.7", | ||
"version": "10.0.0-alpha.8", | ||
"description": "UI Button", | ||
@@ -30,4 +30,4 @@ "repository": { | ||
"peerDependencies": { | ||
"react": "^16.13", | ||
"react-dom": "^16.13", | ||
"react": "^16.13 || ^18", | ||
"react-dom": "^16.13 || ^18", | ||
"styled-jsx": "^4" | ||
@@ -37,7 +37,7 @@ }, | ||
"@dhis2/prop-types": "^3.1.2", | ||
"@dhis2-ui/layer": "10.0.0-alpha.7", | ||
"@dhis2-ui/loader": "10.0.0-alpha.7", | ||
"@dhis2-ui/popper": "10.0.0-alpha.7", | ||
"@dhis2/ui-constants": "10.0.0-alpha.7", | ||
"@dhis2/ui-icons": "10.0.0-alpha.7", | ||
"@dhis2-ui/layer": "10.0.0-alpha.8", | ||
"@dhis2-ui/loader": "10.0.0-alpha.8", | ||
"@dhis2-ui/popper": "10.0.0-alpha.8", | ||
"@dhis2/ui-constants": "10.0.0-alpha.8", | ||
"@dhis2/ui-icons": "10.0.0-alpha.8", | ||
"classnames": "^2.3.1", | ||
@@ -51,4 +51,4 @@ "prop-types": "^15.7.2" | ||
"devDependencies": { | ||
"react": "16.13", | ||
"react-dom": "16.13", | ||
"react": "^18.3.1", | ||
"react-dom": "^18.3.1", | ||
"styled-jsx": "^4.0.1" | ||
@@ -55,0 +55,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
187857
4131
+ Added@dhis2-ui/layer@10.0.0-alpha.8(transitive)
+ Added@dhis2-ui/loader@10.0.0-alpha.8(transitive)
+ Added@dhis2-ui/popper@10.0.0-alpha.8(transitive)
+ Added@dhis2-ui/portal@10.0.0-alpha.8(transitive)
+ Added@dhis2/ui-constants@10.0.0-alpha.8(transitive)
+ Added@dhis2/ui-icons@10.0.0-alpha.8(transitive)
+ Addedelectron-to-chromium@1.5.67(transitive)
+ Addedreact@18.3.1(transitive)
+ Addedreact-dom@18.3.1(transitive)
+ Addedscheduler@0.23.2(transitive)
- Removed@dhis2-ui/layer@10.0.0-alpha.7(transitive)
- Removed@dhis2-ui/loader@10.0.0-alpha.7(transitive)
- Removed@dhis2-ui/popper@10.0.0-alpha.7(transitive)
- Removed@dhis2-ui/portal@10.0.0-alpha.7(transitive)
- Removed@dhis2/ui-constants@10.0.0-alpha.7(transitive)
- Removed@dhis2/ui-icons@10.0.0-alpha.7(transitive)
- Removedelectron-to-chromium@1.5.65(transitive)
- Removedreact@16.14.0(transitive)
- Removedreact-dom@16.14.0(transitive)
- Removedscheduler@0.19.1(transitive)