@elvia/elvis-accordion
Advanced tools
Comparing version 2.0.5 to 2.0.6
# Elvia Accordion Changelog | ||
## 2.0.6 (02.12.21) | ||
### Patch | ||
- Updated and added more tests | ||
## 2.0.5 (30.11.21) | ||
@@ -17,3 +23,2 @@ | ||
## 2.0.3 (17.11.21) | ||
@@ -20,0 +25,0 @@ |
@@ -0,0 +0,0 @@ declare module '*.css'; |
@@ -181,3 +181,4 @@ /* | ||
type: type, | ||
size: size | ||
size: size, | ||
"data-testid": "accordion-content-overflow" | ||
}, content && /*#__PURE__*/React.createElement("div", null, content), !content && /*#__PURE__*/React.createElement("div", { | ||
@@ -193,7 +194,9 @@ ref: accordionText | ||
size: size, | ||
onClick: () => setContentOpen(contentOpen => !contentOpen) | ||
onClick: () => setContentOpen(contentOpen => !contentOpen), | ||
"data-testid": "accordion-button-label" | ||
}, !contentOpen ? openLabel : closeLabel, /*#__PURE__*/React.createElement("i", null))), type === 'normal' ? /*#__PURE__*/React.createElement(AccordionContent, { | ||
isContentOpen: contentOpen, | ||
type: type, | ||
size: size | ||
size: size, | ||
"data-testid": "accordion-content-normal" | ||
}, content && /*#__PURE__*/React.createElement("div", null, content), !content && /*#__PURE__*/React.createElement("div", { | ||
@@ -200,0 +203,0 @@ ref: accordionText |
{ | ||
"name": "@elvia/elvis-accordion", | ||
"version": "2.0.5", | ||
"version": "2.0.6", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "web_component.js", |
export { default as Accordion } from './dist/react/js/elvia-accordion'; |
@@ -0,0 +0,0 @@ # Elvia Accordion |
@@ -0,0 +0,0 @@ declare module '*.css'; |
@@ -1,43 +0,83 @@ | ||
import 'jsdom-global/register'; | ||
import '@testing-library/jest-dom'; | ||
import { Accordion } from '@elvia/elvis-accordion/react'; | ||
import Accordion from './elvia-accordion.tsx'; | ||
import React from 'react'; | ||
import Adapter from '@wojtekmaj/enzyme-adapter-react-17'; | ||
import enzyme from 'enzyme'; | ||
enzyme.configure({ adapter: new Adapter() }); | ||
import { mount } from 'enzyme'; | ||
describe('Elvis Accordion', () => { | ||
let wrapper; | ||
beforeEach(() => { | ||
wrapper = enzyme.mount( | ||
<Accordion | ||
labelPosition="center" | ||
openLabel="open" | ||
closeLabel="close" | ||
content="TextContent" | ||
></Accordion>, | ||
); | ||
}); | ||
let accordionButton; | ||
let accordionContentNormal; | ||
let accordionContentOverflow; | ||
it('should show open label', function (done) { | ||
expect(wrapper.find('div').at(1).text()).toBe('open'); | ||
done(); | ||
}); | ||
describe('Type = normal', () => { | ||
beforeEach(() => { | ||
wrapper = mount( | ||
<Accordion | ||
labelPosition="center" | ||
openLabel="open" | ||
closeLabel="close" | ||
content="TextContent" | ||
type="normal" | ||
></Accordion>, | ||
); | ||
accordionButton = wrapper.find({ 'data-testid': 'accordion-button-label' }).at(0); | ||
accordionContentNormal = wrapper.find({ 'data-testid': 'accordion-content-normal' }).at(0); | ||
}); | ||
it('should show close label', function (done) { | ||
wrapper.find('button').simulate('click'); | ||
expect(wrapper.find('div').at(1).text()).toBe('close'); | ||
done(); | ||
}); | ||
afterEach(() => { | ||
wrapper.unmount(); | ||
}); | ||
it('should not show content', function (done) { | ||
expect(wrapper.find('div').at(2).getDOMNode()).toHaveStyle('opacity: 0'); | ||
done(); | ||
it('should show open label if not opened', function (done) { | ||
expect(accordionButton.text()).toBe('open'); | ||
done(); | ||
}); | ||
it('should show close label if opened', function (done) { | ||
accordionButton.simulate('click'); | ||
expect(accordionButton.text()).toBe('close'); | ||
done(); | ||
}); | ||
it('should not show content if not opened', function (done) { | ||
expect(accordionContentNormal.getDOMNode()).toHaveStyle('opacity: 0'); | ||
done(); | ||
}); | ||
it('should show content if opened', function (done) { | ||
accordionButton.simulate('click'); | ||
expect(accordionContentNormal.getDOMNode()).toHaveStyle('opacity: 1'); | ||
done(); | ||
}); | ||
}); | ||
it('should show content', function (done) { | ||
wrapper.find('button').simulate('click'); | ||
expect(wrapper.find('div').at(2).getDOMNode()).toHaveStyle('opacity: 1'); | ||
done(); | ||
describe('Type = overflow', () => { | ||
beforeEach(() => { | ||
wrapper = mount( | ||
<Accordion | ||
labelPosition="center" | ||
openLabel="open" | ||
closeLabel="close" | ||
content="TextContent" | ||
type="overflow" | ||
></Accordion>, | ||
); | ||
accordionButton = wrapper.find({ 'data-testid': 'accordion-button-label' }).at(0); | ||
accordionContentOverflow = wrapper.find({ 'data-testid': 'accordion-content-overflow' }).at(0); | ||
}); | ||
afterEach(() => { | ||
wrapper.unmount(); | ||
}); | ||
it('should show content if not opened', function (done) { | ||
expect(accordionContentOverflow.getDOMNode()).toHaveStyle('opacity: 1'); | ||
done(); | ||
}); | ||
it('should show content if opened', function (done) { | ||
accordionButton.simulate('click'); | ||
expect(accordionContentOverflow.getDOMNode()).toHaveStyle('opacity: 1'); | ||
done(); | ||
}); | ||
}); | ||
}); |
export { default as Accordion } from './dist/web_component/js/elvia-accordion'; |
Sorry, the diff of this file is not supported yet
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
25470
13
684