summaryrefslogtreecommitdiff
path: root/spec/frontend/access_tokens
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-06-07 15:08:12 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-06-07 15:08:12 +0000
commit7bbc731c75d0b8bf7c74ba77d521266d2ed0a1fc (patch)
tree4cab2383639b839613ffc4ef457e2a594f61aaa3 /spec/frontend/access_tokens
parentedb317e9fe43c62229805fae529c550467ee5dc5 (diff)
downloadgitlab-ce-7bbc731c75d0b8bf7c74ba77d521266d2ed0a1fc.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/access_tokens')
-rw-r--r--spec/frontend/access_tokens/components/new_access_token_app_spec.js25
1 files changed, 17 insertions, 8 deletions
diff --git a/spec/frontend/access_tokens/components/new_access_token_app_spec.js b/spec/frontend/access_tokens/components/new_access_token_app_spec.js
index b750a955fb2..25b3eba6587 100644
--- a/spec/frontend/access_tokens/components/new_access_token_app_spec.js
+++ b/spec/frontend/access_tokens/components/new_access_token_app_spec.js
@@ -1,7 +1,7 @@
import { GlAlert } from '@gitlab/ui';
-import { shallowMount } from '@vue/test-utils';
import { nextTick } from 'vue';
import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures';
+import { mountExtended } from 'helpers/vue_test_utils_helper';
import NewAccessTokenApp from '~/access_tokens/components/new_access_token_app.vue';
import { createAlert, VARIANT_INFO } from '~/flash';
import { __, sprintf } from '~/locale';
@@ -16,7 +16,7 @@ describe('~/access_tokens/components/new_access_token_app', () => {
const accessTokenType = 'personal access token';
const createComponent = (provide = { accessTokenType }) => {
- wrapper = shallowMount(NewAccessTokenApp, {
+ wrapper = mountExtended(NewAccessTokenApp, {
provide,
});
};
@@ -64,17 +64,26 @@ describe('~/access_tokens/components/new_access_token_app', () => {
sprintf(__('Copy %{accessTokenType}'), { accessTokenType }),
);
expect(InputCopyToggleVisibilityComponent.props('initialVisibility')).toBe(true);
- expect(InputCopyToggleVisibilityComponent.props('inputClass')).toBe(
- 'qa-created-access-token',
- );
- expect(InputCopyToggleVisibilityComponent.props('qaSelector')).toBe(
- 'created_access_token_field',
- );
expect(InputCopyToggleVisibilityComponent.attributes('label')).toBe(
sprintf(__('Your new %{accessTokenType}'), { accessTokenType }),
);
});
+ it('input field should contain QA-related selectors', async () => {
+ const newToken = '12345';
+ await triggerSuccess(newToken);
+
+ expect(wrapper.findComponent(GlAlert).exists()).toBe(false);
+
+ const inputAttributes = wrapper
+ .findByLabelText(sprintf(__('Your new %{accessTokenType}'), { accessTokenType }))
+ .attributes();
+ expect(inputAttributes).toMatchObject({
+ class: expect.stringContaining('qa-created-access-token'),
+ 'data-qa-selector': 'created_access_token_field',
+ });
+ });
+
it('should render an info alert', async () => {
await triggerSuccess();