From c19765cfe871490706b9a04c4c3c0c8690d8d753 Mon Sep 17 00:00:00 2001 From: Zuza Date: Fri, 3 Jul 2020 17:17:17 +0200 Subject: [PATCH 01/19] base css rewrite for list & list item --- src/atoms/list-item/ListItem.css | 3 ++ src/atoms/list-item/ListItem.html | 7 +++ src/atoms/list-item/ListItem.js | 11 ++++ src/atoms/list-item/ListItem.spec.js | 35 ++++++++++++ src/atoms/list-item/ListItem.vue | 13 +++++ src/atoms/list/List.css | 29 ++++++++++ src/atoms/list/List.html | 7 +++ src/atoms/list/List.js | 12 +++++ src/atoms/list/List.selectors.json | 14 +++++ src/atoms/list/List.spec.js | 35 ++++++++++++ src/atoms/list/List.stories.js | 79 ++++++++++++++++++++++++++++ src/atoms/list/List.vue | 13 +++++ 12 files changed, 258 insertions(+) create mode 100644 src/atoms/list-item/ListItem.css create mode 100644 src/atoms/list-item/ListItem.html create mode 100644 src/atoms/list-item/ListItem.js create mode 100644 src/atoms/list-item/ListItem.spec.js create mode 100644 src/atoms/list-item/ListItem.vue create mode 100644 src/atoms/list/List.css create mode 100644 src/atoms/list/List.html create mode 100644 src/atoms/list/List.js create mode 100644 src/atoms/list/List.selectors.json create mode 100644 src/atoms/list/List.spec.js create mode 100644 src/atoms/list/List.stories.js create mode 100644 src/atoms/list/List.vue diff --git a/src/atoms/list-item/ListItem.css b/src/atoms/list-item/ListItem.css new file mode 100644 index 000000000..4d5d99dbd --- /dev/null +++ b/src/atoms/list-item/ListItem.css @@ -0,0 +1,3 @@ +.a-list-item { + @apply p-2; +} diff --git a/src/atoms/list-item/ListItem.html b/src/atoms/list-item/ListItem.html new file mode 100644 index 000000000..096710eb3 --- /dev/null +++ b/src/atoms/list-item/ListItem.html @@ -0,0 +1,7 @@ + + + + diff --git a/src/atoms/list-item/ListItem.js b/src/atoms/list-item/ListItem.js new file mode 100644 index 000000000..c1820e97b --- /dev/null +++ b/src/atoms/list-item/ListItem.js @@ -0,0 +1,11 @@ +export default { + props: { + /** + * To use another tag instead of `li` + */ + tag: { + type: String, + default: 'li' + } + } +} diff --git a/src/atoms/list-item/ListItem.spec.js b/src/atoms/list-item/ListItem.spec.js new file mode 100644 index 000000000..62234cbbc --- /dev/null +++ b/src/atoms/list-item/ListItem.spec.js @@ -0,0 +1,35 @@ +import { mount } from '@vue/test-utils' +import AListItem from './ListItem.vue' + +describe('ListItem', () => { + it('has default structure', () => { + const wrapper = mount(AListItem) + + expect(wrapper.is('li')).toBe(true) + expect(wrapper.classes()).toContain('a-list-item') + expect(wrapper.classes().length).toBe(1) + }) + + it('renders slot text when passed', () => { + const wrapper = mount(AListItem, { + slots: { + default: 'List item default text' + } + }) + + expect(wrapper.find('.a-list-item > span').exists()).toBe(true) + expect(wrapper.find('.a-list-item > span').text()).toEqual('List item default text') + }) + + it('should be generated with the `dt` passed as tag', () => { + const wrapper = mount(AListItem, { + propsData: { + tag: 'dt' + } + }) + + expect(wrapper.is('dt')).toBe(true) + expect(wrapper.classes()).toContain('a-list-item') + expect(wrapper.props().tag).toBe('dt') + }) +}) diff --git a/src/atoms/list-item/ListItem.vue b/src/atoms/list-item/ListItem.vue new file mode 100644 index 000000000..3caae23c2 --- /dev/null +++ b/src/atoms/list-item/ListItem.vue @@ -0,0 +1,13 @@ +