diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-02 12:10:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-02 12:10:46 +0300 |
commit | f3b405856d99583bcd2f27c909abe779a48db512 (patch) | |
tree | 82d3ec2494523fb5b52f3f852be978c6b7263651 /spec/frontend/vue_shared/components/runner_instructions | |
parent | 9ecca14b2b3f05673a15399a2d1cc439206f3e0f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/vue_shared/components/runner_instructions')
-rw-r--r-- | spec/frontend/vue_shared/components/runner_instructions/runner_instructions_modal_spec.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/frontend/vue_shared/components/runner_instructions/runner_instructions_modal_spec.js b/spec/frontend/vue_shared/components/runner_instructions/runner_instructions_modal_spec.js index 0da9939e97f..001b6ee4a6f 100644 --- a/spec/frontend/vue_shared/components/runner_instructions/runner_instructions_modal_spec.js +++ b/spec/frontend/vue_shared/components/runner_instructions/runner_instructions_modal_spec.js @@ -45,8 +45,10 @@ describe('RunnerInstructionsModal component', () => { const findSkeletonLoader = () => wrapper.findComponent(GlSkeletonLoader); const findGlLoadingIcon = () => wrapper.findComponent(GlLoadingIcon); const findAlert = () => wrapper.findComponent(GlAlert); + const findModal = () => wrapper.findComponent(GlModal); const findPlatformButtonGroup = () => wrapper.findByTestId('platform-buttons'); const findPlatformButtons = () => findPlatformButtonGroup().findAllComponents(GlButton); + const findOsxPlatformButton = () => wrapper.find({ ref: 'osx' }); const findArchitectureDropdownItems = () => wrapper.findAllByTestId('architecture-dropdown-item'); const findBinaryInstructions = () => wrapper.findByTestId('binary-instructions'); const findRegisterCommand = () => wrapper.findByTestId('register-command'); @@ -140,6 +142,38 @@ describe('RunnerInstructionsModal component', () => { expect(instructions).toBe(registerInstructions); }); }); + + describe('when the modal is shown', () => { + it('sets the focus on the selected platform', () => { + findPlatformButtons().at(0).element.focus = jest.fn(); + + findModal().vm.$emit('shown'); + + expect(findPlatformButtons().at(0).element.focus).toHaveBeenCalled(); + }); + }); + + describe('when providing a defaultPlatformName', () => { + beforeEach(async () => { + createComponent({ props: { defaultPlatformName: 'osx' } }); + await waitForPromises(); + }); + + it('runner instructions for the default selected platform are requested', () => { + expect(runnerSetupInstructionsHandler).toHaveBeenCalledWith({ + platform: 'osx', + architecture: 'amd64', + }); + }); + + it('sets the focus on the default selected platform', () => { + findOsxPlatformButton().element.focus = jest.fn(); + + findModal().vm.$emit('shown'); + + expect(findOsxPlatformButton().element.focus).toHaveBeenCalled(); + }); + }); }); describe('after a platform and architecture are selected', () => { |