diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-09 09:07:45 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-09 09:07:45 +0000 |
commit | f4186a753b86625a83e8499af14b5badd63a2ac2 (patch) | |
tree | b960dd9f4255e9eee9f87d28e853f163836aa4c5 /spec/frontend/boards | |
parent | 0221116862ee66024a03492b4fbbe4e069d84303 (diff) | |
download | gitlab-ce-f4186a753b86625a83e8499af14b5badd63a2ac2.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/boards')
-rw-r--r-- | spec/frontend/boards/components/issue_card_inner_scoped_label_spec.js | 40 | ||||
-rw-r--r-- | spec/frontend/boards/issue_card_spec.js | 32 |
2 files changed, 11 insertions, 61 deletions
diff --git a/spec/frontend/boards/components/issue_card_inner_scoped_label_spec.js b/spec/frontend/boards/components/issue_card_inner_scoped_label_spec.js deleted file mode 100644 index 53e670e76da..00000000000 --- a/spec/frontend/boards/components/issue_card_inner_scoped_label_spec.js +++ /dev/null @@ -1,40 +0,0 @@ -import { GlLink } from '@gitlab/ui'; -import { shallowMount } from '@vue/test-utils'; -import IssueCardInnerScopedLabel from '~/boards/components/issue_card_inner_scoped_label.vue'; - -describe('IssueCardInnerScopedLabel Component', () => { - let wrapper; - - beforeEach(() => { - wrapper = shallowMount(IssueCardInnerScopedLabel, { - propsData: { - label: { title: 'Foo::Bar', description: 'Some Random Description' }, - labelStyle: { background: 'white', color: 'black' }, - scopedLabelsDocumentationLink: '/docs-link', - }, - }); - }); - - afterEach(() => { - wrapper.destroy(); - }); - - it('should render label title', () => { - expect(wrapper.find('.color-label').text()).toBe('Foo::Bar'); - }); - - it('should render question mark symbol', () => { - expect(wrapper.find('.fa-question-circle').exists()).toBe(true); - }); - - it('should render label style provided', () => { - const label = wrapper.find('.color-label'); - - expect(label.attributes('style')).toContain('background: white;'); - expect(label.attributes('style')).toContain('color: black;'); - }); - - it('should render the docs link', () => { - expect(wrapper.find(GlLink).attributes('href')).toBe('/docs-link'); - }); -}); diff --git a/spec/frontend/boards/issue_card_spec.js b/spec/frontend/boards/issue_card_spec.js index 1fd2b417aba..f78e4dad2c0 100644 --- a/spec/frontend/boards/issue_card_spec.js +++ b/spec/frontend/boards/issue_card_spec.js @@ -8,6 +8,7 @@ import '~/boards/models/list'; import IssueCardInner from '~/boards/components/issue_card_inner.vue'; import { listObj } from '../../javascripts/boards/mock_data'; import store from '~/boards/stores'; +import { GlLabel } from '@gitlab/ui'; describe('Issue card component', () => { const user = new ListAssignee({ @@ -20,7 +21,7 @@ describe('Issue card component', () => { const label1 = new ListLabel({ id: 3, title: 'testing 123', - color: 'blue', + color: '#000CFF', text_color: 'white', description: 'test', }); @@ -50,6 +51,9 @@ describe('Issue card component', () => { rootPath: '/', }, store, + stubs: { + GlLabel: true, + }, }); }); @@ -290,25 +294,11 @@ describe('Issue card component', () => { }); it('does not render list label but renders all other labels', () => { - expect(wrapper.findAll('.badge').length).toBe(1); - }); - - it('renders label', () => { - const nodes = wrapper.findAll('.badge').wrappers.map(label => label.attributes('title')); - - expect(nodes.includes(label1.description)).toBe(true); - }); - - it('sets label description as title', () => { - expect(wrapper.find('.badge').attributes('title')).toContain(label1.description); - }); - - it('sets background color of button', () => { - const nodes = wrapper - .findAll('.badge') - .wrappers.map(label => label.element.style.backgroundColor); - - expect(nodes.includes(label1.color)).toBe(true); + expect(wrapper.findAll(GlLabel).length).toBe(1); + const label = wrapper.find(GlLabel); + expect(label.props('title')).toEqual(label1.title); + expect(label.props('description')).toEqual(label1.description); + expect(label.props('backgroundColor')).toEqual(label1.color); }); it('does not render label if label does not have an ID', done => { @@ -321,7 +311,7 @@ describe('Issue card component', () => { wrapper.vm .$nextTick() .then(() => { - expect(wrapper.findAll('.badge').length).toBe(1); + expect(wrapper.findAll(GlLabel).length).toBe(1); expect(wrapper.text()).not.toContain('closed'); done(); }) |