diff --git a/webapp/channels/src/components/onboarding_tasklist/__snapshots__/onboarding_tasklist_completed.test.tsx.snap b/webapp/channels/src/components/onboarding_tasklist/__snapshots__/onboarding_tasklist_completed.test.tsx.snap new file mode 100644 index 0000000000..75a83a7151 --- /dev/null +++ b/webapp/channels/src/components/onboarding_tasklist/__snapshots__/onboarding_tasklist_completed.test.tsx.snap @@ -0,0 +1,91 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`components/onboarding_tasklist/onboarding_tasklist_completed.tsx should match snapshot 1`] = ` + + + + completed tasks image +

+ +

+ + + + + + +
+ +
+ + +
+ + + +
+
+ + + +
+
+
+
+`; diff --git a/webapp/channels/src/components/onboarding_tasklist/onboarding_tasklist_completed.test.tsx b/webapp/channels/src/components/onboarding_tasklist/onboarding_tasklist_completed.test.tsx new file mode 100644 index 0000000000..c54bb5a6b3 --- /dev/null +++ b/webapp/channels/src/components/onboarding_tasklist/onboarding_tasklist_completed.test.tsx @@ -0,0 +1,73 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import React from 'react'; + +import Completed from './onboarding_tasklist_completed'; +import {shallow} from 'enzyme'; + +let mockState: any; +const mockDispatch = jest.fn(); +const dismissMockFn = jest.fn(); + +jest.mock('react-redux', () => ({ + ...jest.requireActual('react-redux') as typeof import('react-redux'), + useSelector: (selector: (state: typeof mockState) => unknown) => selector(mockState), + useDispatch: () => mockDispatch, +})); + +describe('components/onboarding_tasklist/onboarding_tasklist_completed.tsx', () => { + const props = { + dismissAction: dismissMockFn, + isCurrentUserSystemAdmin: true, + isFirstAdmin: true, + }; + + beforeEach(() => { + mockState = { + entities: { + admin: { + prevTrialLicense: { + IsLicensed: 'false', + }, + }, + general: { + license: { + IsLicensed: 'false', + }, + }, + cloud: { + subscription: { + product_id: 'prod_professional', + is_free_trial: 'false', + trial_end_at: 1, + }, + }, + }, + }; + }); + + afterEach(() => { + jest.restoreAllMocks(); + }); + + test('should match snapshot', () => { + const wrapper = shallow(); + expect(wrapper).toMatchSnapshot(); + }); + + test('finds the completed subtitle', () => { + const wrapper = shallow(); + expect(wrapper.find('.completed-subtitle')).toHaveLength(1); + }); + + test('displays the no thanks option to close the onboarding list', () => { + const wrapper = shallow(); + const noThanksLink = wrapper.find('.no-thanks-link'); + expect(noThanksLink).toHaveLength(1); + + // calls the dissmiss function on click + noThanksLink.simulate('click'); + expect(dismissMockFn).toHaveBeenCalledTimes(1); + }); +}); diff --git a/webapp/channels/src/components/onboarding_tasklist/onboarding_tasklist_completed.tsx b/webapp/channels/src/components/onboarding_tasklist/onboarding_tasklist_completed.tsx index 879327a065..43134d1aac 100644 --- a/webapp/channels/src/components/onboarding_tasklist/onboarding_tasklist_completed.tsx +++ b/webapp/channels/src/components/onboarding_tasklist/onboarding_tasklist_completed.tsx @@ -49,7 +49,7 @@ const CompletedWrapper = styled.div` &.fade-exit-done { transform: scale(1); } - .start-trial-btn, button { + .start-trial-btn { padding: 13px 20px; background: var(--button-bg); border-radius: 4px; @@ -101,6 +101,24 @@ const CompletedWrapper = styled.div` width: 200px; font-size: 12px; } + + .style-link { + border: none; + background: none !important; + color: var(--button-bg) !important; + } + + .no-thanks-link { + display: inline-block; + min-width: fit-content; + margin-top: 18px; + font-weight: 600; + font-size: 14px; + line-height: 20px; + &:hover { + text-decoration: underline; + } + } `; interface Props { @@ -193,6 +211,15 @@ const Completed = (props: Props): JSX.Element => { onClick={dismissAction} /> )} + ) : ( diff --git a/webapp/channels/src/i18n/en.json b/webapp/channels/src/i18n/en.json index f3da6b0116..6f147fa4ee 100644 --- a/webapp/channels/src/i18n/en.json +++ b/webapp/channels/src/i18n/en.json @@ -4304,6 +4304,7 @@ "onboardingTask.checklist.downloads": "Now that you’re all set up, download our apps.", "onboardingTask.checklist.higher_security_features": "Interested in our higher-security features?", "onboardingTask.checklist.main_subtitle": "Let's get up and running.", + "onboardingTask.checklist.no_tanks": "No, thanks", "onboardingTask.checklist.start_enterprise_now": "Start your free Enterprise trial now!", "onboardingTask.checklist.task_complete_your_profile": "Complete your profile.", "onboardingTask.checklist.task_create_from_work_template": "Create from a template - set up a channel with linked boards and playbooks.",