Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-04-01 12:10:01 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-04-01 12:10:01 +0300
commit44c29521a1f5b9fa7e930dbe2a21b894f6b75e74 (patch)
tree252704b55a395c4b34239718a5b82fc979bcb37c /spec/frontend/jira_connect
parentc925120e3026601193099ec1ed7fe635a8aafa8e (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/jira_connect')
-rw-r--r--spec/frontend/jira_connect/subscriptions/components/app_spec.js28
-rw-r--r--spec/frontend/jira_connect/subscriptions/components/browser_support_alert_spec.js37
-rw-r--r--spec/frontend/jira_connect/subscriptions/components/compatibility_alert_spec.js2
3 files changed, 66 insertions, 1 deletions
diff --git a/spec/frontend/jira_connect/subscriptions/components/app_spec.js b/spec/frontend/jira_connect/subscriptions/components/app_spec.js
index 6b3ca7ffd65..ce02144f22f 100644
--- a/spec/frontend/jira_connect/subscriptions/components/app_spec.js
+++ b/spec/frontend/jira_connect/subscriptions/components/app_spec.js
@@ -6,10 +6,12 @@ import JiraConnectApp from '~/jira_connect/subscriptions/components/app.vue';
import SignInPage from '~/jira_connect/subscriptions/pages/sign_in.vue';
import SubscriptionsPage from '~/jira_connect/subscriptions/pages/subscriptions.vue';
import UserLink from '~/jira_connect/subscriptions/components/user_link.vue';
+import BrowserSupportAlert from '~/jira_connect/subscriptions/components/browser_support_alert.vue';
import createStore from '~/jira_connect/subscriptions/store';
import { SET_ALERT } from '~/jira_connect/subscriptions/store/mutation_types';
import { I18N_DEFAULT_SIGN_IN_ERROR_MESSAGE } from '~/jira_connect/subscriptions/constants';
import { __ } from '~/locale';
+import AccessorUtilities from '~/lib/utils/accessor';
import { mockSubscription } from '../mock_data';
jest.mock('~/jira_connect/subscriptions/utils', () => ({
@@ -26,6 +28,7 @@ describe('JiraConnectApp', () => {
const findSignInPage = () => wrapper.findComponent(SignInPage);
const findSubscriptionsPage = () => wrapper.findComponent(SubscriptionsPage);
const findUserLink = () => wrapper.findComponent(UserLink);
+ const findBrowserSupportAlert = () => wrapper.findComponent(BrowserSupportAlert);
const createComponent = ({ provide, mountFn = shallowMountExtended } = {}) => {
store = createStore();
@@ -207,4 +210,29 @@ describe('JiraConnectApp', () => {
});
});
});
+
+ describe.each`
+ jiraConnectOauthEnabled | canUseCrypto | shouldShowAlert
+ ${false} | ${false} | ${false}
+ ${false} | ${true} | ${false}
+ ${true} | ${false} | ${true}
+ ${true} | ${true} | ${false}
+ `(
+ 'when `jiraConnectOauth` feature flag is $jiraConnectOauthEnabled and `AccessorUtilities.canUseCrypto` returns $canUseCrypto',
+ ({ jiraConnectOauthEnabled, canUseCrypto, shouldShowAlert }) => {
+ beforeEach(() => {
+ jest.spyOn(AccessorUtilities, 'canUseCrypto').mockReturnValue(canUseCrypto);
+
+ createComponent({ provide: { glFeatures: { jiraConnectOauth: jiraConnectOauthEnabled } } });
+ });
+
+ it(`does ${shouldShowAlert ? '' : 'not'} render BrowserSupportAlert component`, () => {
+ expect(findBrowserSupportAlert().exists()).toBe(shouldShowAlert);
+ });
+
+ it(`does ${!shouldShowAlert ? '' : 'not'} render the main Jira Connect app template`, () => {
+ expect(wrapper.findByTestId('jira-connect-app').exists()).toBe(!shouldShowAlert);
+ });
+ },
+ );
});
diff --git a/spec/frontend/jira_connect/subscriptions/components/browser_support_alert_spec.js b/spec/frontend/jira_connect/subscriptions/components/browser_support_alert_spec.js
new file mode 100644
index 00000000000..aa93a6be3c8
--- /dev/null
+++ b/spec/frontend/jira_connect/subscriptions/components/browser_support_alert_spec.js
@@ -0,0 +1,37 @@
+import { GlAlert, GlLink } from '@gitlab/ui';
+import { shallowMount, mount } from '@vue/test-utils';
+import BrowserSupportAlert from '~/jira_connect/subscriptions/components/browser_support_alert.vue';
+
+describe('BrowserSupportAlert', () => {
+ let wrapper;
+
+ const createComponent = ({ mountFn = shallowMount } = {}) => {
+ wrapper = mountFn(BrowserSupportAlert);
+ };
+
+ const findAlert = () => wrapper.findComponent(GlAlert);
+ const findLink = () => wrapper.findComponent(GlLink);
+
+ afterEach(() => {
+ wrapper.destroy();
+ });
+
+ it('displays a non-dismissible alert', () => {
+ createComponent();
+
+ expect(findAlert().exists()).toBe(true);
+ expect(findAlert().props()).toMatchObject({
+ dismissible: false,
+ title: BrowserSupportAlert.i18n.title,
+ variant: 'danger',
+ });
+ });
+
+ it('renders help link with target="_blank" and rel="noopener noreferrer"', () => {
+ createComponent({ mountFn: mount });
+ expect(findLink().attributes()).toMatchObject({
+ target: '_blank',
+ rel: 'noopener',
+ });
+ });
+});
diff --git a/spec/frontend/jira_connect/subscriptions/components/compatibility_alert_spec.js b/spec/frontend/jira_connect/subscriptions/components/compatibility_alert_spec.js
index f8ee8c2c664..5f38a0acb9d 100644
--- a/spec/frontend/jira_connect/subscriptions/components/compatibility_alert_spec.js
+++ b/spec/frontend/jira_connect/subscriptions/components/compatibility_alert_spec.js
@@ -29,7 +29,7 @@ describe('CompatibilityAlert', () => {
createComponent({ mountFn: mount });
expect(findLink().attributes()).toMatchObject({
target: '_blank',
- rel: 'noopener noreferrer',
+ rel: 'noopener',
});
});