diff --git a/app/assets/javascripts/admin/deploy_keys/components/table.vue b/app/assets/javascripts/admin/deploy_keys/components/table.vue index 134498af3489f0a61d54e19970cb8109a75106dd..ac963a12afbd7ae0cec8268c1162569f2f45dbce 100644 --- a/app/assets/javascripts/admin/deploy_keys/components/table.vue +++ b/app/assets/javascripts/admin/deploy_keys/components/table.vue @@ -1,5 +1,14 @@ diff --git a/locale/gitlab.pot b/locale/gitlab.pot index ff6a572593190bda06b94becbc784a7fd66ac811..ac263f681ae9afa229c9d815abd093a5f5d0860c 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -15553,7 +15553,7 @@ msgstr "" msgid "Deploy keys" msgstr "" -msgid "Deploy keys grant read/write access to all repositories in your instance" +msgid "Deploy keys grant read/write access to all repositories in your instance, start by creating a new one above." msgstr "" msgid "Deploy progress not found. To see pods, ensure your environment matches %{linkStart}deploy board criteria%{linkEnd}." diff --git a/spec/frontend/admin/deploy_keys/components/table_spec.js b/spec/frontend/admin/deploy_keys/components/table_spec.js index a05654a1d256e96979a6705ab0c349620aadb13b..07d0f045509eefd942b1f0c608f9c9dab1d6c4ce 100644 --- a/spec/frontend/admin/deploy_keys/components/table_spec.js +++ b/spec/frontend/admin/deploy_keys/components/table_spec.js @@ -1,5 +1,5 @@ import { merge } from 'lodash'; -import { GlLoadingIcon, GlEmptyState, GlPagination, GlModal } from '@gitlab/ui'; +import { GlCard, GlLoadingIcon, GlEmptyState, GlPagination, GlModal } from '@gitlab/ui'; import { nextTick } from 'vue'; import responseBody from 'test_fixtures/api/deploy_keys/index.json'; @@ -45,6 +45,8 @@ describe('DeployKeysTable', () => { }); }; + const findCard = () => wrapper.findComponent(GlCard); + const findCardTitle = () => findCard().find('.gl-new-card-title-wrapper'); const findEditButton = (index) => wrapper.findAllByLabelText(DeployKeysTable.i18n.edit, { selector: 'a' }).at(index); const findRemoveButton = (index) => @@ -60,7 +62,7 @@ describe('DeployKeysTable', () => { expect(wrapper.findByText(expectedDeployKey.title).exists()).toBe(true); expect( - wrapper.findByText(expectedDeployKey.fingerprint_sha256, { selector: 'span' }).exists(), + wrapper.findByText(expectedDeployKey.fingerprint_sha256, { selector: 'div' }).exists(), ).toBe(true); expect(timeAgoTooltip.exists()).toBe(true); expect(timeAgoTooltip.props('time')).toBe(expectedDeployKey.created_at); @@ -70,7 +72,7 @@ describe('DeployKeysTable', () => { }; const expectDeployKeyWithFingerprintIsRendered = (expectedDeployKey, expectedRowIndex) => { - expect(wrapper.findByText(expectedDeployKey.fingerprint, { selector: 'span' }).exists()).toBe( + expect(wrapper.findByText(expectedDeployKey.fingerprint, { selector: 'div' }).exists()).toBe( true, ); expectDeployKeyIsRendered(expectedDeployKey, expectedRowIndex); @@ -85,8 +87,6 @@ describe('DeployKeysTable', () => { svgPath: defaultProvide.emptyStateSvgPath, title: DeployKeysTable.i18n.emptyStateTitle, description: DeployKeysTable.i18n.emptyStateDescription, - primaryButtonText: DeployKeysTable.i18n.newDeployKeyButtonText, - primaryButtonLink: defaultProvide.createPath, }); }); }; @@ -131,6 +131,16 @@ describe('DeployKeysTable', () => { createComponent(); }); + it('renders card with the deploy keys', () => { + expect(findCard().exists()).toBe(true); + }); + + it('shows the correct number of deploy keys', () => { + expect(findCardTitle().text()).toMatchInterpolatedText( + `Public deploy keys ${responseBody.length}`, + ); + }); + it('renders deploy keys in table', () => { expectDeployKeyWithFingerprintIsRendered(deployKey, 0); expectDeployKeyWithFingerprintIsRendered(deployKey2, 1);