diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-17 14:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-17 14:33:21 +0300 |
commit | 7021455bd1ed7b125c55eb1b33c5a01f2bc55ee0 (patch) | |
tree | 5bdc2229f5198d516781f8d24eace62fc7e589e9 /spec/frontend/issues/dashboard/components/issues_dashboard_app_spec.js | |
parent | 185b095e93520f96e9cfc31d9c3e69b498cdab7c (diff) |
Add latest changes from gitlab-org/gitlab@15-6-stable-eev15.6.0-rc42
Diffstat (limited to 'spec/frontend/issues/dashboard/components/issues_dashboard_app_spec.js')
-rw-r--r-- | spec/frontend/issues/dashboard/components/issues_dashboard_app_spec.js | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/spec/frontend/issues/dashboard/components/issues_dashboard_app_spec.js b/spec/frontend/issues/dashboard/components/issues_dashboard_app_spec.js new file mode 100644 index 00000000000..3f72396cce6 --- /dev/null +++ b/spec/frontend/issues/dashboard/components/issues_dashboard_app_spec.js @@ -0,0 +1,58 @@ +import { GlEmptyState } from '@gitlab/ui'; +import { mountExtended } from 'helpers/vue_test_utils_helper'; +import IssuesDashboardApp from '~/issues/dashboard/components/issues_dashboard_app.vue'; +import IssuableList from '~/vue_shared/issuable/list/components/issuable_list_root.vue'; +import { IssuableStates } from '~/vue_shared/issuable/list/constants'; + +describe('IssuesDashboardApp component', () => { + let wrapper; + + const defaultProvide = { + calendarPath: 'calendar/path', + emptyStateSvgPath: 'empty-state.svg', + isSignedIn: true, + rssPath: 'rss/path', + }; + + const findCalendarButton = () => + wrapper.findByRole('link', { name: IssuesDashboardApp.i18n.calendarButtonText }); + const findEmptyState = () => wrapper.findComponent(GlEmptyState); + const findIssuableList = () => wrapper.findComponent(IssuableList); + const findRssButton = () => + wrapper.findByRole('link', { name: IssuesDashboardApp.i18n.rssButtonText }); + + const mountComponent = () => { + wrapper = mountExtended(IssuesDashboardApp, { provide: defaultProvide }); + }; + + beforeEach(() => { + mountComponent(); + }); + + it('renders IssuableList component', () => { + expect(findIssuableList().props()).toMatchObject({ + currentTab: IssuableStates.Opened, + namespace: 'dashboard', + recentSearchesStorageKey: 'issues', + searchInputPlaceholder: IssuesDashboardApp.i18n.searchInputPlaceholder, + tabs: IssuesDashboardApp.IssuableListTabs, + }); + }); + + it('renders RSS button link', () => { + expect(findRssButton().attributes('href')).toBe(defaultProvide.rssPath); + expect(findRssButton().props('icon')).toBe('rss'); + }); + + it('renders calendar button link', () => { + expect(findCalendarButton().attributes('href')).toBe(defaultProvide.calendarPath); + expect(findCalendarButton().props('icon')).toBe('calendar'); + }); + + it('renders empty state', () => { + expect(findEmptyState().props()).toMatchObject({ + svgPath: defaultProvide.emptyStateSvgPath, + title: IssuesDashboardApp.i18n.emptyStateTitle, + }); + }); +}); |